tac_plus can work with PAM backend, however:
We will solve problem .1 by using a patched version of tac_plus. And we will solve .2 by delegating authorization such as which group gets which permissions to an external script. BTW, we're talking about AD-groups here, not tac_plus.conf groups which should've been called templates and nothing else.)
Get patched tacacs+ by cloning through git:
`$ git clone https://github.com/mkouhei/tacacs-plus.git`
Cd into the repo:
`$ cd tacacs-plus`
You can now do a debian build of the package (make sure you have all dependencies to use the dpkg-buildpackage):
`$ dpkg-buildpackage`
If all went well and you had every dependency correctly installed the .deb packages are now created one directory above, so
`$ cd ..`
you can install the packages with:
`$ dpkg -i libtacacs+1_4.* tacacs+_4.*`
To make authentication possible for AD users, we don't want to add every user which should have access to your tacacs-enabled devices to be added to the conf file, because - why would we want double administration if the info is already in AD.
So our approach is as follows: We authenticate every domain user by doing the following in tac_plus.conf and then check if the user is in a specific AD group
... default authentication = PAM ...
Check this by restarting the tacacs+ service, if it succeeds you verified your patched tacacs+ version is working
... default authentication = PAM user = DEFAULT { login = PAM before authorization "/etc/tacacs+/authorization.sh '$user'" } ...
the $user is supplied by tacacs+, check the manual for other variables if you'd need them.
#!/bin/bash DOMAIN=YOURDOMAIN TACACSGROUP="your TACACS Group name" WBINFO="wbinfo" userSid=$($WBINFO -n$user |cut -f1) userGroupsSid=$($WBINFO --user-domgroups=$userSid) for i in $userGroupsSid do groupName=$($WBINFO -s $i) # very strange artifect in wbinfo SID->names, there's a trailing '2' if [ "$groupName" = "$DOMAIN\\$TACACSGROUP 2" ] || [ "$groupName" = "$TACACSGROUP 2" ]; then in=$(cat /dev/stdin) echo "$in" echo priv-lvl=15 exit 2 fi done exit 1
Now this example show what you can do if you have 1 group, however nothing stops you from adding more if-statements, and adding appropriate extra attribute-value pairs, like the `echo priv-lvl=15`, shown in the example.
You should read up on the man page for tac_plus.conf under the heading `authorization scripts`. Some notes
Comments
hellomoto
Thu, 07/31/2014 - 00:30
Permalink
awesome
Finally got around doing this myself, thanks for the pointers