This file is indexed.

/usr/sbin/aideinit is in aide-common 0.16~a2.git20130520-2.

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
#!/bin/sh
#
# $Id$
# Copyright 2003 Mike Markley <mike@markley.org>
# This script is free for any purpose whatseoever so long as the above
# copyright notice remains in place.

if [ -f /etc/default/aide ]; then
	. /etc/default/aide
fi

# Defaults
MAILTO="${MAILTO:-root}"

# Options
opt_f=0
opt_y=0
opt_c=0
opt_b=0
defaultconfig="/var/lib/aide/aide.conf.autogenerated"

if ! [ -f "/usr/bin/aide" ] && ! [ -f "/usr/sbin/aide" ]; then
  echo >&2 "no /usr/bin/aide found, check your dependencies"
  exit 1
fi

aideinit_usage() {
	echo "Usage: $0 [options] -- [aide options]"
	echo "  -y|--yes         Overwrite output file"
	echo "  -f|--force       Force overwrite of database"
	echo "  -c|--config      Specify alternate config file"
	echo "  -o|--output      Specify alternate output file"
	echo "  -d|--database    Specify alternate database file"
	echo "  -b|--background  Run in the background"
}

while [ -n "$1" ]; do
	case "$1" in
	    -h|--help)
		aideinit_usage
		exit 0
		;;
	    -f|--force)
		opt_f=1
		shift
		;;
	    -y|--yes)
		opt_y=1
		shift
		;;
	    -b|--background)
		opt_b=1
		shift
		;;
	    -o|--output)
		shift
		[ -z "$1" ] && aideinit_usage && exit 1
		outfile=$1
		shift
		;;
	    -d|--database)
		shift
		[ -z "$1" ] && aideinit_usage && exit 1
		dbfile=$1
		shift
		;;
	    -c|--config)
		opt_c=1
		shift
		[ -z "$1" ] && aideinit_usage && exit 1
		config=$1
		shift
		;;
	    --)
	    	shift
		break 2
		;;
	    *)
		echo "Unknown option $1 (use -- to delimit aideinit and aide options)"
		exit
		;;
	esac
done

if [ -z "$config" ]; then
	update-aide.conf
fi

config=${config:-$defaultconfig}

if [ ! -f "$config" ]; then
	echo "$0: $config: file not found"
	exit 1
fi

if [ -z "$outfile" ]; then
	outfile=$(egrep "^[[:space:]]*database_out=file:" $config | cut -d: -f2)
	[ -z "$outfile" ] && outfile="/var/lib/aide/aide.db.new"
fi
if [ -z "$dbfile" ]; then
	dbfile=$(egrep "^[[:space:]]*database=file:" $config | cut -d: -f2)
	[ -z "$dbfile" ] && dbfile="/var/lib/aide/aide.db"
fi

if [ -f $outfile ]; then
	if [ $opt_y -eq 0 ]; then
		echo -n "Overwrite existing $outfile [Yn]? "
		read yn
		case "$yn" in
		    [Nn]*)
			exit 0
			;;
		esac
	fi
fi

extraflags=""

if [ $opt_b -eq 1 ]; then
	(aide.wrapper --init $extraflags $@ >/var/log/aide/aideinit.log 2>/var/log/aide/aideinit.errors
	RET=$?
	printf "AIDE --init return code %d" "$RET" >> /var/log/aide/aideinit.log
	if [ "$RET" != "0" ]; then
	   printf "AIDE --init return code %d" "$RET" >> /var/log/aide/aideinit.errors
	fi
	if [ -f "$dbfile" -a $opt_f -eq 0 ]; then
		echo "$dbfile exists and -f was not specified" >> /var/log/aide/aideinit.errors
	fi
	if [ "$(< /var/log/aide/aideinit.errors wc -l)" -gt 0 ]; then
		(echo "AIDE init errors:"; cat /var/log/aide/aideinit.errors) | /usr/bin/mail -s "AIDE initialization problem" $MAILTO
	else
		cp -f $outfile $dbfile
	fi) &
	exit 0
fi

# this is only reached if we run in foreground
echo "Running aide --init..."
aide.wrapper --init $extraflags $@

RET=$?
if [ "$RET" != "0" ]; then
	echo "AIDE --init return code $RET" >&2
	exit $return
fi

if [ -f "$dbfile" -a $opt_f -eq 0 ]; then
	echo -n "Overwrite $dbfile [yN]? "
	read yn
	case "$yn" in
	    [yY]*)
		cp -f $outfile $dbfile
		;;
	esac
else
	cp -f $outfile $dbfile
fi