This file is indexed.

/usr/share/debian-edu-config/tools/gosa-remove is in debian-edu-config 1.702.

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
#!/bin/sh

set -e

## This script is run by www-data using sudo. Keep that in mind!
## Make sure that malicious execution cannot hurt.
##
## This script removes the home directories and principals for users removed with gosa.
## Home directories are not purged immediately, but marked with a time stamp. Next time
## this script is run it looks for all home directories marked for removal and removes 
## directories older than the given age $MAXAGE. 
##
## Malicious execution can mark directories for purging, but if $MAXAGE is chosen not 
## too short, this will be detected by the owner and no data will get lost. 

USERID=$1
HOMEDIR=$2

## minimum age to keep a directory before it is purged 
## in days (only integer values):

MAXAGE_DAYS=500

####################################

MAXAGE_SEC=$(( $MAXAGE_DAYS*24*60*60 ))

[ -d $HOMEDIR ] || exit 1

PREFIX=/skole
HOSTNAME=$(hostname -s)
echo "$HOMEDIR" | egrep -q "^$PREFIX/$HOSTNAME.*$USERID" || exit 1

## move mail directory to home directory
if [ -d /var/mail/$USERID ]; then
    mkdir -p $HOMEDIR/Maildir/
    mv /var/mail/$USERID/* $HOMEDIR/Maildir/
    rmdir /var/mail/$USERID 
fi

## rename home directory and delete principal:
HOME=`dirname $HOMEDIR`
RM_HOMEDIR="$HOME/rm_"`date "+%Y%m%d"`"_"`basename $HOMEDIR`
mv $HOMEDIR $RM_HOMEDIR

chown root:root $RM_HOMEDIR
chmod go-rwx $RM_HOMEDIR

kadmin.local -q "delete_principal $USERID"
logger -t gosa-remove -p notice Home directory \'$HOMEDIR\' marked for deletion and principal \'$USERID\' removed. 

for DIR in `find $HOME -maxdepth 1 -type d -regextype posix-egrep -regex ".*/rm_[0-9]{8}_[^/]+"` ; do
    RMDATE=`echo $DIR | sed "s/.*rm_\([0-9]\{8\}\)_.*/\1/"`
    AGE=$(( `date +"%s"`-`date +"%s" -d $RMDATE` )) 
    if [ $AGE -gt $MAXAGE_SEC ] ; then
	rm -rf $DIR
	logger -t gosa-remove -p notice Home directory \'$DIR\' purged.
    fi
done 

exit 0