router.yml aktualisiert
This commit is contained in:
parent
e5d95c0fc1
commit
c65b14cb4c
24
router.yml
24
router.yml
@ -16,9 +16,28 @@
|
|||||||
g_nice
|
g_nice
|
||||||
g_all-to-syslog
|
g_all-to-syslog
|
||||||
|
|
||||||
defaultgw=$(ip route | awk '/default/ { print $3 }')
|
|
||||||
if wget -q -t1 --timeout=30 http://${defaultgw} -O /dev/null
|
if wget -q -t1 --timeout=30 http://${defaultgw} -O /dev/null
|
||||||
then
|
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 "
|
echo "
|
||||||
http:
|
http:
|
||||||
routers:
|
routers:
|
||||||
@ -40,7 +59,8 @@
|
|||||||
middlewares:
|
middlewares:
|
||||||
auth-router:
|
auth-router:
|
||||||
basicauth:
|
basicauth:
|
||||||
users: \"admin:\$apr1\$XLxGs/Ba\$3phZ1a2RtfExOp8x6NFjZ.\"
|
usersFile: \"/etc/traefik/providers.local/router.usersfile\"
|
||||||
|
removeHeader: true
|
||||||
" >/home/docker/traefik/providers/router.yml
|
" >/home/docker/traefik/providers/router.yml
|
||||||
else
|
else
|
||||||
rm -f /home/docker/traefik/providers/router.yml
|
rm -f /home/docker/traefik/providers/router.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user