summaryrefslogtreecommitdiff
path: root/debian/libtacplus-map1.postinst
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-05-02 19:07:13 +0200
committerChristian Poessinger <christian@poessinger.com>2021-05-02 19:07:49 +0200
commit7d2e07fd4502aed3b841484855031ca8a48aebba (patch)
tree7861b20208fd1089b0d6e67f72523d0ca6d745da /debian/libtacplus-map1.postinst
downloadlibtacplus-map-7d2e07fd4502aed3b841484855031ca8a48aebba.tar.gz
libtacplus-map-7d2e07fd4502aed3b841484855031ca8a48aebba.zip
Initial import of libtacplus-map (1.0.1-cl3u3)
Diffstat (limited to 'debian/libtacplus-map1.postinst')
-rw-r--r--debian/libtacplus-map1.postinst51
1 files changed, 51 insertions, 0 deletions
diff --git a/debian/libtacplus-map1.postinst b/debian/libtacplus-map1.postinst
new file mode 100644
index 0000000..1a45376
--- /dev/null
+++ b/debian/libtacplus-map1.postinst
@@ -0,0 +1,51 @@
+#!/bin/sh
+# postinst script for libtacplus_map
+
+set -e
+
+case "$1" in
+ configure)
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# Add the tacacs group and all 16 possible tacacs privilege-level
+# users to the password file, home directories, etc.
+# The accounts are not enabled for local login, since they are
+# only used to provide uid/gid/homedir for the mapped TACACS+
+# logins (and lookups against them).
+
+# --firstuid is used because the installed pam_tacplus configs and audit files are
+# for uid >1000. Ideally, there should be a way to specify a minimum, but not
+# override adduser.conf if it has a larger value.
+# suppress messages about already existing users, and ignore "errors" if
+# they do
+
+(set +e
+addgroup --quiet tacacs 2>&1 | grep -v 'already exists'
+level=0
+nclu_grp=netshow
+while [ $level -lt 16 ]; do
+ adduser --quiet --firstuid 1000 --disabled-login --ingroup tacacs \
+ --gecos "TACACS+ mapped user at privilege level ${level}" tacacs${level}
+ # regular tacacs users are allowed to run NCLU 'net show' commands
+ # tacacs15 (tacacs privilege level 15) user is allowed to run NCLU
+ # net configuration commands, also
+ adduser --quiet tacacs${level} $nclu_grp
+ level=$(( level+1 ))
+ [ $level -eq 15 ] && nclu_grp=netedit
+done 2>&1 | grep -v 'already exists'
+exit 0
+)
+
+
+#DEBHELPER#
+
+exit 0