Networking Forums

Networking Forums > Computer Networking > Linux Networking > ssh vs. scp in custom PAM module

Reply
Thread Tools Display Modes

ssh vs. scp in custom PAM module

 
 
Uwe Drekert
Guest
Posts: n/a

 
      08-31-2009, 09:19 AM
Hi,

- here my question again,
this time with more background detail

- I implement a custom PAM lib

- two linux boxes A and B; B runs an Openssh server
- use case 1: ssh login from A to B
- use case 2: scp files from A to B

- in case of the ssh login I want to give the user an info text
to read; user has to confirm typing "yes";
then, and only then, login is allowed

- the code works, but the side effect is to have to type "yes"
also in case of the scp transfer; which is not wanted and not
possible because of a bunch of automated scp based stuff

---> I have to distinguish inside my custom PAM code;
tried getenv("SSH_CLIENT") / getenv("SSH_TTY"),
but both are "null" at the time I call my custom lib
(latest inside the "auth" section of the config file)

?? any other idea what could be used to differntiate ??

regards,
Uwe
 
Reply With Quote
 
 
 
 
Dag-Erling Smørgrav
Guest
Posts: n/a

 
      08-31-2009, 10:29 AM
Uwe Drekert <(E-Mail Removed)> writes:
> - I implement a custom PAM lib


Define "a custom PAM lib"

> - in case of the ssh login I want to give the user an info text
> to read; user has to confirm typing "yes";
> then, and only then, login is allowed


Did you actually mean "a custom PAM module"?

> - the code works, but the side effect is to have to type "yes"
> also in case of the scp transfer; which is not wanted and not
> possible because of a bunch of automated scp based stuff
>
> ---> I have to distinguish inside my custom PAM code;
> tried getenv("SSH_CLIENT") / getenv("SSH_TTY"),
> but both are "null" at the time I call my custom lib
> (latest inside the "auth" section of the config file)
>
> ?? any other idea what could be used to differntiate ??


You can't - scp basically uses ssh (meaning the ssh program itself) as a
pipe to start and communicate with another scp instance on the server.
It's like running "ssh user@host ls": all sshd knows is that it should
run a certain command instead of opening a pty and forking a shell - and
it doesn't even figure *that* out until *after* authentication is
complete.

You can differentiate on pam_user if you use different users for the
automated transfers. If permissions are an issue, use aliases - i.e.
users with the same UID as other users, like the classic BSD "toor"
user. I would recommend implementing this as module options, so you can
specify which users or groups to include or exclude in pam.conf, instead
of hardcoding them. If you're on a system that uses OpenPAM instead of
Linux-PAM, the openpam_get_option() function makes that very easy;
otherwise, you have to use getopt() or similar to process the argc /
argv you get from the stack.

DES
--
Dag-Erling Smørgrav - (E-Mail Removed)
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BT Doing Its Utmost To Drive Away Custom Java Jive Broadband 42 01-28-2012 04:03 PM
custom nameservers eminhanif@googlemail.com Linux Networking 3 03-30-2009 05:36 PM
IIS Custom FTP Port Rob Windows Networking 1 03-22-2007 12:14 PM
Custom Web Dev design.custom@gmail.com Wireless Internet 0 07-19-2006 06:38 PM
Help with installing a custom netfilter module... TySoft Linux Networking 0 08-04-2003 07:29 PM



1 2 3 4 5 6 7 8 9 10 11