Operating System - HP-UX
1833712 Members
2018 Online
110063 Solutions
New Discussion

wrapper scripts for unsecured protocols?

 
SOLVED
Go to solution
Doug O'Leary
Honored Contributor

wrapper scripts for unsecured protocols?

Hey;

 

I need to put wrapper scripts around rlogin/remsh/rexec, etc, to find the schmucks that are still using them.  Unfortunately, the 'turn it off and see who screams' approach is politically unfeasible.  The wrapper scripts for telnet/ftp work fine; I'm testing the one for rlogin and it's not working.

 

The script is very simple; Effectively, I copy /usr/bin/rlogin to /usr/bin/rlogin.cmd, then put logic into a script in /usr/bin/rlogin to track user, pid, and command line arguments.

 

The script kept coming up with errors and then, when I tried the copied rlogin command directly, I found that the script isn't the source of the problem.

 

when I execute /usr/bin/rlogin.cmd ${host} -l oleary

 

i get a usage error:

Usage: rlogin host [ ex ]  [ -l username ] [ -8 ]

 

I can't be the first guy that's put wrappers around rlogin/remsh, etc.  Anyone know what the secret is?

 

Any help, greatly appreciated.

 

Doug O'Leary


------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
3 REPLIES 3
Patrick Wallek
Honored Contributor
Solution

Re: wrapper scripts for unsecured protocols?

Apparently the remsh and rlogin (and assumably the rcp) commands cannot cope with being renamed.

 

What will work, I just tested it, is to create a directory like /usr/badcmds and make sure the permissions are the same as /usr/bin -- 555) and copy/move the commands to that directory which allows you to keep the original name.

 

Then point your script to /usr/badcmds/rlogin to invoke the real script.

Dennis Handly
Acclaimed Contributor

Re: wrapper scripts for unsecured protocols?

>when I execute /usr/bin/rlogin.cmd ${host} -l oleary

 

It fails for me too.  This makes it obvious.  :-)

rlogin(1) checks to make sure argv[0] has the name rlogin and if something else it assumes that's the host.

See rlogin(1): Remote Host Name As Command

 

It seems it only checks the basename so you can put the real rlogin in another subdirectory.

Doug O'Leary
Honored Contributor

Re: wrapper scripts for unsecured protocols?

Hey;

 

that was it!  Thank you very much, gents!  I'd like to think that I would have gotten to the solution myself eventually; however, these fine people here have me jumping through so many hoops it's hard to think straight.

 

Thanks again.

 

Doug O'Leary


------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html