Created
May 16, 2020 22:36
-
-
Save dadatuputi/f317da04771603f205d6b26921146224 to your computer and use it in GitHub Desktop.
EdgeOS script to enable or disable access to webui or ssh / useful with task-schedule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/vbash | |
# From https://wiki.vyos.net/wiki/Configuration_scripting | |
# Check for correct group | |
if [ "$(id -g -n)" != 'vyattacfg' ] ; then | |
echo "switching to vyattacfg group" | |
exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@" | |
exit 0 | |
fi | |
source /opt/vyatta/etc/functions/script-template | |
case "$1" in | |
"disable") | |
configure | |
delete service gui | |
delete service ssh | |
commit | |
save | |
;; | |
"enable") | |
configure | |
set service gui https-port 443 | |
set service gui older-ciphers disable | |
set service ssh port 22 | |
set service ssh protocol-version v2 | |
commit | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From a config prompt, create two tasks like so: