From 9df8fb04396ff83384c739c4ec8152d813712311 Mon Sep 17 00:00:00 2001 From: gbaconni Date: Mon, 8 Nov 2021 06:30:46 +0100 Subject: [PATCH] 2021-11-08 06:30:46 --- Makefile | 3 ++- bonus.sh | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4ebde38..1812be9 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2021/11/02 17:47:57 by gbaconni #+# #+# # -# Updated: 2021/11/07 23:22:19 by gbaconni ### lausanne.ch # +# Updated: 2021/11/08 06:09:29 by gbaconni ### lausanne.ch # # # # **************************************************************************** # @@ -202,5 +202,6 @@ update: @git pull ssh: + @ssh-keygen -R "[127.0.0.1]:4242" >/dev/null 2>&1 @ssh -p 4242 -l gbaconni -i ~/.ssh/42lausanne-id_rsa -o StrictHostKeyChecking=no 127.0.0.1 diff --git a/bonus.sh b/bonus.sh index 015887e..18c2201 100755 --- a/bonus.sh +++ b/bonus.sh @@ -6,7 +6,7 @@ # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2021/11/07 14:23:18 by gbaconni #+# #+# # -# Updated: 2021/11/07 22:32:30 by gbaconni ### lausanne.ch # +# Updated: 2021/11/08 06:30:44 by gbaconni ### lausanne.ch # # # # **************************************************************************** # @@ -29,9 +29,15 @@ ft_apache () apt-get install -qq -y ssl-cert apache2 a2enmod alias headers ssl a2ensite default-ssl - sed -i 's/80/4243/g; s/443/4244/g;' /etc/apache2/ports.conf /etc/apache2/sites-available/{default,default-ssl} - sed -i 's/@HostName/localhost/g' /usr/share/ssl-cert/ssleay.cnf + sed -i 's/80/4243/g; s/443/4244/g;' /etc/apache2/ports.conf /etc/apache2/sites-available/{000-default,default-ssl}.conf + sed -i 's/@HostName@/localhost/g' /usr/share/ssl-cert/ssleay.cnf make-ssl-cert generate-default-snakeoil --force-overwrite + #openssl req -x509 \ + # -out /etc/ssl/certs/ssl-cert-snakeoil.pem \ + # -keyout /etc/ssl/private/ssl-cert-snakeoil.key \ + # -newkey rsa:2048 -nodes -sha256 \ + # -subj '/CN=localhost' -extensions EXT -config <( \ + # printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") systemctl reload apache2 fi return 0 @@ -61,9 +67,9 @@ ft_wordpress () if ! test -d /var/lib/mysql/wordpress then rm -f /etc/wordpress/config-localhost.php - sed -i -r "s/(read.*)(yn|DB_PASSWORD)/\2=y/g; s/ -u \$DB_USER -p / -u root /g;" /usr/share/doc/wordpress/examples/setup-mysql + sed -i -r "s/(read.*)(yn|DB_PASSWORD)/\2=y/g; s/ -u .DB_USER -p / -u root /g;" /usr/share/doc/wordpress/examples/setup-mysql bash -x /usr/share/doc/wordpress/examples/setup-mysql -n wordpress localhost - mysql -e "ALTER USER root@localhost IDENTIFIED BY '${password}'; FLUSH PRIVILEGES;" mysql + mysql -u root -h localhost -e "ALTER USER root@localhost IDENTIFIED BY '${password}'; FLUSH PRIVILEGES;" mysql ln -snf /etc/wordpress/config-localhost.php /etc/wordpress/config-default.php fi return 0