security.d/chk_mailqueue

Mon, 20 Jan 2014 12:48:38 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 20 Jan 2014 12:48:38 +0100
changeset 19
2c0dacb26b14
parent 17
65656789da08
permissions
-rw-r--r--

Fixed error message when there was nothing to report.

5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
1 #!/bin/bash
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
2 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
3 #############################################################################
16
37f217a8bcce Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents: 14
diff changeset
4 # Copyright (C) 2005-2013
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
5 #
16
37f217a8bcce Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents: 14
diff changeset
6 # Michiel Broek <mbse at mbse.eu>
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
7 #
14
59e07bba67cc Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents: 5
diff changeset
8 # This file is part of SlackSecCheckScripts.
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
9 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
10 # This package is free software; you can redistribute it and/or modify it
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
11 # under the terms of the GNU General Public License as published by the
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
12 # Free Software Foundation; either version 2, or (at your option) any
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
13 # later version.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
14 #
14
59e07bba67cc Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents: 5
diff changeset
15 # SlackSecCheckScripts is distributed in the hope that it will be useful, but
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
18 # General Public License for more details.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
19 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
20 # You should have received a copy of the GNU General Public License
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
21 # along with MBSE BBS; see the file COPYING. If not, write to the Free
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
22 # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
23 #############################################################################
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
24
16
37f217a8bcce Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents: 14
diff changeset
25 # If the system is using ssmtp then there is no queue to check
37f217a8bcce Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents: 14
diff changeset
26 [ -x /usr/sbin/ssmtp ] && exit
37f217a8bcce Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents: 14
diff changeset
27
5
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
28 PATH=/sbin:/usr/sbin:/bin:/usr/bin
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
29
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
30 umask 077
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
31 TZ=UTC; export TZ
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
32 LANG=C; export LANG
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
33
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
34 SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
35
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
36 trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
37
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
38 if ! cd "$SECUREDIR"; then
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
39 echo "Can not cd to $SECUREDIR".
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
40 exit 1
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
41 fi
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
42
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
43 TMP=$SECUREDIR/tmp
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
44
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
45 # Check mailqueue
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
46 #
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
47 mailq > $TMP
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
48 if ! grep -q "queue is empty$" $TMP; then
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
49 echo ""
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
50 echo "mail:"
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
51 cat $TMP
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
52 fi
fe3130d22800 Conversion from CVS
Mercurial Repos
parents:
diff changeset
53

mercurial