Hi Robert,
On 08.11.12 08:11, rthl wrote:
> i defined already single-connection, also in the tac_plus.cfg. But I
> didn't understand how to put the configure-command in the context - I
> can configure as cmd - and then?
the TACACS+ protocol itself doesn't know or care about the CLI context
on the router. The daemon just sees the command sequence entered by the
user and sets the context variable accordingly, using the build-in
minimalistic scripting language. To quote the example from the docs:
service = shell {
default cmd = permit
set priv-lvl = 15
script = {
if (cmd == "") permit # shell startup
if (cmd =~ /^interface FastEthernet 0\/1 /) {
message = "Context has been set. \"[no] shut\" should
work for you."
context = FE
permit
} else if (cmd =~ /^interface/){
message = "Context has been reset."
context = ""
permit
}
if (context == FE) {
if (cmd =~ /^shutdown/) permit
if (cmd =~ /^no shutdown/) permit
deny
}
}
cmd = shutdown { deny . }
cmd = no { deny /^shutdown/ }
}
This service definition sets the current CLI session context to "FE" if
Fa0/1 interface context is entered via the CLI ("interface FastEthernet
0/1") and resets context if a different interface gets selected. "(no)
shut" is permitted only if context is set to "FE". The generic "cmd =
shutdown..."/"cmd = no ..." statements are just there to cover the case
where single-connection isn't active.
Cheers,
Marc