diff --git a/seqs/snmp.sh b/seqs/snmp.sh index 251eaf7..e437bd3 100755 --- a/seqs/snmp.sh +++ b/seqs/snmp.sh @@ -107,7 +107,7 @@ step_20() { # VCHI initialization failed fix exe usermod -aG video ${toolSysUser} - addConf -c "$rpiSudoersContent" "$rpiSudoersLoc" + addConf -s "$rpiSudoersContent" "$rpiSudoersLoc" exe service snmpd restart } @@ -281,7 +281,7 @@ step_32() { } postfixDeps="pflogsumm" -step_33_info() { echo "Prepare cache folder for postfix details"; } +step_33_info() { echo "Prepare cache folder for postfixdetailed"; } step_33() { exe touch "$postfixCacheLoc" exe chown root:$toolSysUser "$postfixCacheLoc" @@ -298,14 +298,24 @@ postfixCacheLoc="/var/cache/postfixdetailed" postfixScript="${toolConfigLoc}/postfixdetailed" postfixQueuesExtendLoc="${toolConfigLoc}/postfix-queues" -step_34_info() { echo "Create postfix extends (postfixdetailed and postfix-queues)"; } +step_34_info() { echo "Create sudoers file for postfix scripts"; } step_34() { + addConf -s "$postfixSudoersContent" "$postfixSudoersLoc" + echo " [I] Changing ${postfixQueuesExtendLoc} to add sudo for qshape" + exe sed -i -E "s/\`qshape/\`sudo qshape/" "${postfixQueuesExtendLoc}" + echo " [W] Reboot may be required to make these changes active" +} +postfixSudoersLoc="/etc/sudoers.d/snmppostfix" +postfixSudoersContent="${toolSysUser} ALL=(ALL) NOPASSWD: /usr/sbin/qshape" + +step_35_info() { echo "Create postfix extends (postfixdetailed and postfix-queues)"; } +step_35() { checkExtend postfix-queues if [ $? -eq 0 ]; then echo " [I] Create postfix-queues extend" addConf -a "extend mailq ${postfixQueuesExtendLoc}" "$toolConfig" fi - checkExtend postfix-queues + checkExtend postfixdetailed if [ $? -eq 0 ]; then echo " [I] Create postfixdetailed extend" addConf -a "extend postfixdetailed ${postfixScript}" "$toolConfig" @@ -315,9 +325,9 @@ step_34() { } #fail2ban -step_36_info() { echo "Extend for fail2ban jail information"; } -step_36_alias() { ALIAS="fail2ban"; } -step_36(){ +step_37_info() { echo "Extend for fail2ban jail information"; } +step_37_alias() { ALIAS="fail2ban"; } +step_37(){ local aptOpt= if [ $QUIET -ne 0 ];then aptOpt="-y" @@ -341,8 +351,8 @@ step_36(){ fail2banDeps="libjson-perl" fail2banExtendLoc="${toolConfigLoc}/fail2ban" -step_37_info() { echo "Create cron to update fail2ban cache"; } -step_37() { +step_38_info() { echo "Create cron to update fail2ban cache"; } +step_38() { addConf -s "$fail2banCron" "$fail2banCronLoc" } fail2banCronLoc="/etc/cron.d/fail2banCache" @@ -365,5 +375,5 @@ checkExtend() { return 0 } -VERSION_SEQREV=10 +VERSION_SEQREV=11 . /usr/local/bin/sequencer.sh