Mailing List Archive

pre-post login script (was Re: RANCID's fantastic!)
john heasley wrote:

>What if there were a "pre-login" (and perhaps post-disconnect) script (akin
>to clogin -s), specified/identified by cloginrc? for example,
>
>add loginscript router* {/usr/local/share/cisco-cons.exp}
>add logoutscript router* {/usr/local/share/cisco-cons-disco.exp}
>
>I suspect that both (any) of these would have to meet some expectations of
>*login. I'm not sure exactly what those might be, just a nagging thought
>in the back of the brain.
>
>

The main change as I see it would be required in the logoutscript, since
if I read this correctly, the end of each router.

} else {
label $router
log_user 1
interact
}

# End of for each router
wait
sleep 0.3
}
exit 0

The "interact" ends when the session closes? (i.e., after we might need
to do some bits with the script). Looks straightforward if we're
already running a script (-s), however.

>I believe what afort referred to in his mail was the idea of having a
>"pre-login" command directive in cloginrc. An idea which would be replaced
>by this.
>
>

Yep, that's what I was getting at. The type of hook you suggest sounds
like a better option.

-afort
pre-post login script (was Re: RANCID's fantastic!) [ In reply to ]
Sun, Dec 07, 2003 at 09:41:42PM +1100, Andrew Fort:
> john heasley wrote:
>
> >What if there were a "pre-login" (and perhaps post-disconnect) script (akin
> >to clogin -s), specified/identified by cloginrc? for example,
> >
> >add loginscript router* {/usr/local/share/cisco-cons.exp}
> >add logoutscript router* {/usr/local/share/cisco-cons-disco.exp}
> >
> >I suspect that both (any) of these would have to meet some expectations of
> >*login. I'm not sure exactly what those might be, just a nagging thought
> >in the back of the brain.
> >
> >
>
> The main change as I see it would be required in the logoutscript, since
> if I read this correctly, the end of each router.
>
> } else {
> label $router
> log_user 1
> interact
> }
>
> # End of for each router
> wait
> sleep 0.3
> }
> exit 0
>
> The "interact" ends when the session closes? (i.e., after we might need
> to do some bits with the script). Looks straightforward if we're
> already running a script (-s), however.

Yes. For example, when the user types 'quit' at the device prompt, the
spawned process (telnet, ssh, ...) exits and the interact ends. I do
not know of any other way it would return.

> >I believe what afort referred to in his mail was the idea of having a
> >"pre-login" command directive in cloginrc. An idea which would be replaced
> >by this.
> >
> >
>
> Yep, that's what I was getting at. The type of hook you suggest sounds
> like a better option.
>
> -afort
>