router.yml aktualisiert

This commit is contained in:
olli 2023-09-18 13:51:23 +02:00
parent e5d95c0fc1
commit c65b14cb4c

View File

@ -15,10 +15,29 @@
g_lockfile
g_nice
g_all-to-syslog
defaultgw=$(ip route | awk '/default/ { print $3 }')
if wget -q -t1 --timeout=30 http://${defaultgw} -O /dev/null
then
cd /home/docker/traefik
user=admin
password=$(pwgen -s 32 1)
[ -f router-env ] || echo "USER=!USER!
PASSWORD=!PASSWORD!
" >router-env
chmod 440 router-env
chown root:docker router-env
sed -i "s/\!USER\!/$user/g" router-env
sed -i "s/\!PASSWORD\!/$password/g" router-env
. router-env
echo $(htpasswd -nb $USER $PASSWORD) >providers/router.usersfile
defaultgw=$(ip route | awk '/default/ { print $3 }')
echo "
http:
routers:
@ -40,7 +59,8 @@
middlewares:
auth-router:
basicauth:
users: \"admin:\$apr1\$XLxGs/Ba\$3phZ1a2RtfExOp8x6NFjZ.\"
usersFile: \"/etc/traefik/providers.local/router.usersfile\"
removeHeader: true
" >/home/docker/traefik/providers/router.yml
else
rm -f /home/docker/traefik/providers/router.yml