31 Commits
Author SHA1 Message Date
bachir 4b52235321 improved lemp and drush 2020-09-22 14:45:33 +02:00
bachir 6430cdfaad fix nginx conf typo 2020-06-23 10:40:34 +02:00
bachir 99c26878d8 readme fix 2020-06-15 16:04:21 +02:00
bachir cf31b6d591 readme fix 2020-06-15 16:01:46 +02:00
bachir 93d92ed8bd created 3.11 branch 2020-06-15 15:46:11 +02:00
bachir 107faedfe9 updated drush launcher 2020-05-01 12:47:45 +02:00
bachir 384eb7a315 improved phpmyadmin install 2020-05-01 12:10:27 +02:00
bachir afc177a506 updated urbackupclient 2020-04-21 12:41:03 +02:00
bachir 5808f1bfad reseting vhost script vars 2020-04-21 12:22:21 +02:00
bachir 6eaf5dbccd removed knockd ufw, added php modules 2020-04-21 11:49:28 +02:00
bachir 7cf2081065 chown wwww:wwww /var/tmp/nginx 2020-02-25 11:56:10 +01:00
bachir 14b67af00c added rsync to misc 2019-10-13 19:01:06 +02:00
bachir 7cfd8414e3 fixed php-fpm7 user:group to www instead of nobody 2019-10-13 17:40:43 +02:00
bachir 9e22af9da7 apk add php7-dom 2019-10-13 16:46:11 +02:00
bachir 591989992b fice mysql create db script 2019-10-13 14:38:46 +02:00
bachir 49d4bfe054 fice mysql create db script 2019-10-13 14:36:00 +02:00
bachir 3cf8ecd519 mysql create db script 2019-10-13 13:00:50 +02:00
bachir f02a7f26ab started mysql create db script 2019-10-13 12:48:37 +02:00
bachir 82ef2eb885 change default vhost folder to app/web 2019-10-13 12:47:45 +02:00
bachir 3f0d9fb4ac fixed update urbackup client to 2.4.8.0 2019-10-13 12:07:06 +02:00
bachir 4ffe7f4296 updated urbackup client to 2.4.8.0 2019-10-13 12:05:52 +02:00
bachir 7ea4eb4809 added pwgen 2019-10-13 11:59:01 +02:00
bachir b95a517cd9 readme: added misc details 2019-10-13 11:57:52 +02:00
bachir 29dcf0aef4 fixed typos 2019-10-13 11:50:15 +02:00
bachir f97feda0a5 fixed typos 2019-10-13 11:21:09 +02:00
bachir c10b3e83cd updated readme 2019-10-13 11:01:36 +02:00
bachir 75e34220c5 updated readme 2019-10-13 11:00:21 +02:00
bachir 1a6ca1a9c6 fixed typos 2019-10-13 10:56:33 +02:00
bachir 3df7a70498 fixed typo in user 2019-07-03 16:33:28 +02:00
bachir 152682a1ab updated readme 2019-07-03 16:31:08 +02:00
bachir 3f80d97e65 fixed typo in user 2019-07-03 16:26:33 +02:00
17 changed files with 171 additions and 51 deletions
+13
View File
@@ -0,0 +1,13 @@
{
"require": {
"drush/drush": "~8.0",
"webflo/drupal-finder": "^1.0.0"
},
"extra": {
"installer-paths": {
".": [
"type:drupal-core"
]
}
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ server {
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTP_PROXY "";
fastcgi_param HTTPS on;
fastcgi_param HTTPS off;
fastcgi_request_buffering off;
}
+2 -2
View File
@@ -12,7 +12,7 @@ server {
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
root /var/www/DOMAIN.LTD/app/web;
#SSL Certificates
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@@ -136,5 +136,5 @@ server {
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
add_header X-Frame-Options SAMEORIGIN;
}
+2 -2
View File
@@ -2,7 +2,7 @@
server {
listen 80;
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
root /var/www/DOMAIN.LTD/app/web;
charset utf-8;
@@ -112,6 +112,6 @@ server {
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
add_header X-Frame-Options SAMEORIGIN;
}
+2 -2
View File
@@ -12,7 +12,7 @@ server {
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
root /var/www/DOMAIN.LTD/app/web;
index index.html index.php;
charset utf-8;
@@ -61,6 +61,6 @@ server {
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
add_header X-Frame-Options SAMEORIGIN;
}
+2 -2
View File
@@ -2,7 +2,7 @@ server {
listen 80;
server_name DOMAIN.LTD;
root /var/www/DOMAIN.LTD/app/public_html;
root /var/www/DOMAIN.LTD/app/web;
index index.html index.php;
charset utf-8;
@@ -37,6 +37,6 @@ server {
}
# website should not be displayed inside a <frame>, an <iframe> or an <object>
add_header X-Frame-Options SAMEORIGIN;;
add_header X-Frame-Options SAMEORIGIN;
}
+17 -15
View File
@@ -33,22 +33,24 @@ echo -n "checking if ufw is installed"
ufw_installed=$(apk list -I | grep "ufw")
if ! $ufw_installed; then
echo -n "ufw installed"
mv /etc/knockd.conf /etc/knockd.conf.ori
cp "$_assets"/knockd.conf /etc/knockd.conf
echo -n "define a sequence number for opening ssh (as 7000,8000,9000) : "
read sq
sed -i "s/7000,8000,9000/$sq/g" /etc/knockd.conf
rc-update add knockd
/etc/init.d/knockd start
ufw delete allow ssh
echo -e "knockd installed and configured"
echo -e "please note this sequence for future ssh knocking"
echo "$sq"
else
. bin/ufw.sh
#. bin/ufw.sh
echo -n "ufw not installed, needed by knockd, configuration aborted"
fi
mv /etc/knockd.conf /etc/knockd.conf.ori
cp "$_assets"/knockd.conf /etc/knockd.conf
echo -n "define a sequence number for opening ssh (as 7000,8000,9000) : "
read sq
sed -i "s/7000,8000,9000/$sq/g" /etc/knockd.conf
rc-update add knockd
/etc/init.d/knockd start
ufw delete allow ssh
echo -e "knockd installed and configured"
echo -e "please note this sequence for future ssh knocking"
echo "$sq"
sleep 3
+24 -4
View File
@@ -38,7 +38,7 @@ 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] "
echo -n "are Maridb databases strored in a zfs file system (eg. through proxmox container)? [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"
@@ -74,15 +74,22 @@ echo -e '
'
echo -e "Installing PHP 7.0"
sleep 3
apk add php7 php7-fpm php7-pdo_mysql php7-opcache php7-curl php7-mbstring php7-zip php7-xml php7-gd php7-mcrypt php7-imagick php7-phar php7-json
apk add php7 php7-fpm php7-pdo_mysql php7-opcache php7-curl php7-mbstring php7-zip php7-xml php7-gd php7-mcrypt php7-imagick php7-phar php7-json php7-dom php7-tokenizer php7-iconv php7-xmlwriter php7-simplexml
# to make php5 availabe
# echo "http://dl-cdn.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories
# apk add php5-fpm php5-pdo_mysql php5-opcache php5-curl php5-zip php5-xml php5-gd php5-mcrypt php5-phar php5-json php5-dom php5-iconv
echo -e "Configuring PHP"
sed -i "s/memory_limit\ =\ 128M/memory_limit = 512M/g" /etc/php7/php.ini
TIMEZONE="Europe/Helsinki"
TIMEZONE="Europe/Paris"
sed -i "s|;*date.timezone =.*|date.timezone = ${TIMEZONE}|i" /etc/php7/php.ini
sed -i "s|user = nobody|user = www|i" /etc/php7/php-fpm.d/www.conf
sed -i "s|group = nobody|group = www|i" /etc/php7/php-fpm.d/www.conf
rc-update add php-fpm7
service php-fpm7 start
@@ -103,6 +110,16 @@ service php-fpm7 restart
chmod +r /etc/phpmyadmin/config.inc.php
# /**
# * This is needed for cookie based authentication to encrypt password in
# * cookie. Needs to be 32 chars long.
# */
_blowfish="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32)"
sed -i "s|$cfg['blowfish_secret'] = ''|$cfg['blowfish_secret'] = '${_blowfish}'|i" /etc/phpmyadmin/config.inc.php
mkdir /usr/share/webapps/phpmyadmin/tmp
chmod 777 /usr/share/webapps/phpmyadmin/tmp
echo -e "securing phpMyAdmin"
_pass="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8)"
_encrypted=$(openssl passwd -apr1 $_pass)
@@ -157,11 +174,13 @@ 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
# 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
chmod +x /usr/local/bin/drush
echo -e "Drush and DrupalConsoleinstalled"
# for non composer installed D7 site add assets/d7-drush-composer.json in root-folder/composer.json and run composer install
echo -e '
_
@@ -178,6 +197,7 @@ adduser -D -g 'www' www
mkdir -p /var/www/html
chown -R www:www /var/lib/nginx
chown -R www:www /var/www/html
chown -R www:www /var/tmp/nginx
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.ori
cp "$_assets"/lemp/default.nginxconf /etc/nginx/conf.d/default.conf
+1 -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 grep shadow coreutils certbot # needrestart
apk add procps vim curl tmux etckeeper htop lynx unzip grep shadow coreutils certbot pwgen rsync # needrestart
# sed -i "s/^# en_GB.UTF-8/en_GB.UTF-8/g" /etc/locale.gen
# locale-gen
+56
View File
@@ -0,0 +1,56 @@
#!/bin/sh
echo -e '
_ _ _ _
__| | |__ | | | |___ ___ _ _
/ _` | _ \ | |_| (_-</ -_) _|
\__,_|_.__/ \___//__/\___|_|
'
echo -e "Create new mysql db and user (you will be asked a db name and a password)"
. bin/checkroot.sh
sleep 3
# configure
echo -n "Please provide the mysql root passwd : "
read _root_mysql_passwd
mysql -u root -p$_root_mysql_passwd -e "show databases;"
echo -n "Enter new db name: "
read db_name
while [ "$db_name" = "" ]
do
read -p "enter a db name ? " db_name
if [ "$db_name" != "" ]; then
# TODO check if db already exists
# if id "$db_name" >/dev/null 2>&1; then
# echo "user $db_name alreday exists, you must provide a non existing user name."
# db=""
# else
read -p "is db name $db_name correcte [y|n] " validated
if [ "$validated" = "y" ]; then
break
else
db_name=""
fi
# fi
fi
done
# generate random password for zabbix mysql user
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c16)"
# create zabbix mysql user
mysql -u root -p$_root_mysql_passwd -e "CREATE DATABASE $db_name;"
mysql -u root -p$_root_mysql_passwd -e "CREATE USER '$db_name'@'localhost' IDENTIFIED BY '$_passwd';"
mysql -u root -p$_root_mysql_passwd -e "GRANT USAGE ON $db_name.* TO '$db_name'@'localhost';"
mysql -u root -p$_root_mysql_passwd -e "show databases;"
echo "database and user : $db_name installed"
echo " please record your password $_passwd"
echo "press any key to continue."
read continu
+8
View File
@@ -13,6 +13,14 @@ sleep 2
# TODO use awall instead of ufw ?
# BUG
# ufw
# Traceback (most recent call last):
# File "/usr/sbin/ufw", line 25, in <module>
# import ufw.frontend
# ModuleNotFoundError: No module named 'ufw'
# ufw
apk add ufw@testing
ufw allow ssh # knockd will open the ssh port
+12 -5
View File
@@ -38,12 +38,17 @@ apk add linux-headers "g++" zlib zlib-dev "crypto++@testing" "crypto++-dev@testi
ln -s /usr/lib/libcryptopp.so /usr/lib/libcryptopp.so.5.6
# 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.8/urbackup-client-2.4.8.0.tar.gz
wget -P /tmp/ https://hndl.urbackup.org/Client/2.4.10/urbackup-client-2.4.10.0.tar.gz
cd /tmp
tar xzf /tmp/urbackup-client-2.3.4.0.tar.gz
# tar xzf /tmp/urbackup-client-2.3.4.0.tar.gz
tar xzf /tmp/urbackup-client-2.4.10.0.tar.gz
# 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.10.0
./configure --enable-headless
make -j4
make install
@@ -65,9 +70,11 @@ echo "internet_server=$_ip
internet_server_port=55415
internet_mode_enabled=true
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
computername=$_computername" > /usr/local/var/urbackup/data/settings.cfg
computername=$_computername" > /etc/conf.d/urbackupclient
# /usr/local/var/urbackup/data/settings.cfg
# firewall
ufw allow from "$_ip" to any port 35621
+2 -1
View File
@@ -40,7 +40,8 @@ adduser "$user"
sed -i "s/$user:\/bin\/ash/$user:\/bin\/bash/g" /etc/passwd
# TODO limiting su to the admin group
whie [ "$vh" != "y" ] && [ "$vh" != "n" ]
yn="reset"
while [ "$yn" != "y" ] && [ "$yn" != "n" ]
do
echo -n "Should we allow $user to su? [y|n] "
read yn
+8 -3
View File
@@ -23,6 +23,11 @@ if [ ! -d "$_assets" ]; then
fi
fi
_domain=""
_validated=""
_drupal=""
_letsencrypt=""
while [ "$_domain" = "" ]
do
read -p "enter a domain name ? " _domain
@@ -87,11 +92,11 @@ 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 -p /var/www/"$_domain"/app/web
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
cp "$_assets/vhosts/index.php" /var/www/"$_domain"/app/web/
sed -i -r "s/DOMAIN\.LTD/$_domain/g" /var/www/"$_domain"/app/web/index.php
#set proper right to user will handle the app
chown -R www:www /var/www/"$_domain"/
+1 -1
View File
@@ -88,7 +88,7 @@ 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
echo -n "This is box is a proxmox CT? [Y|n] "
echo -n "Is This box a proxmox CT? [Y|n] "
read yn
yn=${yn:-y}
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
+1 -1
View File
@@ -34,7 +34,7 @@ _cwd="$(pwd)"
. bin/email.sh
. bin/lemp.sh
. bin/mysqlbackup.sh
whie [ "$vh" != "y" ] && [ "$vh" != "n" ]
while [ "$vh" != "y" ] && [ "$vh" != "n" ]
do
echo -n "Should we install a vhost? [y|n] "
read vh
+19 -11
View File
@@ -3,39 +3,47 @@
## Branches
each alpine linux stable release has it's branch (master is a clone of the last one)
- [3.8](https://figureslibres.io/gogs/bachir/alpine-web-werver/src/3.8)
- [3.9](https://figureslibres.io/gogs/bachir/alpine-web-werver/src/3.9) ([master](https://figureslibres.io/gogs/bachir/alpine-web-werver))
- [3.9](https://figureslibres.io/gogs/bachir/alpine-web-werver/src/3.9)
- [3.10](https://figureslibres.io/gogs/bachir/alpine-web-werver/src/3.10)
- [3.11](https://figureslibres.io/gogs/bachir/alpine-web-werver/src/3.11) ([master](https://figureslibres.io/gogs/bachir/alpine-web-werver))
## Features
- [x] upgrade
- [x] bash
- [x] misc
- [x] misc (procps vim curl tmux etckeeper htop lynx unzip grep shadow coreutils certbot pwgen tzdata)
- [x] dotfiles
- [x] user
- [x] secure openssh
- [x] Ufw (may be eventualy replaced by awall ?)
- [ ] Ufw (may be eventualy replaced by awall ?)
- [x] Fail2ban
- [x] Knockd
- [ ] Knockd
- [x] Mariadb (bug https://bugs.alpinelinux.org/issues/9046)
- [ ] mysql backups
- [x] mysql backups
- [x] php7-fpm (7.2)
- [x] redis
- [x] Nginx
- [x] drush
- [x] composer
- [ ] letsencrypt
- [ ] vhosts
- [x] redis
- [x] vhosts
- [x] letsencrypt
- [x] git barre repos
- [x] zabbix-agent (3.4 || 4)
- [x] urbackup-client
- [ ] solr
- [ ] git barre repos
- [ ] Proftpd
- [x] passwd generator
## how to use it
on a fresh install
as root
0 you may need to install ssh server
```
apk add openssh
rc-update add sshd
/etc/init.d/sshd start
```
1 install git
```
apk add git
@@ -43,7 +51,7 @@ apk add git
2 clone the repo
```
git clone -b 3.9 --single-branch https://figureslibres.io/gogs/bachir/alpine-web-werver.git
git clone -b 3.11 --single-branch https://figureslibres.io/gogs/bachir/alpine-web-werver.git
```
3 you have to be root