Skip to content

Instantly share code, notes, and snippets.

@ryonsherman
Created October 10, 2012 22:44

Revisions

  1. ryonsherman revised this gist Oct 16, 2012. 1 changed file with 0 additions and 52 deletions.
    52 changes: 0 additions & 52 deletions pushover.conf
    Original file line number Diff line number Diff line change
    @@ -1,52 +0,0 @@
    #
    # Fail2Ban configuration file
    #
    # Author: Ryon Sherman
    #

    [Definition]

    # Option: actionstart
    # Notes.: command executed once at the start of Fail2Ban.
    # Values: CMD
    #
    actionstart = /usr/local/bin/pushover "Fail2Ban" "$(printf %%b 'The jail <name> has been started.')"

    # Option: actionstop
    # Notes.: command executed once at the end of Fail2Ban
    # Values: CMD
    #
    actionstop = /usr/local/bin/pushover "Fail2Ban" "$(printf %%b 'The jail <name> has been stopped.')"

    # Option: actioncheck
    # Notes.: command executed once before each actionban command
    # Values: CMD
    #
    actioncheck =

    # Option: actionban
    # Notes.: command executed when banning an IP. Take care that the
    # command is executed with Fail2Ban user rights.
    # Tags: <ip> IP address
    # <failures> number of failures
    # <time> unix timestamp of the ban time
    # Values: CMD
    #
    actionban = /usr/local/bin/pushover "Fail2Ban" "$(prinf %%b 'The IP <ip> has just been banned after <failures> attempts against <name>.')"

    # Option: actionunban
    # Notes.: command executed when unbanning an IP. Take care that the
    # command is executed with Fail2Ban user rights.
    # Tags: <ip> IP address
    # <failures> number of failures
    # <time> unix timestamp of the ban time
    # Values: CMD
    #
    actionunban =

    [Init]

    # Defaut name of the chain
    #
    name = default

  2. ryonsherman revised this gist Oct 10, 2012. 1 changed file with 52 additions and 0 deletions.
    52 changes: 52 additions & 0 deletions pushover.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    #
    # Fail2Ban configuration file
    #
    # Author: Ryon Sherman
    #

    [Definition]

    # Option: actionstart
    # Notes.: command executed once at the start of Fail2Ban.
    # Values: CMD
    #
    actionstart = /usr/local/bin/pushover "Fail2Ban" "$(printf %%b 'The jail <name> has been started.')"

    # Option: actionstop
    # Notes.: command executed once at the end of Fail2Ban
    # Values: CMD
    #
    actionstop = /usr/local/bin/pushover "Fail2Ban" "$(printf %%b 'The jail <name> has been stopped.')"

    # Option: actioncheck
    # Notes.: command executed once before each actionban command
    # Values: CMD
    #
    actioncheck =

    # Option: actionban
    # Notes.: command executed when banning an IP. Take care that the
    # command is executed with Fail2Ban user rights.
    # Tags: <ip> IP address
    # <failures> number of failures
    # <time> unix timestamp of the ban time
    # Values: CMD
    #
    actionban = /usr/local/bin/pushover "Fail2Ban" "$(prinf %%b 'The IP <ip> has just been banned after <failures> attempts against <name>.')"

    # Option: actionunban
    # Notes.: command executed when unbanning an IP. Take care that the
    # command is executed with Fail2Ban user rights.
    # Tags: <ip> IP address
    # <failures> number of failures
    # <time> unix timestamp of the ban time
    # Values: CMD
    #
    actionunban =

    [Init]

    # Defaut name of the chain
    #
    name = default

  3. ryonsherman created this gist Oct 10, 2012.
    17 changes: 17 additions & 0 deletions pushover.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/usr/bin/env sh

    URL="https://api.pushover.net/1/messages.json"
    API_KEY=""
    USER_KEY=""
    DEVICE=""

    TITLE="${1}"
    MESSAGE="${2}"

    curl \
    -F "token=${API_KEY}" \
    -F "user=${USER_KEY}" \
    -F "device=${DEVICE}" \
    -F "title=${TITLE}" \
    -F "message=${MESSAGE}" \
    "${URL}" > /dev/null 2>&1