1
0
Fork 0
mirror of https://github.com/fernwerker/ownDynDNS.git synced 2025-07-10 14:15:14 +02:00

Update .configure.sh

version 1.2
This commit is contained in:
NiiWiiCamo 2023-08-11 13:58:15 +02:00 committed by GitHub
parent 36af8865a6
commit 0d40bfd6ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,8 +1,11 @@
#!/bin/bash !/bin/bash
echo "### ownDynDNS configuration script" echo "### ownDynDNS configuration script"
# set variables # set variables
scriptversion="1.0" scriptversion="1.2"
wwwuserd="www-data"
wwwgroupd="www-data"
defaultenvfile=".env.dist" defaultenvfile=".env.dist"
@ -65,8 +68,7 @@ else
log="false" log="false"
fi fi
echo "the logfile is created in this directory by default." echo "the logfile is created in this directory by default. your ip history is thereby publically available."
echo "your ip history is thereby publically available."
echo "select where the logfile should be created if enabled:" echo "select where the logfile should be created if enabled:"
echo "[1] default: ${log1}" echo "[1] default: ${log1}"
echo "[2] private: ${log2}" echo "[2] private: ${log2}"
@ -86,9 +88,52 @@ case $choice in
;; ;;
esac esac
echo "the logfile needs to be writable by the webserver if logging is enabled."
read -p "which user does the webserver run as? [${wwwuserd}]: " wwwuser
wwwuser=${wwwuser:-$wwwuserd}
read -p "which group does the webserver run as? [${wwwgroupd}]: " wwwgroup
wwwgroup=${wwwgroup:-$wwwgroupd}
mkdir -p $(dirname $logfile) && touch $logfile || echo "### could not create logfile!" mkdir -p $(dirname $logfile) && touch $logfile || echo "### could not create logfile!"
chown $wwwuser:$wwwgroup $logfile
chmod 0640 $logfile
#echo "logfile will be created at: ${logfile}" #echo "logfile will be created at: ${logfile}"
### Apache htaccess file config
echo "if you are using apache it is recommended to enable the .htaccess file to prevent unauthorized access to the .env file and any logfile."
echo "select if you want to enable the .htaccess file:"
echo "[1] no .htaccess file. (e.g. using nginx)"
echo "[2] block access to .env file only (default log location accessible)"
echo "[3] block access to .env file and log file"
read -p "select from the choices above [1]: " choice
case $choice in
2)
cat > $htaccess << EOM
<FilesMatch "\.env$">
Order allow,deny
Deny from all
</FilesMatch>
EOM
rm .htaccess.example
;;
3)
mv .htaccess{.example,}
;;
*)
rm .htaccess.example
;;
esac
### nginx htaccess equivalent message
echo "if you are using nginx please read the docs about how to disable access to certain files and folders.\nyou might add a location block to the beginning of your site config as follows:"
echo -e " location ~* (env|log|json) {\n deny all;\n return 404;\n }"
### create the .env file ### create the .env file
if [ -f $envfile ] if [ -f $envfile ]
then then