← cd ..

fail2ban-client

Command

This executable can run non-interactive system commands.
  1. CommentThe subprocess is immediately sent to the background, but fail2ban-client waits on a return code from the subprocess. The banip command will hang until the subprocess returns.
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    fail2ban-client add xfail2ban-client set x addaction xfail2ban-client set x action x actionban /path/to/commandfail2ban-client start xfail2ban-client set x banip 999.999.999.999fail2ban-client set x unbanip 999.999.999.999fail2ban-client stop x
    OutputThe commands are executed but their output is hidden from the attacker.
  2. This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    cat >/path/to/temp-dir/fail2ban.conf <<EOF[Definition]EOFcat >/path/to/temp-dir/jail.local <<EOF[x]enabled = trueaction = xEOFmkdir -p /path/to/temp-dir/action.d/cat >/path/to/temp-dir/action.d/x.conf <<EOF[Definition]actionstart = /path/to/commandEOFmkdir -p /path/to/temp-dir/filter.d/cat >/path/to/temp-dir/filter.d/x.conf <<EOF[Definition]EOFfail2ban-client -c /path/to/temp-dir/ -v restart
    OutputThe commands are executed but their output is hidden from the attacker.