Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Restricting ssh tunneling on a per-user basis
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Mon Dec 04, 2006 2:08 pm    Post subject: Restricting ssh tunneling on a per-user basis Reply with quote

Does anyone know of a way to configure openssh so that tunneling is restricted to certain users?
Back to top
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Mon Dec 04, 2006 3:45 pm    Post subject: Reply with quote

from the sshd_config man page ...
Quote:

AllowUsers
This keyword can be followed by a list of user name patterns,
separated by spaces. If specified, login is allowed only for
user names that match one of the patterns. `*' and `?' can be
used as wildcards in the patterns. Only user names are valid; a
numerical user ID is not recognized. By default, login is
allowed for all users. If the pattern takes the form USER@HOST
then USER and HOST are separately checked, restricting logins to
particular users from particular hosts.

but perhaps a more reasonable way to do ssh access confrol would be ...

Quote:
AllowGroups
This keyword can be followed by a list of group name patterns,
separated by spaces. If specified, login is allowed only for
users whose primary group or supplementary group list matches one
of the patterns. `*' and `?' can be used as wildcards in the
patterns. Only group names are valid; a numerical group ID is
not recognized. By default, login is allowed for all groups.

then you can just add everyone to the ssh group or whatever you choose to name it.
_________________
Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit!
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Mon Dec 04, 2006 4:57 pm    Post subject: Reply with quote

Thanks for your answer. What I would like to do however, is not just restrict access, but allow access to some users, without allowing them to tunnel, while allowing other users to tunnel.

Perhaps the only way to do this would be with a separate ssh demon (in a chroot env too).
Back to top
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Mon Dec 04, 2006 5:18 pm    Post subject: Reply with quote

Quote:
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server


that's from the end of an old sshd_config i have.

it isn't documented in the man page, but as you can see you can probably match a user or group and allow certain settings for user/group you specify.

try it out! i bet it's just what you're looking for.
_________________
Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit!
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Tue Dec 05, 2006 1:03 pm    Post subject: Reply with quote

sounds great, but doesn't seem to be implemented in my standard version of openssh. I have the following version and USE flags:

Code:
emerge -pv openssh

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ] net-misc/openssh-4.4_p1-r6 [4.3_p2-r1] USE="kerberos pam tcpd -X% -X509 -chroot -hpn -ldap -libedit (-selinux) -skey -smartcard -static (-ipv6%*) (-sftplogging%)" 1,019 kB
Back to top
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Tue Dec 05, 2006 6:21 pm    Post subject: Reply with quote

I don't think that's a problem for you:

Quote:
davey ~ # ssh -v
OpenSSH_4.4p1, OpenSSL 0.9.7i 14 Oct 2005
davey ~ # sshd -v
sshd: illegal option -- v
OpenSSH_4.4p1, OpenSSL 0.9.7i 14 Oct 2005


perhaps yours is too old though. But i think the feature is more likely to be just not documented. It isnt' in all my /etc/ssh/sshd_config files, just an example in this one.

I tried it out - i can use the ForceCommand option in a Match User group to force my user to run 'w' on ssh login like this (it works!)
Quote:
# Example of overriding settings on a per-user basis
Match User dan
ForceCommand w

_________________
Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit!
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Thu Jan 25, 2007 4:13 pm    Post subject: Reply with quote

I just upgraded to openssh 4.5_p1 and now the feature works.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum