apt-get install flex bison libtool gcc-multilib checkinstall
./configure
checkinstall
From the first time to collect will not work, as the compiler will swear at the missing directories. Therefore, create them immediately:
mkdir /home/USER/tacacs-sourse/PROJECTS/build/linux-3.2.0-4-amd64-x86_64 mkdir /home/USER/tacacs-sourse/PROJECTS/build/linux-3.2.0-4-amd64-x86_64/mavis mkdir /usr/local/etc/mavis
tacacs-sourse is the directory where we unpacked the sources.
#!/usr/local/sbin/tac_plus id = spawnd { listen = { port = 49 } ## tacacs 49 } id = tac_plus { accounting log = /var/log/tacacs/tac_plus.log ## (, , ), 600 logrotate mavis module = external ## mavis ( ). , ldap. { exec = /usr/local/lib//mavis/mavis_tacplus_passwd.pl } login backend = mavis ### host = world { welcome banner = "\nWe are watching you! We know your ip: %%c\n" failed authentication banner ="\nYou are the %%u?\n" motd banner = "\nHello %%u. Today is %A!" key = WeryLongAndSequreKey ## address = 0.0.0.0/0 } ### - ... # group = admin { default service = permit service = exec { set priv-lvl = 15 } service = junos-exec { set local-user-name = remote-super-users } # juniper, } # group = noob { default service = deny service = exec { set priv-lvl = 15 } service = junos-exec { set local-user-name = remote-read-only } service = shell { cmd = show { permit .* } cmd = ping { permit .* } cmd = traceroute { permit .* } } } ### ACL , tacacs+. , ACL 192.168.0.5. bad password. acl = noobilo { nas = 192.168.0.5 } ### user = prootik { member = admin login = crypt bla-bla-bla service = shell { set priv-lvl = 15 } } user = noob { acl = noobilo member = noob login = crypt la-la-la service = shell { set priv-lvl = 15 } } }
openssl passwd -1 <clear_text_password> openssl passwd -crypt
tac_plus /etc/tacacs+/tacacs.conf &
71745 ? Ss 0:00 tac_plus: 0 connections, accepting up to 480 more
71746 ? Ss 0:00 tac_plus: 0 connections
71747 ? Ss 0:00 tac_plus: 0 connection
#!/bin/sh # # Start-stop script for tac_plus # # (C)2001-2010 by Marc Huber <Marc.Huber@web.de> # $Id: etc_init.d_tac_plus,v 1.1 2011/07/22 17:04:03 marc Exp $ # # chkconfig: 2345 99 99 # description: Starts and stops the tac_plus server process. # <code>PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin/ export PATH DEFAULT=/etc/default/tacplus-tac_plus PROG=/usr/local/sbin/tac_plus CONF=/etc/tacacs+/tacacs.conf PIDFILE=/var/run/tac_plus.pid NAME=tac_plus [ -f "$DEFAULT" ] && . "$DEFAULT" for FILE in $PROG $CONF ; do if ! [ -f "$FILE" ] ; then echo $FILE does not exist. DIE=1 fi done if [ "$DIE" != "" ] ; then echo Exiting. exit 1 fi start () { /bin/echo -n "Starting $NAME: " if $PROG -bp $PIDFILE $CONF then echo "done." else echo "failed." fi } restart () { PID=`cat $PIDFILE 2>/dev/null` /bin/echo -n "Restarting $NAME: " if [ "x$PID" = "x" ] then echo "failed (service not running)" else kill -1 $PID 2>/dev/null echo "initiated." fi } stop () { PID=`cat $PIDFILE 2>/dev/null` /bin/echo -n "Stopping $NAME: " if [ "x$PID" = "x" ] then echo "failed ($NAME is not running)" else kill -9 $PID 2>/dev/null rm -f $PIDFILE echo "done." fi } case "$1" in stop) stop ;; status) PID=`cat $PIDFILE 2>/dev/null` if [ "x$PID" = "x" ] then echo "$NAME is not running." exit 1 fi if ps -p $PID 2>/dev/null >&2 then echo "$NAME ($PID) is running." exit 0 fi echo "$NAME ($PID) is not running but pid file exists." ;; start|restart|force-reload|reload) if $PROG -P $CONF ;then if [ "$1" = "start" ] then stop 2>/dev/null >&2 start else restart fi else cat <<EOT ******************************************************************************** * Unable to $1 $NAME ... please fix the configuration problem * indicated above. ******************************************************************************** EOT exit 1 fi ;; *) echo "Usage: $0 {start|stop|restart|force-reload|reload|status}" exit 1 ;; esac exit 0
update-rc.d tac_plus defaults
. set system authentication-order tacplus set system authentication-order password set system tacplus-server <ip > port 49 set system tacplus-server <ip > secret WeryLongAndSequreKey set system tacplus-server <ip > timeout 10 set system accounting events login set system accounting events change-log set system accounting events interactive-commands set system accounting destination tacplus server <ip > secret WeryLongAndSequreKey # , juniper / set system login user remote-super-users full-name "User template for remote super-users" uid 2013 class super-user set system login user remote-read-only full-name "User template for remote read-only" uid 2014 class read-only # , : set system login class remote-getconf permissions [ view-configuration configure ] set system login user remote-getconfig full-name "User template for remote getconf" uid 2015 class remote-getconf
Even with tacacs + enabled, you can get to juniper as root. This is done so that you can get into the shell. By tacacs + account, you get right into cli.
Source: https://habr.com/ru/post/194750/
All Articles