48 Commits
Author SHA1 Message Date
bachir f7870be56d lemp improve 2019-07-03 16:21:43 +02:00
bachir c892d4561a changed nginx X-Frame-Option to SAMEORIGIN 2019-04-29 13:09:22 +02:00
bachir edc901da54 gitdeploy improved 2019-04-20 18:11:50 +02:00
bachir 9d91b2538e fix gitdeploy perms 2019-04-20 18:02:19 +02:00
bachir a7f2ad538c added git deployement 2019-04-20 18:01:14 +02:00
bachir 12bb6e7fa7 improved readme about running bin/scripts standalone 2019-04-20 17:33:13 +02:00
bachir dac5ea6435 added admin group and limited su to it 2019-04-20 17:32:34 +02:00
bachir 239cba9820 fix vhost: user perms, ssl cache param 2019-04-20 17:12:19 +02:00
bachir d9a2023b2b fix vhost perms 2019-04-20 16:42:28 +02:00
bachir fa8d9507c6 added vhost install 2019-04-20 16:41:09 +02:00
bachir 223a6c5f97 secured phpmyadmin with basic_auth 2019-04-20 15:47:38 +02:00
bachir 81a0dff38c phpmyadmin is working 2019-04-20 11:16:27 +02:00
bachir 0518a69864 added coreutils to misc 2019-04-20 11:16:08 +02:00
bachir d96cc9869c skip asking for computername and authkey in urbackup 2019-04-19 18:28:16 +02:00
bachir 98da3c0e4e skip asking for current ip and hostname in zabbix 2019-04-19 18:27:43 +02:00
bachir 4df00cb536 mysqlbackup rm -f /tmp/mycron 2019-04-19 18:26:40 +02:00
bachir 9175e7a230 ativated email in install.sh 2019-04-19 18:25:45 +02:00
bachir f6fb1ac6ec fix added postfix to opendkim group 2019-04-19 18:25:05 +02:00
bachir 9d7d78ba1c email cleaning 2019-04-19 15:37:51 +02:00
bachir afe55b0d1f postfix email working with dkim 2019-04-19 15:32:49 +02:00
bachir a8bc55e175 added shadow to misc 2019-04-19 15:32:12 +02:00
bachir 6639e8e34e fix forgot mysqlbackup assset script 2019-04-19 10:32:46 +02:00
bachir 5ddce52124 fix checkroot 2019-04-19 10:30:55 +02:00
bachir f3a316c2d2 fix perms 2019-04-19 10:28:47 +02:00
bachir a791eb949f added mysqlbackup script 2019-04-19 10:26:43 +02:00
bachir f0fb42a280 better zabbix-agent pinning and activated mysql monitoring 2019-04-19 09:55:34 +02:00
bachir c671c5e914 fixed zabbix-agent 3.4.15 2019-04-19 00:51:26 +02:00
bachir 653dfc2c6e fix bug in mariadb 2019-04-19 00:28:47 +02:00
bachir c01ae143f1 fix bug in mariadb 2019-04-19 00:17:46 +02:00
bachir e9ba33eec1 fix apk pinning 2019-04-19 00:08:12 +02:00
bachir b56cf03041 fixed repository url 2019-04-18 23:44:33 +02:00
bachir eef95b7902 added zabbix-agent limitation to 3.4 2019-04-18 23:44:07 +02:00
bachir be5d3229a3 genpasswd 2019-04-18 23:30:41 +02:00
bachir e3ff4cf78a mariad ok in readme 2019-04-18 23:27:26 +02:00
bachir 9640522a77 fix git clone command in readme 2019-04-18 23:26:11 +02:00
bachir 2a13fafce8 add alpine wiki link to readme 2019-04-18 23:23:42 +02:00
bachir 3f5075235d fixed mariadb bug 2019-04-18 23:23:29 +02:00
bachir 64cafc4622 git config --global core.safecrlf false 2019-04-18 23:22:38 +02:00
bachir c0e3cf3d81 activated cron 2019-04-18 23:22:23 +02:00
bachir 609d5e9c8e fix install.sh first read 2019-04-18 23:21:20 +02:00
bachir 8f5eac44bb 3.9 readme 2019-04-18 20:52:26 +02:00
bachir 29c457d46a 3.9 readme 2019-04-18 20:49:58 +02:00
bachir 27a28cfabf 3.9 readme 2019-04-18 20:49:05 +02:00
bachir b36170d647 3.9 readme 2019-04-18 20:47:53 +02:00
bachir 13cd3862fc 3.9 readme 2019-04-18 20:41:54 +02:00
bachir c70bd96979 3.9 readme 2019-04-18 20:40:59 +02:00
bachir 622cd33394 3.9 readme 2019-04-18 20:40:01 +02:00
bachir 3ba55c992f 3.9 readme 2019-04-18 20:37:14 +02:00
24 changed files with 1086 additions and 159 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
echo "updating drupal 8"
echo "Switching to project docroot."
cd ./app
echo ""
echo "Pulling down latest code."
git pull --ff-only origin prod
echo ""
echo "Clearing drush caches."
drush cache-clear drush
echo ""
echo "Composer install."
composer install --no-dev
echo ""
echo "Running database updates."
drush updb -y
echo ""
echo "Importing configuration."
drush config-import -y
echo ""
echo "Clearing caches."
drush cr
echo ""
echo "Deployment complete."
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
echo "updating"
echo "Switching to project docroot."
cd ./app
echo ""
echo "Pulling down latest code."
git pull --ff-only origin prod
echo ""
echo "Deployment complete."
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
#hook/post-receive
#CONFIG
PRODDIR="www"
read oldrev newrev refname
if [ $refname = "refs/heads/prod" ]; then
echo "===== DEPLOYING APP ====="
unset GIT_DIR
cd ~
cd $PRODDIR
# git pull --ff-only origin prod
# run deploy script instead
. deploy.sh
echo $?
echo "====== OK ====="
else
echo "Warning Commit not deployed, please use prod branch"
fi
+47 -1
View File
@@ -21,7 +21,7 @@ server {
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
index index.html index.htm index.php;
server_name _;
@@ -31,6 +31,49 @@ server {
try_files $uri $uri/ =404;
}
location /phpmyadmin {
root /usr/share/webapps/;
auth_basic "Admin Login";
auth_basic_user_file passwds;
# Deny static files
location ~ ^/phpMyAdmin/(README|LICENSE|ChangeLog|DCO)$ {
deny all;
}
# Deny .md files
location ~ ^/phpMyAdmin/(.+\.md)$ {
deny all;
}
# Deny setup directories
location ~ ^/phpMyAdmin/(doc|sql|setup)/ {
deny all;
}
location ~ ^/phpmyadmin/(.+\.php)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri $document_root$fastcgi_script_name =404;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTP_PROXY "";
fastcgi_param HTTPS on;
fastcgi_request_buffering off;
}
location ~ ^/phpmyadmin/(.*\.(eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|xls|tar|bmp))$ {
root /usr/share/webapps/;
expires 30d;
log_not_found off;
access_log off;
}
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
@@ -63,4 +106,7 @@ server {
# allow CURRENT-SERVER-IP;
deny all;
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options DENY;
}
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash
# Simple script to backup MySQL databases
# Parent backup directory
backup_parent_dir="/var/backups/mysql"
# MySQL settings
mysql_user="root"
mysql_password="ROOTPASSWD"
# Read MySQL password from stdin if empty
# if [ -z "${mysql_password}" ]; then
# echo -n "Enter MySQL ${mysql_user} password: "
# read -s mysql_password
# echo
# fi
# Check MySQL password
echo exit | mysql --user=${mysql_user} --password=${mysql_password} -B 2>/dev/null
if [ "$?" -gt 0 ]; then
echo "MySQL ${mysql_user} password incorrect"
exit 1
else
echo "MySQL ${mysql_user} password correct."
fi
# Create backup directory and set permissions
backup_date=`date +%Y_%m_%d_%H_%M`
backup_dir="${backup_parent_dir}/${backup_date}"
echo "Backup directory: ${backup_dir}"
mkdir -p "${backup_dir}"
chmod 644 "${backup_dir}"
# Get MySQL databases
mysql_databases=`echo 'show databases' | mysql --user=${mysql_user} --password=${mysql_password} -B | sed /^Database$/d`
# Backup and compress each database
for database in $mysql_databases
do
if [ "${database}" == "information_schema" ] || [ "${database}" == "performance_schema" ]; then
additional_mysqldump_params="--skip-lock-tables --compact --no-autocommit "
else
additional_mysqldump_params=""
fi
echo "Creating backup of \"${database}\" database"
mysqldump ${additional_mysqldump_params} --user=${mysql_user} --password=${mysql_password} ${database} | gzip > "${backup_dir}/${database}.sql.gz"
chmod 644 "${backup_dir}/${database}.sql.gz"
done
# compress the folder
# tar -zcvf "${backup_dir}.tar.gz" "${backup_dir}"
# rm -rf "${backup_dir}"
# Rotate backups
# Delete files older than 30 days
find $backup_parent_dir/ -type f -mtime +60 -delete;
# Delete empty directories
find $backup_parent_dir/ -type d -empty -delete;
+21
View File
@@ -0,0 +1,21 @@
Socket local:/run/opendkim/opendkim.sock
Syslog yes
UMask 002
UserID postfix:postfix
Selector mail
Mode sv
SubDomains yes
AutoRestart yes
Background yes
Canonicalization relaxed/relaxed
DNSTimeout 5
SignatureAlgorithm rsa-sha256
X-Header yes
Logwhy yes
InternalHosts /etc/internalhosts
KeyTable /etc/opendkim/keytable
SigningTable refile:/etc/opendkim/signtable
OversignHeaders From
+140
View File
@@ -0,0 +1,140 @@
# https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
# https://www.howtoforge.com/tutorial/install-letsencrypt-and-secure-nginx-in-debian-9/
server {
listen 80;
server_name DOMAIN.LTD;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
#SSL Certificates
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate "/etc/letsencrypt/live/DOMAIN.LTD/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/DOMAIN.LTD/privkey.pem";
ssl_dhparam /etc/nginx/ssl/certs/DOMAIN.LTD/dhparam.pem;
# ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000;
#includeSubDomains" always;
charset utf-8;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
allow all;
access_log off;
log_not_found off;
}
location ~ \..*/.*\.php$ {
return 403;
}
location ~ ^/sites/.*/private/ {
return 403;
}
# Block access to scripts in site files directory
location ~ ^/sites/[^/]+/files/.*\.php$ {
deny all;
}
# Allow "Well-Known URIs" as per RFC 5785
location ~* ^/.well-known/ {
allow all;
}
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
# try_files $uri @rewrite; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
# Don't allow direct access to PHP files in the vendor directory.
location ~ /vendor/.*\.php$ {
deny all;
return 404;
}
location ~ /\.ht {
deny all;
}
access_log on;
error_log /var/www/DOMAIN.LTD/log/error.log;
sendfile off;
client_max_body_size 100m;
# In Drupal 8, we must also match new paths where the '.php' appears in
# the middle, such as update.php/selection. The rule we use is strict,
# and only allows this pattern with the update.php front controller.
# This allows legacy path aliases in the form of
# blog/index.php/legacy-path to continue to route to Drupal nodes. If
# you do not have any paths like that, then you might prefer to use a
# laxer rule, such as:
# location ~ \.php(/|$) {
# The laxer rule will continue to work if Drupal uses this new URL
# pattern with front controllers other than update.php in a future
# release.
location ~ '\.php$|^/update.php' {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
include fastcgi.conf;
# Block httpoxy attacks. See https://httpoxy.org/.
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
# fastcgi_buffer_size 16k;
# fastcgi_buffers 4 16k;
fastcgi_pass 127.0.0.1:9000;
}
# Fighting with Styles? This little gem is amazing.
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7
try_files $uri @rewrite;
}
# Handle private files through Drupal. Private file's path can come
# with a language prefix.
location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7
try_files $uri /index.php?$query_string;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
}
+117
View File
@@ -0,0 +1,117 @@
# https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
server {
listen 80;
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
charset utf-8;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
allow all;
access_log off;
log_not_found off;
}
location ~ \..*/.*\.php$ {
return 403;
}
location ~ ^/sites/.*/private/ {
return 403;
}
# Block access to scripts in site files directory
location ~ ^/sites/[^/]+/files/.*\.php$ {
deny all;
}
# Allow "Well-Known URIs" as per RFC 5785
location ~* ^/.well-known/ {
allow all;
}
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
# try_files $uri @rewrite; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
# Don't allow direct access to PHP files in the vendor directory.
location ~ /vendor/.*\.php$ {
deny all;
return 404;
}
location ~ /\.ht {
deny all;
}
access_log on;
error_log /var/www/DOMAIN.LTD/log/error.log;
sendfile off;
client_max_body_size 100m;
# In Drupal 8, we must also match new paths where the '.php' appears in
# the middle, such as update.php/selection. The rule we use is strict,
# and only allows this pattern with the update.php front controller.
# This allows legacy path aliases in the form of
# blog/index.php/legacy-path to continue to route to Drupal nodes. If
# you do not have any paths like that, then you might prefer to use a
# laxer rule, such as:
# location ~ \.php(/|$) {
# The laxer rule will continue to work if Drupal uses this new URL
# pattern with front controllers other than update.php in a future
# release.
location ~ '\.php$|^/update.php' {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
include fastcgi.conf;
# Block httpoxy attacks. See https://httpoxy.org/.
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
# fastcgi_buffer_size 16k;
# fastcgi_buffers 4 16k;
fastcgi_pass 127.0.0.1:9000;
}
# Fighting with Styles? This little gem is amazing.
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7
try_files $uri @rewrite;
}
# Handle private files through Drupal. Private file's path can come
# with a language prefix.
location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7
try_files $uri /index.php?$query_string;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
}
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>DOMAIN.LTD</title>
</head>
<body>
<h1>DOMAIN.LTD</h1>
<?php phpinfo(); ?>
</body>
</html>
+66
View File
@@ -0,0 +1,66 @@
# https://www.howtoforge.com/tutorial/install-letsencrypt-and-secure-nginx-in-debian-9/
server {
listen 80;
server_name DOMAIN.LTD;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
index index.html index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log on;
error_log /var/www/DOMAIN.LTD/log/error.log;
sendfile off;
client_max_body_size 100m;
#SSL Certificates
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate "/etc/letsencrypt/live/DOMAIN.LTD/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/DOMAIN.LTD/privkey.pem";
ssl_dhparam /etc/nginx/ssl/certs/DOMAIN.LTD/dhparam.pem;
# ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000;
#includeSubDomains" always;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
}
+42
View File
@@ -0,0 +1,42 @@
server {
listen 80;
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
index index.html index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log on;
error_log /var/www/DOMAIN.LTD/log/error.log;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
}
+2 -2
View File
@@ -3,8 +3,8 @@
echo -e "checking root"
if [ "$EUID" = 0 ]; then
echo -e "root ok"
else
echo -e "Please run as root"
exit
else
echo -e "root ok"
fi
+49 -34
View File
@@ -22,10 +22,9 @@ if [ ! -d "$_assets" ]; then
fi
fi
# http://www.sycha.com/lamp-setup-debian-linux-apache-mysql-php#anchor13
sleep 2
apk add mailx postfix
apk add postfix mailx
mkdir /var/mail
postmap /etc/postfix/aliases
@@ -33,38 +32,54 @@ postmap /etc/postfix/aliases
rc-update add postfix
/etc/init.d/postfix start
# https://www.cyberciti.biz/faq/how-to-find-out-the-ip-address-assigned-to-eth0-and-display-ip-only/
_IP=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
_MASK=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f4)
# TODO: change bounce email
# echo -n "Please provide a bounce email address: "
# read _bounce_email
# TODO: DMARC
# dkim spf
# echo "\033[35;1mConfiguring DKIM \033[0m"
# while [ "$installdkim" != "y" ] && [ "$installdkim" != "n" ]
# do
# echo -n "Should we install dkim for exim4 ? [y|n] "
# read installdkim
# done
# if [ "$installdkim" = "y" ]; then
# echo -n "Choose a domain for dkim (same domain as you chose before for exim4): "
# read domain
# selector=$(date +%Y%m%d)
#
# mkdir /etc/exim4/dkim
# openssl genrsa -out /etc/exim4/dkim/"$domain"-private.pem 1024 -outform PEM
# openssl rsa -in /etc/exim4/dkim/"$domain"-private.pem -out /etc/exim4/dkim/"$domain".pem -pubout -outform PEM
# chown root:Debian-exim /etc/exim4/dkim/"$domain"-private.pem
# chmod 440 /etc/exim4/dkim/"$domain"-private.pem
#
# cp "$_assets"/exim4_dkim.conf /etc/exim4/conf.d/main/00_local_macros
# sed -i -r "s/DOMAIN_TO_CHANGE/$domain/g" /etc/exim4/conf.d/main/00_local_macros
# sed -i -r "s/DATE_TO_CHANGE/$selector/g" /etc/exim4/conf.d/main/00_local_macros
#
# update-exim4.conf
# systemctl restart exim4
# echo "please create a TXT entry in your dns zone : $selector._domainkey.$domain \n"
# echo "your public key is : \n"
# cat /etc/exim4/dkim/"$domain".pem
# echo "press any key to continue."
# read continu
# else
# echo 'dkim not installed'
# fi
# reverse dns
# dkim
echo "Configuring DKIM"
apk add opendkim opendkim-utils
mkdir /etc/opendkim/keys
opendkim-genkey -b 2048 -d "$HOSTNAME" -s "$HOSTNAME".dkim --directory=/etc/opendkim/keys/
chown opendkim:opendkim /etc/opendkim/keys/*
mv /etc/opendkim/opendkim.conf /etc/opendkim/opendkim.conf.back
cp "$_assets"/opendkim/opendkim.conf /etc/opendkim/opendkim.conf
echo "*@$HOSTNAME $HOSTNAME" > /etc/opendkim/signtable
echo "$HOSTNAME $HOSTNAME:mail:/etc/opendkim/keys/$HOSTNAME.dkim.private" > /etc/opendkim/keytable
echo -e "localhost\n127.0.0.1\n$HOSTNAME\n$_IP/$_MASK" > /etc/internalhosts
echo -e "smtpd_milters = unix:/run/opendkim/opendkim.sock\nnon_smtpd_milters = unix:/run/opendkim/opendkim.sock" >> /etc/postfix/main.cf
rc-update add opendkim
service opendkim start
usermod -a -G opendkim postfix
service postfix restart
echo -e "DKIM"
echo -e "please create a DKIM entry in your dns zone : mail._domainkey.$HOSTNAME \n"
echo -e "your public key is : \n"
cat /etc/opendkim/keys/"$HOSTNAME".dkim.txt
echo -e "SPF"
echo -e "you should edit an spf entry for $HOSTNAME in your dns zone :"
echo -e "v=spf1 a mx ip4:$_IP"
echo -e "MX"
echo -e "If it does not exists, you should create an mx zone record for $HOSTNAME"
echo "press any key to continue."
read continu
Regular → Executable
View File
+132
View File
@@ -0,0 +1,132 @@
#!/bin/sh
# bachir soussi chiadmi
# get the current position
_cwd="$(pwd)"
echo -e '
_ _
__ _(_) |_
/ _` | | _|
\__, |_|\__|
|___/
'
echo -e "Create new git barre repos and deploy script"
echo "Git barre repo will be installed in chosen user home directory"
echo "git prod repos will be installed in app directory of provided domain, the domain have to exists as shortcut in chosen /home/user/www before running this script. Please run first bin/vhost.sh script and say yes to the question create a shortcut !"
. bin/checkroot.sh
while [ "$yn" != "yes" ] && [ "$yn" != "no" ]
do
echo -n "Should we installl git deployement? [yes|no] "
read yn
# yn=${yn:-y}
done
if [ "$yn" = "yes" ]; then
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
# if $user var does not exists (gitdeploy.sh ran directly) ask for it
if [ -z ${user+x} ]; then
while [ "$user" = "" ]
do
read -p "enter an existing user name ? " user
if [ "$user" != "" ]; then
# check if user already exists
if id "$user" >/dev/null 2>&1; then
read -p "is user name $user correcte [y|n] " validated
if [ "$validated" = "y" ]; then
break
else
user=""
fi
else
echo -e "user $user doesn't exists, you must provide an existing user"
user=""
fi
fi
done
fi
# if $_domain var does not exists (gitdeploy.sh ran directly) ask for it
if [ -z ${_domain+x} ]; then
while [ "$_domain" = "" ]
do
read -p "enter a domain name ? " _domain
if [ "$_domain" != "" ]; then
if [ ! -d /home/"$user"/www/"$_domain" ]; then
echo "/home/$user/www/$_domain does not exists !"
# exit
_domain=""
else
read -p "is domain $_domain correcte [y|n] " validated
if [ "$validated" = "y" ]; then
break
else
_domain=""
fi
fi
fi
done
fi
# ask for simple php conf or drupal conf
while [ "$_drupal" != "yes" ] && [ "$_drupal" != "no" ]
do
echo -n "Is your site is a drupal 8 instance? [yes|no] "
read _drupal
done
echo "seting up bare repositorie to push to"
mkdir /home/"$user"/git-repos
mkdir /home/"$user"/git-repos/"$_domain".git
cd /home/"$user"/git-repos/"$_domain".git
git init --bare
echo "creating hooks that will update the site repo"
cp "$_assets"/gitdeploy/git-post-receive /home/"$user"/git-repos/"$_domain".git/hooks/post-receive
sed -i -r "s#PRODDIR=\"www\"#PRODDIR=\"/home/$user/www/$_domain\"#g" /home/"$user"/git-repos/"$_domain".git/hooks/post-receive
chown -R "$user":"$user" /home/"$user"/git-repos
chmod +x /home/"$user"/git-repos/"$_domain".git/hooks/post-receive
echo "seting up git repo on site folder"
rm -rf /home/"$user"/www/"$_domain"/app/*
cd /home/"$user"/www/"$_domain"/app
git init
# link to the bare repo
git remote add origin /home/"$user"/git-repos/"$_domain".git
chown -R www:"$user" /home/"$user"/www/"$_domain"/app
chmod -R g+rw /home/"$user"/www/"$_domain"/app
git remote -v
git status
echo "adding deploy script"
if [ "$_drupal" = "yes" ]; then
cp "$_assets"/gitdeploy/deploy-drupal.sh /home/"$user"/www/"$_domain"/deploy.sh
else
cp "$_assets"/gitdeploy/deploy-simple.sh /home/"$user"/www/"$_domain"/deploy.sh
fi
chown "$user":"$user" /home/"$user"/www/"$_domain"/deploy.sh
chmod +x /home/"$user"/www/"$_domain"/deploy.sh
# done
_cur_ip=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
echo "git repos for $_domain install succeed"
echo "your site stay now to /home/$user/www/$_domain/app"
echo "you can push updates on prod branch through $user@$_cur_ip:git-repositories/$_domain.git"
cd "$_cwd"
else
echo "Git barre repo creation aborted"
fi
+82 -77
View File
@@ -35,20 +35,23 @@ echo -e '
echo -e "installing Mysql"
sleep 3
apk add mariadb mariadb-client mariadb-common
# https://bugs.alpinelinux.org/issues/9046
echo -n "are Maridb databases strored in a zfs file system? [y|n] "
read yn
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
echo -e "Stick with mariadb 10.1.x due to incompatibility of newer version with zfs"
echo -e "Please see this bug https://bugs.alpinelinux.org/issues/9046"
echo "http://dl-5.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories
echo -e "mariadb<10.1.99\nmariadb-client<10.1.99\nmariadb-common<10.1.99" >> /etc/apk/world
apk update
echo "http://dl-cdn.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories
# echo -e "mariadb<10.1.99\nmariadb-client<10.1.99\nmariadb-common<10.1.99" >> /etc/apk/world
sed -i "s|^mariadb$|mariadb<10.1.99|g" /etc/apk/world
sed -i "s|^mariadb-client$|mariadb-client<10.1.99|g" /etc/apk/world
sed -i "s|^mariadb-common$|mariadb-common<10.1.99|g" /etc/apk/world
apk update && apk upgrade
fi
apk add mariadb mariadb-client
mysql_install_db --user=mysql --datadir=/var/lib/mysql
mysql_install_db --user=mysql --datadir="/var/lib/mysql"
rc-update add mariadb
service mariadb start
@@ -87,6 +90,79 @@ service php-fpm7 start
echo -e "php installed"
echo -e '
_ __ __ _ _ _
_ __| |_ _ __| \/ |_ _ /_\ __| |_ __ (_)_ _
| `_ \ ` \| `_ \ |\/| | || |/ _ \/ _` | ` \| | ` \
| .__/_||_| .__/_| |_|\_, /_/ \_\__,_|_|_|_|_|_||_|
|_| |_| |__/
'
echo -e "Installing phpMyAdmin"
apk add phpmyadmin php7-mysqli
service php-fpm7 restart
chmod +r /etc/phpmyadmin/config.inc.php
echo -e "securing phpMyAdmin"
_pass="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8)"
_encrypted=$(openssl passwd -apr1 $_pass)
echo -e "pma:$_encrypted" > /etc/nginx/passwds
# service apache2 restart
echo -e "phpMyAdmin installed"
echo -e "You can access it at yourip/phpmyadmin"
echo -e "please note the credentials user: pma passwd:$_pass"
echo -e '
_ _
_ _ ___ __| (_)___
| `_/ -_) _` | (_-<
|_| \___\__,_|_/__/
'
echo -e "Installing Redis"
sleep 3
apk add redis php7-pecl-redis
# TODO set maxmemory=2gb
# TODO set maxmemory-policy=volatile-lru
# TODO comment all save line
rc-update add redis
service redis start
service php-fpm7 restart
echo -e "Redis installed"
echo -e '
__ ___ _ __ _ __ ___ ___ ___ _ _
/ _/ _ \ ` \| `_ \/ _ (_-</ -_) `_|
\__\___/_|_|_| .__/\___/__/\___|_|
|_|
'
echo -e "Installing Composer"
sleep 3
export COMPOSER_HOME=/usr/local/composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
composer about
echo -e "Composer installed"
echo -e '
_ _
__| |_ _ _ _ __| |_
/ _` | `_| || (_-< ` \
\__,_|_| \_,_/__/_||_|
'
echo -e "Installing Drush and DrupalConsole"
sleep 3
curl https://drupalconsole.com/installer -L -o /usr/local/bin/drupal
chmod +x /usr/local/bin/drupal
drupal about
curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar -L -o /usr/local/bin/drush
chmod +x /usr/local/bin/drush
echo -e "Drush and DrupalConsoleinstalled"
echo -e '
_
_ _ __ _(_)_ _ __ __
@@ -110,74 +186,3 @@ cp "$_assets"/lemp/index.php /var/www/html/
rc-update add nginx
service nginx start
echo -e "Nginx installed"
# echo -e '
# _ __ __ _ _ _
# _ __| |_ _ __| \/ |_ _ /_\ __| |_ __ (_)_ _
# | `_ \ ` \| `_ \ |\/| | || |/ _ \/ _` | ` \| | ` \
# | .__/_||_| .__/_| |_|\_, /_/ \_\__,_|_|_|_|_|_||_|
# |_| |_| |__/
# '
# echo -e "Installing phpMyAdmin"
# apk add phpmyadmin
# ln -s /usr/share/phpmyadmin /var/www/html/
# 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 "securing phpMyAdmin"
# # sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/"
# # cp "$_assets"/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess
# # echo -n "define a user name for phpmyadmin : "
# # read un
# # htpasswd -c /etc/phpmyadmin/.htpasswd $un
# # service apache2 restart
# echo -e "phpMyAdmin installed"
# echo -e "You can access it at yourip/phpmyadmin"
echo -e '
_ _
_ _ ___ __| (_)___
| `_/ -_) _` | (_-<
|_| \___\__,_|_/__/
'
echo -e "Installing Redis"
sleep 3
apk add redis php7-pecl-redis@edgecommunity
# TODO set maxmemory=2gb
# TODO set maxmemory-policy=volatile-lru
# TODO comment all save line
rc-update add redis
service redis start
service php-fpm7 restart
echo -e "Redis installed"
echo -e '
__ ___ _ __ _ __ ___ ___ ___ _ _
/ _/ _ \ ` \| `_ \/ _ (_-</ -_) `_|
\__\___/_|_|_| .__/\___/__/\___|_|
|_|
'
echo -e "Installing Composer"
sleep 3
export COMPOSER_HOME=/usr/local/composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
echo -e "Composer installed"
echo -e '
_ _
__| |_ _ _ _ __| |_
/ _` | `_| || (_-< ` \
\__,_|_| \_,_/__/_||_|
'
echo -e "Installing Drush and DrupalConsole"
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
chmod +x /usr/local/bin/drush
echo -e "Drush and DrupalConsoleinstalled"
+5 -1
View File
@@ -17,7 +17,7 @@ echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main
apk update
apk add procps vim curl tmux etckeeper htop lynx unzip # needrestart
apk add procps vim curl tmux etckeeper htop lynx unzip grep shadow coreutils certbot # needrestart
# sed -i "s/^# en_GB.UTF-8/en_GB.UTF-8/g" /etc/locale.gen
# locale-gen
@@ -31,4 +31,8 @@ rc-service crond start && rc-update add crond
git config --global core.safecrlf false
echo "limiting su to the admin group"
groupadd admin
echo -e "auth required pam_wheel.so group=admin" >> /etc/pam.d/su
echo -e "Misc done"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
echo -e '
__ __ _ ___ _
| \/ |_ _ ___ __ _| | | _ ) __ _ __| |___ _ _ __ ___
| |\/| | || (_-</ _ | | | _ \/ _ / _| / / || | _ (_-<
|_| |_|\_, /__/\__, |_| |___/\__,_\__|_\_\\_,_| .__/__/
|__/ |_| |_|
'
. bin/checkroot.sh
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
# adding the script
cp "$_assets"/mysqlbackup.sh /usr/local/bin/
chmod +x /usr/local/bin/mysqlbackup.sh
# configure
echo -n "Please provide the mysql root passwd : "
read _root_mysql_passwd
sed -i "s/ROOTPASSWD/$_root_mysql_passwd/g" /usr/local/bin/mysqlbackup.sh
# creating crontab
touch /var/spool/cron/crontabs/root
crontab -l > /tmp/mycron
echo "30 2 */2 * * /usr/local/bin/mysqlbackup.sh" >> /tmp/mycron
crontab /tmp/mycron
rm -f /tmp/mycron
echo -e "mysql backup script installed"
Regular → Executable
+6 -5
View File
@@ -54,14 +54,15 @@ make install
# configure
echo -n "Please provide the urbackup-server's ip : "
read _ip
echo -n "Please provide the internet_authkey of server : "
read _authkey
echo -n "Please provide the computer name of this client : "
read _computername
# echo -n "Please provide the internet_authkey of server : "
# read _authkey
# echo -n "Please provide the computer name of this client : "
# read _computername
_computername=$HOSTNAME
# internet_authkey=$_authkey
echo "internet_server=$_ip
internet_server_port=55415
internet_authkey=$_authkey
internet_mode_enabled=true
internet_image_backups_def=false
default_dirs_def=/etc;var/www;/var/backups/mysql
+10 -6
View File
@@ -40,10 +40,14 @@ adduser "$user"
sed -i "s/$user:\/bin\/ash/$user:\/bin\/bash/g" /etc/passwd
# TODO limiting su to the admin group
# echo "adding $user to admin group and limiting su to the admin group"
# groupadd admin
# usermod -a -G admin "$user"
# allow admin group to su
# dpkg-statoverride --update --add root admin 4750 /bin/su
whie [ "$vh" != "y" ] && [ "$vh" != "n" ]
do
echo -n "Should we allow $user to su? [y|n] "
read yn
done
if [ "$yn" = "y" ]; then
echo "adding $user to admin group"
# admin group is created by misc
usermod -a -G admin "$user"
fi
echo -e "user $user configured"
Executable
+148
View File
@@ -0,0 +1,148 @@
#!/bin/bash
echo -e '
_ _
__ _| |_ ___ __| |_
\ V / ` \/ _ (_-< _|
\_/|_||_\___/__/\__|
'
echo -e "Nginx VHOST install "
. bin/checkroot.sh
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
while [ "$_domain" = "" ]
do
read -p "enter a domain name ? " _domain
if [ "$_domain" != "" ]; then
read -p "is domain $_domain correcte [y|n] " validated
if [ "$validated" = "y" ]; then
break
else
_domain=""
fi
fi
done
# ask for simple php conf or drupal conf
while [ "$_drupal" != "yes" ] && [ "$_drupal" != "no" ]
do
echo -n "Is your site is a drupal one? [yes|no] "
read _drupal
done
# ask for let's encrypt
while [ "$_letsencrypt" != "yes" ] && [ "$_letsencrypt" != "no" ]
do
echo -e "Let's encrypt"
echo -e "Let's encrypt needs a public registered domain name with proper DNS records ( A records or CNAME records for subdomains pointing to your server)."
echo -n "Should we install let's encrypt certificate with $_domain? [yes|no] "
read _letsencrypt
done
service nginx stop
# lets'encrypt
# https://certbot.eff.org/lets-encrypt/debianstretch-nginx
if [ "$_letsencrypt" = "yes" ]; then
apk add certbot
certbot certonly --standalone -d "$_domain" --cert-name "$_domain"
# TODO stop the whole process if letsencrypt faile
mkdir -p /etc/nginx/ssl/certs/"$_domain"
openssl dhparam -out /etc/nginx/ssl/certs/"$_domain"/dhparam.pem 2048
# renewing
touch /var/spool/cron/crontabs/root
crontab -l > mycron
echo -e "0 3 * * * certbot renew --pre-hook 'service nginx stop' --post-hook 'service nginx start' --cert-name $_domain" >> mycron
crontab mycron
rm -f mycron
fi
if [ "$_drupal" = "yes" ]; then
if [ "$_letsencrypt" = "yes" ]; then
_conffile="drupal-ssl.nginxconf"
else
_conffile="drupal.nginxconf"
fi
else
if [ "$_letsencrypt" = "yes" ]; then
_conffile="simple-phpfpm-ssl.nginxconf"
else
_conffile="simple-phpfpm.nginxconf"
fi
fi
cp "$_assets/vhosts/$_conffile" /etc/nginx/conf.d/"$_domain".conf
sed -i -r "s/DOMAIN\.LTD/$_domain/g" /etc/nginx/conf.d/"$_domain".conf
mkdir -p /var/www/"$_domain"/app/public_html
mkdir /var/www/"$_domain"/log
cp "$_assets/vhosts/index.php" /var/www/"$_domain"/app/public_html/
sed -i -r "s/DOMAIN\.LTD/$_domain/g" /var/www/"$_domain"/app/public_html/index.php
#set proper right to user will handle the app
chown -R www:www /var/www/"$_domain"/
# chmod -R g+w /var/www/"$_domain"/
# chmod -R g+r /var/www/"$_domain"/
# create a shortcut to the site
echo -n "Should we install a shortcut for a user? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
# if $user var does not exists (vhost.sh ran directly) ask for it
if [ -z ${user+x} ]; then
while [ "$user" = "" ]
do
read -p "enter an existing user name ? " user
if [ "$user" != "" ]; then
# check if user already exists
if id "$user" >/dev/null 2>&1; then
read -p "is user name $user correcte [y|n] " validated
if [ "$validated" = "y" ]; then
break
else
user=""
fi
else
echo -e "user $user doesn't exists, you must provide an existing user"
user=""
fi
fi
done
fi
echo -e "installing shortcut for '$user'";
mkdir /home/"$user"/www/
chown "$user":"$user" /home/"$user"/www/
ln -s /var/www/"$_domain" /home/"$user"/www/"$_domain"
chown "$user":"$user" /home/"$user"/www/"$_domain"
chown -R www:"$user" /home/"$user"/www/"$_domain"/app
chmod -R g+rw /home/"$user"/www/"$_domain"/app
. bin/gitdeploy.sh
else
echo -e 'no shortcut installed'
fi
# activate the vhost
# ln -s /etc/nginx/sites-available/"$_domain".conf /etc/nginx/sites-enabled/"$_domain".conf
nginx -t
# restart nginx
service nginx start
echo -e "vhost $_domain configured"
+36 -22
View File
@@ -22,21 +22,35 @@ if [ ! -d "$_assets" ]; then
fi
fi
apk add zabbix-agent
echo -n "do you want to limit zabbix-agent to 3.4? [y|n] "
read yn
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
echo -e "Stick with zabbix-agent 3.4"
echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/community" >> /etc/apk/repositories
# echo -e "zabbix-agent<3.4.99" >> /etc/apk/world
apk update
# apk upgrade
apk add 'zabbix-agent=~3.4'
else
apk add zabbix-agent
fi
# configure
echo -n "Please provide the current server's public ip : "
read _cur_ip
# echo -n "Please provide the current server's public ip : "
# read _cur_ip
# https://www.cyberciti.biz/faq/how-to-find-out-the-ip-address-assigned-to-eth0-and-display-ip-only/
_cur_ip=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
# echo -n "Please provide the hostname of this agent : "
# read _host_name
_host_name=$HOSTNAME
echo -n "Please provide the zabbix-server's ip : "
read _ip
echo -n "Please provide the hostname of this agent : "
read _host_name
echo -n "Please provide the mysql root password : "
read _root_mysql_passwd
# configure zabbix agent
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
@@ -49,21 +63,21 @@ sed -i "s|#\ Include=$|Include= $_agent_conf_d|g" /etc/zabbix/zabbix_agentd.conf
# apk
# check for alpine security updates
# # MYSQL
# # https://serverfault.com/questions/737018/zabbix-user-parameter-mysql-status-setting-home
# # create zabbix user home
# mkdir /var/lib/zabbix
# # generate random password for zabbix mysql user
# _passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)"
# # 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"/
# MYSQL
# https://serverfault.com/questions/737018/zabbix-user-parameter-mysql-status-setting-home
# create zabbix user home
mkdir /var/lib/zabbix
# generate random password for zabbix mysql user
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c16)"
# 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"/
# NGINX
# https://github.com/sfuerte/zbx-nginx
+10 -2
View File
@@ -31,8 +31,16 @@ _cwd="$(pwd)"
. bin/ufw.sh
. bin/fail2ban.sh
. bin/knockd.sh
# . bin/email.sh
. bin/email.sh
. bin/lemp.sh
# . bin/vhost.sh
. bin/mysqlbackup.sh
whie [ "$vh" != "y" ] && [ "$vh" != "n" ]
do
echo -n "Should we install a vhost? [y|n] "
read vh
done
if [ "$vh" = "y" ]; then
. bin/vhost.sh
fi
. bin/zabbix.sh
. bin/urbackup.sh
+6 -9
View File
@@ -1,4 +1,4 @@
# Install web server and secure it on alpine linux 3.8
# Install web server and secure it on alpine linux 3.9
## Branches
each alpine linux stable release has it's branch (master is a clone of the last one)
@@ -18,14 +18,14 @@ each alpine linux stable release has it's branch (master is a clone of the last
- [x] Knockd
- [x] Mariadb (bug https://bugs.alpinelinux.org/issues/9046)
- [ ] mysql backups
- [x] php7-fpm (7.1)
- [x] php7-fpm (7.2)
- [x] Nginx
- [x] drush
- [x] composer
- [ ] letsencrypt
- [ ] vhosts
- [x] redis
- [x] zabbix-agent (3.4)
- [x] zabbix-agent (3.4 || 4)
- [x] urbackup-client
- [ ] solr
- [ ] git barre repos
@@ -43,8 +43,7 @@ apk add git
2 clone the repo
```
git clone -b 3.8 --single-branch https://figureslibres.io/gogs/bachir/al
pine-web-werver.git
git clone -b 3.9 --single-branch https://figureslibres.io/gogs/bachir/alpine-web-werver.git
```
3 you have to be root
@@ -63,10 +62,8 @@ cd alpine-web-server
. install.sh
```
all script in bin/ can be ran seperatly, but from the repos source exclusively
```
. bin/misc.sh
```
All script in bin/ can be ran seperatly, but from the repos source exclusively eg: ```. bin/vhost.sh```. Be aware that all scripts need bash and some depends on packages and config installed by bin/misc.sh, run it once right after bin/bash.sh if you wont use the full install.sh.
## ref
[Alpine Linux wiki](https://wiki.alpinelinux.org)