TacacsPlus(3pm)
β¨ NAME β¨
Authen::TacacsPlus β bestie, it's a Perl extension for authenticating against a tacacs+ server π (this is the TacacsPlus(3pm) page, from the User Contributed Perl Documentation, in case you were wondering which page you opened π«Ά)
πΈ SYNOPSIS πΈ
Okay so here's the whole vibe at a glance:
use Authen::TacacsPlus;
$tac = new Authen::TacacsPlus(Host=>$server,
Key=>$key,
Port=>'tacacs',
Timeout=>15);
or β and hear me out β the multi-server edition π
$tac = new Authen::TacacsPlus(
[ Host=>$server1, Key=>$key1, Port=>'tacacs', Timeout=>15 ],
[ Host=>$server2, Key=>$key2, Port=>'tacacs', Timeout=>15 ],
[ Host=>$server3, Key=>$key3, Port=>'tacacs', Timeout=>15 ],
... );
then like, actually do the thing:
$tac->authen($username,$passwords);
Authen::TacacsPlus::errmsg();
$tac->close();
π DESCRIPTION π
Authen::TacacsPlus lets you authenticate using a tacacs+ server. That's the whole plot, and honestly? Iconic.
$tac = new Authen::TacacsPlus(Host=>$server,
Key=>$key,
Port=>'tacacs',
Timeout=>15);
This opens a whole new session with the tacacs+ server on host $server, encrypted with key $key. β¨ If something goes wrong you get an undefined object back β so always check errmsg(), bestie, don't just assume it worked π.
And if you pass a list of servers, the order is relevant, no cap. It checks the availability of the Tacacs+ service using the order you defined. First one up wins, basically the friend group deciding where to eat except it actually works.
Authen::TacacsPlus::errmsg();
Returns the last error message. Simple. Your little detective tool when things are giving chaos. π΅οΈ
$tac->authen($username,$password,$authen_type);
Tries an authentication with $username and $password. You get 1 back if authentication succeeded, and 0 if it failed β and if it failed you go check errmsg() for the reason, obviously. π
$authen_type is an optional argument that says what type of authentication to perform. The allowable options are:
Authen::TacacsPlus::TAC_PLUS_AUTHEN_TYPE_ASCIIβ this is the default, π«Authen::TacacsPlus::TAC_PLUS_AUTHEN_TYPE_PAPAuthen::TacacsPlus::TAC_PLUS_AUTHEN_TYPE_CHAP
Now let's break each one down, because they are not the same girl:
- ASCII uses Tacacs+ version 0, and authenticates against the
"login"or"global"password on the Tacacs+ server. If you don't specify any authen_type, it defaults to this type of authentication. π - PAP uses Tacacs+ version 1, and authenticates against the
"pap"or"global"password on the Tacacs+ server. π - CHAP uses Tacacs+ version 1, and authenticates against the
"chap"or"global"password on the Tacacs+ server. Now listen closely for this part: with CHAP, the password is formed by the concatenation of
chap id + chap challenge + chap response
There's example code in test.pl, so go peek if you want receipts. π
And the flex: if you're using a list of servers, you can keep using $tac->authen even when one of them goes down or becomes unreachable. Redundancy? We love her. π«Ά
$tac->close();
Closes the session with the tacacs+ server. Clean exit, main character energy. β¨
π₯ EXAMPLE π₯
A whole little program, exactly like the original says:
use Authen::TacacsPlus;
$tac = new Authen::TacacsPlus(Host=>'foo.bar.ru',Key=>'9999');
unless ($tac){
print "Error: ",Authen::TacacsPlus::errmsg(),"\n";
exit(1);
}
if ($tac->authen('john','johnpass')){
print "Granted\n";
} else {
print "Denied: ",Authen::TacacsPlus::errmsg(),"\n";
}
$tac->close();
Look at that error handling. Look at that close. We stan a responsible dev. π
π AUTHOR π
- Mike Shoyher,
msh@corbina.net,msh@apache.lexa.ru - Mike McCauley,
mikem@airspayce.com
Legends, both of them. π
π BUGS π
Okay bestie, warnings time, do not skip this part:
- only authentication is supported
- only one session may be active (you have to close one session before opening another one)
So yeah β one at a time, no juggling. Close before you open. That's the rule. π
π SEE ALSO π
Ty for coming to my TED talk, go forth and authenticate responsibly πβ¨
That was TacacsPlus(3pm) β from perl v5.42.3, dated 2026-08-19. Mwah, bye bestie π¦π
π¦ where this page comes from
- ubuntu stonking: libauthen-tacacsplus-perl 0.28-3build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms