summaryrefslogtreecommitdiff
path: root/debian/radius-shell.postinst
blob: 55ebd2227022a00c1d42298a82533ddf1b2b8b28 (plain)
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
#! /bin/sh

set -e

# we depend on libnss-mapuser, so that the radius group will have been
# created before this script runs.

case "$1" in
    configure)
        radshell=/sbin/radius_shell
        chmod 750 $radshell
        chgrp radius_users $radshell
        setcap  cap_setuid+ep $radshell
        # The users will have been created by the libnss-mapuser package
        # and possibly by an older version, so change the shells here.
        # This also prevents a loop in package install ordering dependencies
        for usr in radius_user radius_priv_user; do
            uent="$(getent -s compat passwd $usr 2>/dev/null)" || true
            [ -z "$uent" ] && continue
            case "$uent" in
                *${radshell}*) ;;
                *) chsh -s $radshell $usr ;;
            esac
        done
        ;;
esac

#DEBHELPER#