Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
207a05f75b | |||
308b65e7be | |||
6efc4fba23 | |||
47b88ae300 | |||
8863d1ef79 | |||
f6cfa57db6 | |||
cdcb034b6b | |||
62c03fc009 | |||
015307986d | |||
c409589eab | |||
0cc2b94c7e | |||
de547cc2dd | |||
a8ea6b53bc | |||
300402a38f | |||
fd9e202d49 | |||
8ecaf8d78a | |||
2c3682bf4c | |||
692584ff8a | |||
5c163b3ea2 | |||
cb915edc33 | |||
00c9aa6cd2 | |||
665aaabe48 | |||
a96789a9ed | |||
f317ded417 | |||
418f2e5583 | |||
4b3ccb3fff | |||
d2380db06b | |||
af5d1b1404 | |||
3503f954be | |||
d2e30fc62f | |||
1272de1add |
@ -6,6 +6,7 @@ cd ./public_html
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Pulling down latest code."
|
echo "Pulling down latest code."
|
||||||
git pull --ff-only origin prod
|
git pull --ff-only origin prod
|
||||||
|
git submodule update --init --recursive
|
||||||
echo ""
|
echo ""
|
||||||
echo "Clearing drush caches."
|
echo "Clearing drush caches."
|
||||||
drush cache-clear drush
|
drush cache-clear drush
|
||||||
|
@ -89,7 +89,7 @@ server {
|
|||||||
#fastcgi_param DOCUMENT_ROOT /var/www/enfrancais.fr/api;
|
#fastcgi_param DOCUMENT_ROOT /var/www/enfrancais.fr/api;
|
||||||
# fastcgi_buffer_size 16k;
|
# fastcgi_buffer_size 16k;
|
||||||
# fastcgi_buffers 4 16k;
|
# fastcgi_buffers 4 16k;
|
||||||
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
@ -116,7 +116,7 @@ server {
|
|||||||
fastcgi_intercept_errors on;
|
fastcgi_intercept_errors on;
|
||||||
# fastcgi_buffer_size 16k;
|
# fastcgi_buffer_size 16k;
|
||||||
# fastcgi_buffers 4 16k;
|
# fastcgi_buffers 4 16k;
|
||||||
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
|
||||||
}
|
}
|
||||||
# Fighting with Styles? This little gem is amazing.
|
# Fighting with Styles? This little gem is amazing.
|
||||||
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
|
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
|
||||||
|
@ -92,7 +92,7 @@ server {
|
|||||||
fastcgi_intercept_errors on;
|
fastcgi_intercept_errors on;
|
||||||
# fastcgi_buffer_size 16k;
|
# fastcgi_buffer_size 16k;
|
||||||
# fastcgi_buffers 4 16k;
|
# fastcgi_buffers 4 16k;
|
||||||
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
|
||||||
}
|
}
|
||||||
# Fighting with Styles? This little gem is amazing.
|
# Fighting with Styles? This little gem is amazing.
|
||||||
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
|
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
|
||||||
|
5
assets/fail2ban/filter.d/nginx-badbots.conf
Normal file
5
assets/fail2ban/filter.d/nginx-badbots.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Definition]
|
||||||
|
|
||||||
|
failregex = FastCGI sent in stderr: "Primary script unknown" .*, client: <HOST>, server: .*
|
||||||
|
|
||||||
|
ignoreregex =
|
7
assets/fail2ban/jail.d/nginx-badbots.conf
Normal file
7
assets/fail2ban/jail.d/nginx-badbots.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[nginx-badbots]
|
||||||
|
|
||||||
|
enabled = true
|
||||||
|
port = http,https
|
||||||
|
filter = <FILTER>
|
||||||
|
logpath = <LOGPATH>
|
||||||
|
maxretry = 2
|
@ -22,7 +22,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
1920
assets/php8.1-fpm.ini
Normal file
1920
assets/php8.1-fpm.ini
Normal file
File diff suppressed because it is too large
Load Diff
1920
assets/php8.2-fpm.ini
Normal file
1920
assets/php8.2-fpm.ini
Normal file
File diff suppressed because it is too large
Load Diff
@ -48,7 +48,7 @@ server {
|
|||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
@ -24,7 +24,7 @@ server {
|
|||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
@ -5,7 +5,7 @@ ConditionPathExists=/usr/local/sbin/urbackupclientbackend
|
|||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart=/usr/local/sbin/urbackupclientbackend -d
|
ExecStart=/usr/local/sbin/urbackupclientbackend -d
|
||||||
PIDFile = /var/run/urbackup_srv.pid
|
PIDFile = /run/urbackup_srv.pid
|
||||||
TimeoutSec=0
|
TimeoutSec=0
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# update bare repos
|
# update bare repos
|
||||||
git --git-dir=git-repositories/DOMAIN.git fetch origin prod:prod
|
echo "Updating bare repos"
|
||||||
|
su -c "git --git-dir=git-repositories/DOMAIN.git fetch origin prod:prod" USER
|
||||||
# deploy prod
|
# deploy prod
|
||||||
cd www/DOMAIN/
|
cd www/DOMAIN/
|
||||||
./deploy.sh
|
su -c "./deploy.sh" USER
|
||||||
|
1
assets/zabbix/userparameter_linux_name_version.conf
Normal file
1
assets/zabbix/userparameter_linux_name_version.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
UserParameter=linux.system.name.version,(lsb_release -d > dev/null 2>&1) && lsb_release -d || (cat /etc/centos-release > /dev/null > /dev/null 2>&1 && cat /etc/centos-release || cat /etc/redhat-release)
|
@ -111,12 +111,12 @@ if [ "$vh" = "yes" ]; then
|
|||||||
chmod +x post-receive # pre-receive
|
chmod +x post-receive # pre-receive
|
||||||
|
|
||||||
# setup git repo on site folder
|
# setup git repo on site folder
|
||||||
cd /home/"$user"/www/"$_domain"/app
|
cd /home/"$user"/www/"$_domain"/public_html
|
||||||
git init
|
su -c "git init" $user
|
||||||
# link to the bare repo
|
# link to the bare repo
|
||||||
git remote add origin /home/"$user"/git-repositories/"$_domain".git
|
su -c "git remote add origin /home/$user/git-repositories/$_domain.git" $user
|
||||||
|
chown -R "$user":"$user" /home/"$user"/www/"$_domain"
|
||||||
|
|
||||||
chown -R "$user":"$user" /home/"$user"/www/"$_domain"/app
|
|
||||||
|
|
||||||
cd "$_cwd"
|
cd "$_cwd"
|
||||||
# done
|
# done
|
||||||
|
76
bin/lemp.sh
76
bin/lemp.sh
@ -36,20 +36,37 @@ echo -e '\033[35m
|
|||||||
/ ____/ __ / ____/
|
/ ____/ __ / ____/
|
||||||
/_/ /_/ /_/_/
|
/_/ /_/ /_/_/
|
||||||
\033[0m'
|
\033[0m'
|
||||||
echo -e "\033[35;1mInstalling PHP 7.3 \033[0m"
|
|
||||||
|
echo -e "\033[35;1mInstalling SURY \033[0m"
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
apt-get --yes install ca-certificates apt-transport-https software-properties-common curl lsb-release
|
||||||
|
curl -sSL https://packages.sury.org/php/README.txt | bash -x
|
||||||
|
apt-get update && apt-get upgrade
|
||||||
|
|
||||||
|
echo -e "\033[35;1mInstalling PHP \033[0m"
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# mv: cannot stat '/etc/php/7.0/fpm/php.ini': No such file or directory
|
# mv: cannot stat '/etc/php/7.0/fpm/php.ini': No such file or directory
|
||||||
# cp: cannot create regular file '/etc/php/7.0/fpm/php.ini': No such file or directory
|
# cp: cannot create regular file '/etc/php/7.0/fpm/php.ini': No such file or directory
|
||||||
# Configuring PHP
|
# Configuring PHP
|
||||||
# Failed to enable unit: Unit file php7.0-fpm.service does not exist.
|
# Failed to enable unit: Unit file php7.0-fpm.service does not exist.
|
||||||
# Failed to start php7.0-fpm.service: Unit php7.0-fpm.service not found.
|
# Failed to start php7.0-fpm.service: Unit php7.0-fpm.service not found.
|
||||||
|
|
||||||
apt-get --yes install php7.3-fpm php7.3-mysql php7.3-opcache php7.3-curl php7.3-mbstring php7.3-zip php7.3-xml php7.3-gd php-memcached php7.3-imagick php7.3-apcu
|
# apt-get --yes install php7.4-fpm php7.4-mysql php7.4-opcache php7.4-curl php7.4-mbstring php7.4-zip php7.4-xml php7.4-gd php-memcached php7.4-imagick php7.4-apcu
|
||||||
# php7.3-mcrypt ??
|
# php7.4-mcrypt ??
|
||||||
|
|
||||||
mv /etc/php/7.3/fpm/php.ini /etc/php/7.3/fpm/php.ini.back
|
apt-get --yes install php8.1-fpm php8.1-mysql php8.1-opcache php8.1-curl php8.1-mbstring php8.1-zip php8.1-xml php8.1-gd php8.1-memcached php8.1-imagick php8.1-apcu php8.1-redis php8.1-bz2 php8.1-bcmath
|
||||||
cp "$_assets"/php-fpm.ini /etc/php/7.3/fpm/php.ini
|
|
||||||
|
# apt-get --yes install php8.2-fpm php8.2-mysql php8.2-opcache php8.2-curl php8.2-mbstring php8.2-zip php8.2-xml php8.2-gd php-memcached php8.2-imagick php8.2-apcu php8.2-redis php8.2-bz2 php8.2-bcmath
|
||||||
|
|
||||||
|
# apt-get --yes install php8.3-fpm php8.3-mysql php8.3-opcache php8.3-curl php8.3-mbstring php8.3-zip php8.3-xml php8.3-gd php8.3-memcached php8.3-imagick php8.3-apcu php8.3-redis php8.3-bz2 php8.3-bcmath
|
||||||
|
|
||||||
|
|
||||||
|
mv /etc/php/8.1/fpm/php.ini /etc/php/8.1/fpm/php.ini.back
|
||||||
|
cp "$_assets"/php8.1-fpm.ini /etc/php/8.1/fpm/php.ini
|
||||||
|
|
||||||
echo "Configuring PHP"
|
echo "Configuring PHP"
|
||||||
|
|
||||||
@ -57,8 +74,8 @@ mkdir /var/log/php
|
|||||||
chown www-data /var/log/php
|
chown www-data /var/log/php
|
||||||
cp "$_assets"/logrotate-php /etc/logrotate.d/php
|
cp "$_assets"/logrotate-php /etc/logrotate.d/php
|
||||||
|
|
||||||
systemctl enable php7.3-fpm
|
systemctl enable php8.1-fpm
|
||||||
systemctl start php7.3-fpm
|
systemctl start php8.1-fpm
|
||||||
|
|
||||||
# echo "Installing memecached"
|
# echo "Installing memecached"
|
||||||
# replaced by redis
|
# replaced by redis
|
||||||
@ -112,6 +129,9 @@ if [ "$installmysql" = "yes" ]; then
|
|||||||
|
|
||||||
cp "$_assets"/mysql/innodb-file-per-table.cnf /etc/mysql/conf.d/
|
cp "$_assets"/mysql/innodb-file-per-table.cnf /etc/mysql/conf.d/
|
||||||
|
|
||||||
|
# you may increase memory
|
||||||
|
# innodb_buffer_pool_size = 1024M
|
||||||
|
|
||||||
systemctl enable mariadb.service
|
systemctl enable mariadb.service
|
||||||
systemctl restart mariadb.service
|
systemctl restart mariadb.service
|
||||||
echo -e "\033[92;1mmysql installed\033[Om"
|
echo -e "\033[92;1mmysql installed\033[Om"
|
||||||
@ -136,24 +156,24 @@ if [ "$installmysql" = "yes" ]; then
|
|||||||
##### Try 'cp --help' for more information.
|
##### Try 'cp --help' for more information.
|
||||||
|
|
||||||
# TODO no pma package available :(
|
# TODO no pma package available :(
|
||||||
# apt-get --yes install phpmyadmin
|
apt-get --yes install phpmyadmin
|
||||||
# ln -s /usr/share/phpmyadmin /var/www/html/
|
ln -s /usr/share/phpmyadmin /var/www/html/
|
||||||
# cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
|
cp "$_assets"/nginx-phpmyadmin.conf /etc/nginx/sites-available/phpmyadmin.conf
|
||||||
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
|
|
||||||
# echo -e "\033[92;1mphpMyAdmin installed\033[Om"
|
echo -e "\033[92;1mphpMyAdmin installed\033[Om"
|
||||||
# echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
|
echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
|
||||||
|
|
||||||
# install from source
|
# install from source
|
||||||
apt-get --yes install php-{mbstring,zip,gd,xml,pear,gettext,cgi}
|
# apt-get --yes install php-{mbstring,zip,gd,xml,pear,gettext,cgi}
|
||||||
cd /var/www/html/
|
# cd /var/www/html/
|
||||||
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
|
# wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
|
||||||
unzip phpMyAdmin-latest-all-languages.zip
|
# unzip phpMyAdmin-latest-all-languages.zip
|
||||||
mv phpMyAdmin-*-all-languages pma
|
# mv phpMyAdmin-*-all-languages pma
|
||||||
rm phpMyAdmin-latest-all-languages.zip
|
# rm phpMyAdmin-latest-all-languages.zip
|
||||||
# cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
|
# # cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
|
||||||
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
|
# # ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
|
||||||
echo -e "\033[92;1mphpMyAdmin installed\033[Om"
|
# echo -e "\033[92;1mphpMyAdmin installed\033[Om"
|
||||||
echo -e "\033[92;1mYou can access it at yourip/pma\033[Om"
|
# echo -e "\033[92;1mYou can access it at yourip/pma\033[Om"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +188,7 @@ echo -e '\033[35m
|
|||||||
\033[0m'
|
\033[0m'
|
||||||
echo -e "\033[35;1mInstalling Redis \033[0m"
|
echo -e "\033[35;1mInstalling Redis \033[0m"
|
||||||
sleep 3
|
sleep 3
|
||||||
apt-get --yes install redis-server php-redis
|
apt-get --yes install redis-server php8.1-redis
|
||||||
|
|
||||||
# TODO set maxmemory=2gb
|
# TODO set maxmemory=2gb
|
||||||
# TODO set maxmemory-policy=volatile-lru
|
# TODO set maxmemory-policy=volatile-lru
|
||||||
@ -182,7 +202,7 @@ apt-get --yes install redis-server php-redis
|
|||||||
|
|
||||||
systemctl enable redis-server
|
systemctl enable redis-server
|
||||||
systemctl restart redis-server
|
systemctl restart redis-server
|
||||||
systemctl restart php7.3-fpm
|
systemctl restart php8.1-fpm
|
||||||
echo -e "\033[92;1mRedis installed\033[Om"
|
echo -e "\033[92;1mRedis installed\033[Om"
|
||||||
|
|
||||||
echo -e '\033[35m
|
echo -e '\033[35m
|
||||||
@ -208,11 +228,9 @@ echo -e '\033[35m
|
|||||||
/ /_/ / / / /_/ (__ ) / / /
|
/ /_/ / / / /_/ (__ ) / / /
|
||||||
/_____/_/ \__,_/____/_/ /_/
|
/_____/_/ \__,_/____/_/ /_/
|
||||||
\033[0m'
|
\033[0m'
|
||||||
echo -e "\033[35;1mInstalling Drush and DrupalConsole\033[0m"
|
echo -e "\033[35;1mInstalling Drush\033[0m"
|
||||||
sleep 3
|
sleep 3
|
||||||
curl https://drupalconsole.com/installer -L -o /usr/local/bin/drupal
|
|
||||||
chmod +x /usr/local/bin/drupal
|
|
||||||
# curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar -L -o /usr/local/bin/drush
|
# curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar -L -o /usr/local/bin/drush
|
||||||
wget -O /usr/local/bin/drush https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
|
wget -O /usr/local/bin/drush https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
|
||||||
chmod +x /usr/local/bin/drush
|
chmod +x /usr/local/bin/drush
|
||||||
echo -e "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
|
echo -e "\033[92;1mDrush\033[Om"
|
||||||
|
44
bin/nfs.sh
Normal file
44
bin/nfs.sh
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo -e '\033[35m
|
||||||
|
__
|
||||||
|
_ __ / _|___
|
||||||
|
| _ \| |_/ __|
|
||||||
|
| | | | _\__ \
|
||||||
|
|_| |_|_| |___/
|
||||||
|
|
||||||
|
\033[0m'
|
||||||
|
echo -e "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m"
|
||||||
|
|
||||||
|
|
||||||
|
apt install nfs-kernel-server
|
||||||
|
vim /etc/exports
|
||||||
|
mkdir /home/proxmox-backup
|
||||||
|
mkdir /home/urbackup
|
||||||
|
|
||||||
|
ufw allow from 37.187.134.71 to any port nfs
|
||||||
|
ufw allow from 37.187.134.71 to any port 111
|
||||||
|
ufw allow proto udp from 37.187.134.71 to any port 32764:32769
|
||||||
|
ufw allow proto tcp from 37.187.134.71 to any port 32764:32769
|
||||||
|
|
||||||
|
ufw allow from 37.187.93.155 to any port nfs
|
||||||
|
ufw allow from 37.187.93.155 to any port 111
|
||||||
|
ufw allow proto udp from 37.187.93.155 to any port 32764:32769
|
||||||
|
ufw allow proto tcp from 37.187.93.155 to any port 32764:32769
|
||||||
|
|
||||||
|
ufw allow from 37.187.128.147 to any port nfs
|
||||||
|
ufw allow from 37.187.128.147 to any port 111
|
||||||
|
ufw allow proto udp from 37.187.128.147 to any port 32764:32769
|
||||||
|
ufw allow proto tcp from 37.187.128.147 to any port 32764:32769
|
||||||
|
|
||||||
|
|
||||||
|
ufw allow from 94.23.8.104 to any port nfs
|
||||||
|
ufw allow from 94.23.8.104 to any port 111
|
||||||
|
ufw allow proto udp from 94.23.8.104 to any port 32764:32769
|
||||||
|
ufw allow proto tcp from 94.23.8.104 to any port 32764:32769
|
||||||
|
|
||||||
|
systemctl restart nfs-server
|
||||||
|
systemctl enable nfs-server
|
||||||
|
|
||||||
|
vim /etc/ufw/user.rules
|
||||||
|
|
11
bin/ssh.sh
11
bin/ssh.sh
@ -14,8 +14,13 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i 's/PermitRootLogin\ yes/PermitRootLogin no/g' /etc/ssh/sshd_config
|
# sed -i 's/PermitRootLogin\ yes/PermitRootLogin no/g' /etc/ssh/sshd_config
|
||||||
sed -i 's/PermitEmptyPasswords\ yes/PermitEmptyPasswords no/g' /etc/ssh/sshd_config
|
# sed -i 's/PermitEmptyPasswords\ yes/PermitEmptyPasswords no/g' /etc/ssh/sshd_config
|
||||||
sed -i 's/Protocol\ [0-9]/Protocol 2/g' /etc/ssh/sshd_config
|
# sed -i 's/Protocol\ [0-9]/Protocol 2/g' /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
touch /etc/ssh/sshd_config.d/custom.conf
|
||||||
|
echo "PermitRootLogin no" >> /etc/ssh/sshd_config.d/custom.conf
|
||||||
|
echo "PermitEmptyPasswords no" >> /etc/ssh/sshd_config.d/custom.conf
|
||||||
|
|
||||||
systemctl reload ssh
|
systemctl reload ssh
|
||||||
echo -e "\033[92;1mSSH secured\033[Om"
|
echo -e "\033[92;1mSSH secured\033[Om"
|
||||||
|
@ -39,15 +39,17 @@ apt install build-essential "g++" "libcrypto++-dev" libz-dev -y
|
|||||||
|
|
||||||
# Download the UrBackup client source files and extract them
|
# Download the UrBackup client source files and extract them
|
||||||
# wget -P /tmp/ https://hndl.urbackup.org/Client/latest/urbackup-client-2.3.4.0.tar.gz
|
# wget -P /tmp/ https://hndl.urbackup.org/Client/latest/urbackup-client-2.3.4.0.tar.gz
|
||||||
wget -P /tmp/ https://hndl.urbackup.org/Client/2.4.11/urbackup-client-2.4.11.0.tar.gz
|
# wget -P /tmp/ https://hndl.urbackup.org/Client/2.4.11/urbackup-client-2.4.11.0.tar.gz
|
||||||
|
# wget -P /tmp/ https://hndl.urbackup.org/Client/2.5.20/urbackup-client-2.5.20.0.tar.gz
|
||||||
|
# wget -P /tmp/ https://hndl.urbackup.org/Client/2.5.20/urbackup-client-2.5.24.0.tar.gz
|
||||||
|
wget -P /tmp/ https://hndl.urbackup.org/Client/2.5.25/urbackup-client-2.5.25.0.tar.gz
|
||||||
cd /tmp
|
cd /tmp
|
||||||
# tar xzf /tmp/urbackup-client-2.3.4.0.tar.gz
|
|
||||||
tar xzf /tmp/urbackup-client-2.4.11.0.tar.gz
|
tar xzf /tmp/urbackup-client-2.5.25.0.tar.gz
|
||||||
|
|
||||||
# Build the UrBackup client and install it
|
# Build the UrBackup client and install it
|
||||||
# cd /tmp/urbackup-client-2.3.4.0
|
# cd /tmp/urbackup-client-2.3.4.0
|
||||||
cd /tmp/urbackup-client-2.4.11.0
|
cd /tmp/urbackup-client-2.5.25.0
|
||||||
./configure --enable-headless
|
./configure --enable-headless
|
||||||
make -j4
|
make -j4
|
||||||
make install
|
make install
|
||||||
@ -70,7 +72,8 @@ internet_mode_enabled=true
|
|||||||
internet_image_backups_def=false
|
internet_image_backups_def=false
|
||||||
default_dirs_def=/etc;var/www;/var/backups/mysql
|
default_dirs_def=/etc;var/www;/var/backups/mysql
|
||||||
startup_backup_delay_def=3
|
startup_backup_delay_def=3
|
||||||
computername=$_computername" > /usr/local/var/urbackup/data/settings.cfg
|
computername=$_computername" > /etc/default/urbackupclient
|
||||||
|
# /usr/local/var/urbackup/data/settings.cfg
|
||||||
|
|
||||||
# firewall
|
# firewall
|
||||||
ufw allow from "$_ip" to any port 35621
|
ufw allow from "$_ip" to any port 35621
|
||||||
@ -78,7 +81,8 @@ ufw allow from "$_ip" to any port 35622
|
|||||||
ufw allow from "$_ip" to any port 35623
|
ufw allow from "$_ip" to any port 35623
|
||||||
|
|
||||||
# install and enable systemd service
|
# install and enable systemd service
|
||||||
cp "$_assets"/urbackup.service /etc/systemd/system/
|
# cp "$_assets"/urbackup.service /etc/systemd/system/
|
||||||
|
cp urbackupclientbackend-debian.service /etc/systemd/system/urbackup.service
|
||||||
chmod a+x /etc/systemd/system/urbackup.service
|
chmod a+x /etc/systemd/system/urbackup.service
|
||||||
|
|
||||||
systemctl --system daemon-reload
|
systemctl --system daemon-reload
|
||||||
|
10
bin/vhost.sh
10
bin/vhost.sh
@ -106,6 +106,16 @@ if [ "$vh" = "y" ]; then
|
|||||||
chmod -R g+w /var/www/"$_domain"/
|
chmod -R g+w /var/www/"$_domain"/
|
||||||
chmod -R g+r /var/www/"$_domain"/
|
chmod -R g+r /var/www/"$_domain"/
|
||||||
|
|
||||||
|
#set fail2ban for vhost
|
||||||
|
# https://stackoverflow.com/a/65552146
|
||||||
|
cp "$_assets/fail2ban/jail.d/nginx-badbots.conf" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
||||||
|
sed -i -r "s/\[nginx-badbots\]/\[nginx-badbots-$_domain\]/g" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
||||||
|
sed -i -r "s/<FILTER>/\[nginx-badbots-$_domain\]/g" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
||||||
|
sed -i -r "s/<LOGPATH>/\/var\/www\/$_domain\/log\/error.log/g" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
||||||
|
|
||||||
|
cp "$_assets/fail2ban/filter.d/nginx-badbots.conf" "/etc/fail2ban/filter.d/nginx-badbots-$_domain.conf"
|
||||||
|
sed -i -r "s/<HOST>/$_domain/g" "/etc/fail2ban/filter.d/nginx-badbots-$_domain.conf"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# create a shortcut to the site
|
# create a shortcut to the site
|
||||||
|
@ -90,10 +90,11 @@ apt-get install webhook
|
|||||||
git --git-dir=/home/"$user"/git-repositories/"$_domain.git" remote add origin "$_remote"
|
git --git-dir=/home/"$user"/git-repositories/"$_domain.git" remote add origin "$_remote"
|
||||||
|
|
||||||
# hook deploy script
|
# hook deploy script
|
||||||
cp -f "$_assets"/webhook-deploy.sh /home/"$user"/webhook_deploy_"$_id".sh
|
cp -f "$_assets"/webhook-deploy.sh /home/"$user"/webhook-deploy-"$_id".sh
|
||||||
sed -i -r "s/DOMAIN/$_domain/g" /home/"$user"/webhook_deploy_"$_domain".sh
|
sed -i -r "s/DOMAIN/$_domain/g" /home/"$user"/webhook-deploy-"$_id".sh
|
||||||
chowm $user:$user /home/"$user"/webhook_deploy_"$_id".sh
|
sed -i -r "s/USER/$user/g" /home/"$user"/webhook-deploy-"$_id".sh
|
||||||
chmod +x /home/"$user"/webhook_deploy_"$_id".sh
|
chowm $user:$user /home/"$user"/webhook-deploy-"$_id".sh
|
||||||
|
chmod +x /home/"$user"/webhook-deploy-"$_id".sh
|
||||||
|
|
||||||
# remove git bare repos hook
|
# remove git bare repos hook
|
||||||
mv /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive.back
|
mv /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive.back
|
||||||
@ -116,4 +117,6 @@ systemctl restart webhook
|
|||||||
|
|
||||||
ufw allow 9000
|
ufw allow 9000
|
||||||
|
|
||||||
|
echo "webhook done"
|
||||||
|
echo "you can configure your webhook trigger with the following url :"
|
||||||
echo "http://$_domain:9000/hooks/deploy_app_$_id"
|
echo "http://$_domain:9000/hooks/deploy_app_$_id"
|
||||||
|
@ -26,12 +26,9 @@ if [ ! -d "$_assets" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# not necessary anymore zabbix-agent 4 is in apt
|
|
||||||
# https://packages.debian.org/fr/buster/zabbix-agent
|
|
||||||
# TODO downgrade zabbix-agent to 3.4
|
|
||||||
|
|
||||||
wget -P /tmp/ http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+stretch_all.deb
|
wget -P /tmp/ wget https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb
|
||||||
dpkg -i /tmp/zabbix-release_3.4-1+stretch_all.deb
|
dpkg -i /tmp/zabbix-release_6.4-1+debian12_all.deb
|
||||||
|
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
@ -44,8 +41,6 @@ echo -n "Please provide the zabbix-server's ip : "
|
|||||||
read _ip
|
read _ip
|
||||||
echo -n "Please provide the hostname of this agent : "
|
echo -n "Please provide the hostname of this agent : "
|
||||||
read _host_name
|
read _host_name
|
||||||
echo -n "Please provide the mysql root password : "
|
|
||||||
read _root_mysql_passwd
|
|
||||||
|
|
||||||
_agent_conf_d="/etc/zabbix/zabbix_agentd.d" # for debian 8
|
_agent_conf_d="/etc/zabbix/zabbix_agentd.d" # for debian 8
|
||||||
if [ ! -d "$_agent_conf_d" ]; then
|
if [ ! -d "$_agent_conf_d" ]; then
|
||||||
@ -57,6 +52,10 @@ sed -i "s#Server=127.0.0.1#Server=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
|||||||
sed -i "s#ServerActive=127.0.0.1#ServerActive=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
sed -i "s#ServerActive=127.0.0.1#ServerActive=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
||||||
sed -i "s#Hostname=Zabbix server#Hostname=$_host_name#g" /etc/zabbix/zabbix_agentd.conf
|
sed -i "s#Hostname=Zabbix server#Hostname=$_host_name#g" /etc/zabbix/zabbix_agentd.conf
|
||||||
|
|
||||||
|
|
||||||
|
# todo ask if LXC container, if yes install this script
|
||||||
|
# https://github.com/kvaps/zabbix-linux-container-template
|
||||||
|
|
||||||
# APT
|
# APT
|
||||||
# check for debian security updates
|
# check for debian security updates
|
||||||
# not working : https://www.osso.nl/blog/zabbix-counting-security-updates
|
# not working : https://www.osso.nl/blog/zabbix-counting-security-updates
|
||||||
@ -68,27 +67,44 @@ cp "$_assets"/zabbix/apt.conf "$_agent_conf_d"/
|
|||||||
# MYSQL
|
# MYSQL
|
||||||
# https://serverfault.com/questions/737018/zabbix-user-parameter-mysql-status-setting-home
|
# https://serverfault.com/questions/737018/zabbix-user-parameter-mysql-status-setting-home
|
||||||
# create zabbix user home
|
# create zabbix user home
|
||||||
mkdir /var/lib/zabbix
|
|
||||||
# generate random password for zabbix mysql user
|
echo -n "monitor mysql? [Y|n] "
|
||||||
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)"
|
read yn
|
||||||
# add mysql credentials to zabbix home
|
yn=${yn:-y}
|
||||||
printf "[client]\n
|
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
|
||||||
user=zabbix\n
|
echo -n "Please provide the mysql root password : "
|
||||||
password=$_passwd" > /var/lib/zabbix/.my.cnf
|
read _root_mysql_passwd
|
||||||
# create zabbix mysql user
|
|
||||||
mysql -uroot -p"$_root_mysql_passwd" -e "CREATE USER 'zabbix' IDENTIFIED BY '$_passwd';"
|
mkdir /var/lib/zabbix
|
||||||
mysql -uroot -p"$_root_mysql_passwd" -e "GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY '$_passwd';"
|
# generate random password for zabbix mysql user
|
||||||
# add zabbix-agent parameter
|
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)"
|
||||||
cp "$_assets"/zabbix/userparameter_mysql.conf "$_agent_conf_d"/
|
# add mysql credentials to zabbix home
|
||||||
|
printf "[client]\n
|
||||||
|
user=zabbix\n
|
||||||
|
password=$_passwd" > /var/lib/zabbix/.my.cnf
|
||||||
|
# create zabbix mysql user
|
||||||
|
mysql -uroot -p"$_root_mysql_passwd" -e "CREATE USER 'zabbix' IDENTIFIED BY '$_passwd';"
|
||||||
|
mysql -uroot -p"$_root_mysql_passwd" -e "GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY '$_passwd';"
|
||||||
|
# add zabbix-agent parameter
|
||||||
|
cp "$_assets"/zabbix/userparameter_mysql.conf "$_agent_conf_d"/
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# NGINX
|
# NGINX
|
||||||
# https://github.com/sfuerte/zbx-nginx
|
# https://github.com/sfuerte/zbx-nginx
|
||||||
# nginxconf already included in default.nginxconf asset
|
# nginxconf already included in default.nginxconf asset
|
||||||
sed -i "s/# allow CURRENT-SERVER-IP/allow $_cur_ip/g" /etc/nginx/sites-available/default
|
|
||||||
cp "$_assets"/zabbix/userparameter_nginx.conf "$_agent_conf_d"/
|
echo -n "Monitor nginx? [Y|n] "
|
||||||
mkdir /etc/zabbix/zabbix_agentd.scripts
|
read yn
|
||||||
cp "$_assets"/zabbix/scripts/nginx-stat.py /etc/zabbix/zabbix_agentd.scripts/
|
yn=${yn:-y}
|
||||||
chmod +x /etc/zabbix/zabbix_agentd.scripts/nginx-stat.py
|
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
|
||||||
|
sed -i "s/# allow CURRENT-SERVER-IP/allow $_cur_ip/g" /etc/nginx/sites-available/default
|
||||||
|
cp "$_assets"/zabbix/userparameter_nginx.conf "$_agent_conf_d"/
|
||||||
|
mkdir /etc/zabbix/zabbix_agentd.scripts
|
||||||
|
cp "$_assets"/zabbix/scripts/nginx-stat.py /etc/zabbix/zabbix_agentd.scripts/
|
||||||
|
chmod +x /etc/zabbix/zabbix_agentd.scripts/nginx-stat.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo -n "This is box is a proxmox CT? [Y|n] "
|
echo -n "This is box is a proxmox CT? [Y|n] "
|
||||||
read yn
|
read yn
|
||||||
@ -100,6 +116,8 @@ fi
|
|||||||
# SYSTEMD
|
# SYSTEMD
|
||||||
# https://github.com/MogiePete/zabbix-systemd-service-monitoring
|
# https://github.com/MogiePete/zabbix-systemd-service-monitoring
|
||||||
cp "$_assets"/zabbix/userparameter_systemd_services.conf "$_agent_conf_d"/
|
cp "$_assets"/zabbix/userparameter_systemd_services.conf "$_agent_conf_d"/
|
||||||
|
# https://www.zabbix.com/forum/zabbix-cookbook/23024-monitor-the-version-of-centos-debian-ubuntu?p=386466#post386466
|
||||||
|
cp "$_assets"/zabbix/userparameter_linux_name_version.conf "$_agent_conf_d"/
|
||||||
|
|
||||||
# disble unused system units
|
# disble unused system units
|
||||||
systemctl disable rsync
|
systemctl disable rsync
|
||||||
|
@ -78,6 +78,7 @@ do
|
|||||||
read _install_vhost
|
read _install_vhost
|
||||||
done
|
done
|
||||||
if [ "$_install_vhost" = "yes" ]; then
|
if [ "$_install_vhost" = "yes" ]; then
|
||||||
|
# TODO bug vhost.sh file does not exists ...
|
||||||
. bin/vhost.sh
|
. bin/vhost.sh
|
||||||
else
|
else
|
||||||
echo 'no vhost installed'
|
echo 'no vhost installed'
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
UserParameter=ct.memory.size[*],free -b | awk 'NR==2 {total=$ 2; used=($ 3+$ 5); pused=(($ 3+$ 5)*100/$ 2); free=$ 4; pfree=($ 4*100/$ 2); shared=$ 5; buffers=$ 6; cached=$ 6; available=$ 7; pavailable=($ 7*100/$ 2); if("$1" == "") {printf("%.0f", total )} else {printf("%.0f", $1 "" )} }'
|
||||||
|
UserParameter=ct.swap.size[*],free -b | awk 'NR==3 {total=$ 2; used=$ 3; free=$ 4; pfree=($ 4*100/$ 2); pused=($ 3*100/$ 2); if("$1" == "") {printf("%.0f", free )} else {printf("%.0f", $1 "" )} }'
|
||||||
|
UserParameter=ct.cpu.load[*],cut -d" " -f1-3 /proc/loadavg | awk -F'[, ]+' '{avg1=$(NF-2); avg5=$(NF-1); avg15=$(NF)}{print $2/'$(nproc)'}'
|
||||||
|
UserParameter=ct.uptime,cut -d"." -f1 /proc/uptime
|
19
readme.md
19
readme.md
@ -1,4 +1,4 @@
|
|||||||
# Install LEMP web server and secure it on debian 10
|
# Install LEMP web server and secure it on debian 12
|
||||||
|
|
||||||
Fail2ban, Ufw, Proftpd, Knockd, Nginx, Mariadb, php7.0-fpm, redis, vhosts, git barre repos, zabbix-agent, dotfiles and more
|
Fail2ban, Ufw, Proftpd, Knockd, Nginx, Mariadb, php7.0-fpm, redis, vhosts, git barre repos, zabbix-agent, dotfiles and more
|
||||||
|
|
||||||
@ -32,6 +32,23 @@ chmod a+x install.sh
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
5 steps
|
||||||
|
|
||||||
|
* misc.sh
|
||||||
|
* dotfliles.sh
|
||||||
|
* user.sh
|
||||||
|
* ssh.sh
|
||||||
|
* firewall.sh
|
||||||
|
* fail2ban.sh
|
||||||
|
* email.sh
|
||||||
|
* lemp.sh
|
||||||
|
* mysqlbackup.sh
|
||||||
|
* vhost.sh
|
||||||
|
* gitbarrerepos.sh
|
||||||
|
* webhook.sh
|
||||||
|
* urbackup.sh
|
||||||
|
* zabbix.sh
|
||||||
|
*
|
||||||
|
|
||||||
## ref
|
## ref
|
||||||
http://www.debian.org/doc/manuals/securing-debian-howto/
|
http://www.debian.org/doc/manuals/securing-debian-howto/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user