if [ $BANUNBAN = "fail2ban" ]; then msg_info "Installing Fail2Ban Dependencies for ${APP}" cmd_exec apt install -y fail2ban &>>$INSTALLLOG cmd_exec apt install -y iptables &>>$INSTALLLOG cmd_exec apt install -y ipset &>>$INSTALLLOG if [ -z "${FAIL2BAN_GROUP}" ]; then cmd_exec groupadd fail2ban &>>$INSTALLLOG fi cmd_exec usermod --append --groups fail2ban mystic &>>$INSTALLLOG msg_ok "Installing Fail2Ban Dependencies for ${APP}" msg_info "Installing Fail2Ban Scripts for ${APP}" cmd_exec pushd $MSTEMPDIR/mystic/fail2ban &>>$INSTALLLOG cmd_exec sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" action.d/mysticbbs.conf > /etc/fail2ban/action.d/mysticbbs.conf cmd_exec sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" filter.d/mysticbbs.conf > /etc/fail2ban/filter.d/mysticbbs.conf cmd_exec sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" jail.d/mysticbbs.conf > /etc/fail2ban/jail.d/mysticbbs.conf cmd_exec mkdir -p /etc/systemd/system/fail2ban.service.d cmd_exec cp systemd/override.conf /etc/systemd/system/fail2ban.service.d/override.conf cmd_exec popd &>>$INSTALLLOG msg_ok "Installing Fail2Ban Scripts for ${APP}" fi if [ $BANUNBAN = "ipban" ]; then msg_info "Installing IpBan Dependencies for ${APP}" cmd_exec pushd $MSTEMPDIR &>>$INSTALLLOG cmd_exec wget -N https://github.com/DigitalRuby/IPBan/raw/master/IPBanCore/Linux/Scripts/Install.sh -O $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG cmd_exec apt install -y fail2ban &>>$INSTALLLOG cmd_exec apt install -y iptables &>>$INSTALLLOG cmd_exec apt install -y ipset &>>$INSTALLLOG cmd_exec apt install -y xmlstarlet &>>$INSTALLLOG cmd_exec sed -i '/yum/d' $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG cmd_exec sed -i '/systemctl/d' $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG cmd_exec sed -e 's!sudo !!g' -i $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG cmd_exec sed -e 's!-qq!-qqo!g' -i $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG cmd_exec sed -i '/nano/d' $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG cmd_exec bash $MSTEMPDIR/ipban-install.sh &>>$INSTALLLOG if [ -z "${IPBAN_GROUP}" ]; then cmd_exec groupadd ipban &>>$INSTALLLOG fi cmd_exec usermod --append --groups ipban mystic &>>$INSTALLLOG cmd_exec chown -R root:ipban /opt/ipban &>>$INSTALLLOG cmd_exec chmod 775 /opt/ipban/ &>>$INSTALLLOG cmd_exec dos2unix /opt/ipban/*.{config,xml,md} &>>$INSTALLLOG cmd_exec popd &>>$INSTALLLOG msg_ok "Installing IpBan Dependencies for ${APP}" fi