File: postinst

package info (click to toggle)
thp 0.4.6-9
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 260 kB
  • sloc: perl: 1,088; sh: 154; makefile: 56
file content (46 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# Postint script for tinyhoneypot

set -e 
# New user to create
NUSER=thpot
# User the group belongs to
NUSERGROUP=nogroup
# HOME directory for the user
NUHOME=/usr/share/thpot

case "$1" in
    configure)
        if ! getent passwd | grep -q "^$NUSER:"; then
          adduser --quiet --system --home $NUHOME \
                        --gecos "TinyHoneypot" \
                        --gecos "Honeypot user" \
                        --disabled-login \
                        --disabled-password \
                        --no-create-home \
                        --home $NUHOME \
                        --ingroup $NUSERGROUP \
                        --shell /dev/null \
                        $NUSER 
        fi
        # Setup the log directory
	# TODO: maybe do this only once (if the directory belongs to
	# root and the user has just been created)
        chown -R $NUSER:root /var/log/thpot
	chmod -R o-rwX /var/log/thpot
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0