/usr/sbin/update-aide.conf is in aide-common 0.16-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | #!/bin/bash
# update-aide.conf(8) - Generate /var/lib/aide/aide.conf.autogenerated
# this has been mercilessly ripped from exim4's update-exim4.conf
UPAC_CONFDIR="${UPAC_CONFDIR:-/etc/aide}"
UPAC_CONFD="${UPAC_CONFD:-$UPAC_CONFDIR/aide.conf.d}"
UPAC_SETTINGSD="${UPAC_SETTINGSD:-$UPAC_CONFDIR/aide.settings.d}"
UPAC_DEFAULTFILE="${UPAC_DEFAULTFILE:-/etc/default/aide}"
UPAC_AUTOCONFIGFILE="${UPAC_AUTOCONFIGFILE:-/var/lib/aide/aide.conf.autogenerated}"
UPAC_MAINCONFIGFILE="${UPAC_MAINCONFIGFILE:-$UPAC_CONFDIR/aide.conf}"
if [ -f $UPAC_DEFAULTFILE ]; then
. $UPAC_DEFAULTFILE
fi
UPAC_confdir="$UPAC_CONFDIR"
UPAC_confd="$UPAC_CONFD"
UPAC_settingsd="$UPAC_SETTINGSD"
UPAC_verbose=no
UPAC_comments=no
UPAC_autoconfigfile="$UPAC_AUTOCONFIGFILE"
UPAC_mainconfigfile="$UPAC_MAINCONFIGFILE"
UPAC_outputfile="${UPAC_autoconfigfile}"
export UPAC_verbose
export UPAC_confdir
export UPAC_confd
export UPAC_settingsd
usage() {
cat <<EOF
$0 - Generate AIDE configuration files
Options:
-v|--verbose - Enable verbose mode, tell about ignored files
-h|--help - Show this message
--keepcomments - Do not remove comment lines
--removecomments - Remove comment lines
-o|--output file - write output to file instead of ${UPAC_outputfile}
-d|--confdir directory - read input from given directory instead of ${UPA4C_confdir}
-D|--confd directory - read config snippets from given directory instead of ${UPAC_confd}
-S|--settingsd directory - read settings snippets from given directory instead of ${UPAC_settingsd}
-a|--autoconfigfile - write result to file instead of ${UPAC_autoconfigfile}
-m|--mainconfigfile - read aide basic config from file instead of ${UPAC_mainconfigfile}
EOF
}
## Parse commandline
TEMP=$(getopt -n update-aide.conf \
-l keepcomments,removecomments,output:,confdir:,confd:,settingsd:,autoconfigfile:,mainconfigfile:,help,verbose -- \
+o:d:D:S:a:m:hv "$@")
if test "$?" != 0; then
echo "Terminating..." >&2
exit 1
fi
eval set -- ${TEMP}
while test "$1" != "--"; do
case $1 in
-h|--help)
usage
exit 0
;;
-v|--verbose)
UPAC_verbose=yes
;;
--keepcomments)
UPAC_comments=yes
;;
--removecomments)
UPAC_comments=no
;;
-o|--output)
shift
UPAC_outputfile="$1"
;;
-d|--confdir)
shift
UPAC_confdir="$1"
;;
-D|--confd)
shift
UPAC_confd="$1"
;;
-S|--settingsd)
shift
UPAC_settingsd="$1"
;;
-a|--autoconfigfile)
shift
UPAC_autoconfigfile="$1"
;;
-u|--mainconfigfile)
shift
UPAC_mainconfigfile="$1"
;;
esac
shift
done
shift
# No non-option arguments allowed.
if [ "$#" -ne 0 ]; then
echo "No non option arguments ($@) allowed" >&2
usage >&2
exit 1
fi
[ -d ${UPAC_confd} ] || \
{ printf "$0: Error, no ${UPAC_confd}, exiting.\n" 1>&2 ; exit 1 ; }
[ -d $(dirname $UPAC_outputfile) ] || \
{ printf "$0: Error, missing $(dirname $UPAC_outputfile), exiting.\n" 1>&2 ; exit 1 ; }
# run-parts emulation, stolen from Branden's /etc/X11/Xsession
# Addition: Use file.rul instead if file if it exists.
run_parts () {
# reset LC_COLLATE
unset LANG LC_COLLATE LC_ALL
if [ -z "$1" ]; then
errormessage "$0: internal run_parts called without an argument"
fi
if [ ! -d "$1" ]; then
errormessage "$0: internal run_parts called, but $1 does not exist or is not a directory."
fi
for F in $(ls $1); do
if expr "$F" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then
if [ -f "$1/$F" ] ; then
if [ -f "$1/${F}.rul" ] ; then
echo "$1/${F}.rul"
else
echo "$1/$F"
fi
fi
fi
done;
}
cat_parts() {
if [ -z "$1" ]; then
errormessage "$0: internal cat_parts called without an argument"
fi
if [ ! -d "$1" ]; then
errormessage "$0: internal cat_parts called, but $1 does not exist or is not a directory."
fi
for file in $(run_parts $1); do
if [ -x "$file" ]; then
echo "#####################################################"
echo "### output of invoking $file"
echo "#####################################################"
$file
echo
echo "#####################################################"
echo "### end of $file output"
echo "#####################################################"
else
echo "#####################################################"
echo "### $file"
echo "#####################################################"
cat $file
echo
echo "#####################################################"
echo "### end $file"
echo "#####################################################"
fi
done
}
removecomments(){
if [ "x${UPAC_comments}" = "xno" ] ; then
grep -E -v '^[[:space:]]*#' | sed -e '/^$/N;/\n$/D' ;
else
cat
fi
}
# also from Branden
errormessage () {
# pretty-print messages of arbitrary length (no trailing newline)
echo "$*" | fold -s -w ${COLUMNS:-80} >&2;
}
cat << EOF > ${UPAC_outputfile}.tmp
#########
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# this file is generated dynamically from $UPAC_mainconfigfile and the files
# in $UPAC_confd
# Any changes you make here will be lost.
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# WARNING WARNING WARNING
# WARNING WARNING WARNING
#########
EOF
(cat ${UPAC_mainconfigfile} 2>/dev/null; cat_parts ${UPAC_confd}) | \
removecomments | \
sed '\;^[=!/]; s;/;/@@{ROOTPREFIX};' \
>> ${UPAC_outputfile}.tmp
# test validity if called without -o
# this is not currently possible with AIDE (see bug #289171),
# but can be easily enabled with this (of course untested) example code
#if [ "x${UPAC_outputfile}" = "x${UPAC_autoconfigfile}" ] && \
# [ -x ${AIDE} ] ; then
# if ! ${AIDE} --config "${UPAC_outputfile}.tmp" > /dev/null ; then
# errormessage "Invalid new configfile ${UPAC_outputfile}.tmp"
# errormessage "not installing ${UPAC_outputfile}.tmp to ${UPAC_outputfile}"
# exit 1
# fi
#fi
mv -f ${UPAC_outputfile}.tmp ${UPAC_outputfile}
|