[Nagiosplug-devel] check_gpgsig

Thomas Guyot-Sionnest dermoth at aei.ca
Tue Jan 30 06:16:51 CET 2007


On 29/01/07 12:13 PM, Harold Naparst wrote:
> I wrote this shell script to check if a file,
> such as one of your web pages, has been altered.
> I use it to monitor whether my home page has been 
> hacked.
> 
> #!/bin/sh
> # ------------------------------------------------------------------------------
> # check_gpgsig.sh - verify gpg signature of a file.
> # usage:
> #  ./check_gpgsig.sh your_file
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
> # ------------------------------------------------------------------------------
> 
> FC=3
> STAT="UNKNOWN"
>         if [ ! -e "$1" ]; then
>                 RW=$1" is missing."
>                 STAT="WARNING"
>                 FC=1
>         else 
>                 RW=`gpg --verify $1`
>                 FC=$?
>                 if [ "$FC" == "1" ]; then
>                         STAT="CRITICAL"
>                         RW="Dude.  Someone hacked you."
>                         FC=2
>                 else
>                         STAT="OK"
>                         RW="Good."
>                         FC=0
>                 fi
>         fi
> 
> echo $STAT": "$RW
> exit $FC

Hi,

The best place to publish your work is at http://www.nagiosexchange.org/

Thanks,

Thomas




More information about the Devel mailing list