Repeat password entry and add option to stop after authentication entry creation

todo: fix loose dependency to php which leads to error on every run
This commit is contained in:
2020-02-14 22:03:41 +01:00
parent 809d40e8a2
commit 8e3b0355ff

View File

@@ -18,7 +18,10 @@ step_1() {
endReturn -o $? "$toolName installation failed" endReturn -o $? "$toolName installation failed"
} }
step_2_info() { echo "Setup snmp v3 access"; } step_2_info() {
echo "Setup snmp v3 access [-s]"
echoinfo " -s : Stop after creating authentication entry"
}
step_2() { step_2() {
# #
## Create authentication entry ## Create authentication entry
@@ -43,6 +46,13 @@ step_2() {
read -p "SNMPv3 Username: " v3User read -p "SNMPv3 Username: " v3User
read -s -p "SNMPv3 Password: " v3Pass read -s -p "SNMPv3 Password: " v3Pass
echo echo
read -s -p "Repeat Password: " v3Pass2
if [ "$v3Pass" != "$v3Pass2" ] ; then
echoerr " [E] Password mismatch"
return 1
fi
echo
exe service snmpd stop exe service snmpd stop
@@ -51,6 +61,13 @@ step_2() {
v3AuthEntry="createUser ${v3User} SHA \"${v3Pass}\" DES" v3AuthEntry="createUser ${v3User} SHA \"${v3Pass}\" DES"
addConf -a "$v3AuthEntry" "$v3AuthLoc" addConf -a "$v3AuthEntry" "$v3AuthLoc"
shift
if [ ! -z $1 ] && [ "$1" == "-s" ] ; then
echo " [I] Stop after creating authentication config"
exe service snmpd start
return 0
fi
# #
## Add custom base configuration ## Add custom base configuration
addConf -c "" "${toolConfig}" addConf -c "" "${toolConfig}"
@@ -144,6 +161,7 @@ step_25() {
;; ;;
esac esac
} }
# TODO error when no php is installed
phpVersionStr="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')" phpVersionStr="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
phpFpmStatusNginx="# Provide php-fpm status phpFpmStatusNginx="# Provide php-fpm status
location ~ ^/(status|ping)\$ { location ~ ^/(status|ping)\$ {
@@ -258,5 +276,5 @@ checkExtend() {
return 0 return 0
} }
VERSION_SEQREV=8 VERSION_SEQREV=10
. sequencer.sh . /usr/local/bin/sequencer.sh