LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-27-2009, 08:08 AM   #1
smbhat
LQ Newbie
 
Registered: Oct 2008
Posts: 11

Rep: Reputation: 0
is there a way to restrict ssh sessions to a specific ssh client?


Hi,

I am looking at ways in which I can restrict the SSH session requests come by specific SSH client (say Putty or NX Client). Is it possible to restrict SSH client login to a client application?
 
Old 02-27-2009, 09:46 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,685

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by smbhat View Post
Hi,

I am looking at ways in which I can restrict the SSH session requests come by specific SSH client (say Putty or NX Client). Is it possible to restrict SSH client login to a client application?
Specific client? Not that I know of. You can use the AllowUsers directive (see the sshd_config man page here http://linux.die.net/man/5/sshd_config), but there's no real way of detecting the client-type on the other end.
 
Old 02-27-2009, 11:28 AM   #3
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
The only way to do it is to use a custom compiled server and custom compiled client that you wrote specific changes to that have a server expect a specific string when the client connects, that custom client then sends the expected string. Otherwise, no it can not be done.

This is something I have done in the past and it can be done.
 
Old 02-28-2009, 01:21 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Use "AllowUsers <username>" in /etc/ssh/sshd_config.

All other users will be denied, including system users, which is very important.
 
Old 02-28-2009, 07:01 AM   #5
smbhat
LQ Newbie
 
Registered: Oct 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for the responses. I was thinking that there could be directive which will allow me to restrict the user to use a particular SSH client. As Ken replied, probably, I need to customize the sshd and expect a key particular to a ssh client.

Please let me know if there is a simple or better approach than this.

Thanks
 
Old 02-28-2009, 11:21 AM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
You could ensure that only certain clients can authenticate by requiring pubkey authentication (and disallowing all other authentication forms).

Frankly, this is much more secure than saying "only putty users can connect" -- anyone can download putty. It's also a common practice and doesn't require you to fool around with source code (which is a pain to maintain in the long run).
 
Old 03-01-2009, 11:10 AM   #7
smbhat
LQ Newbie
 
Registered: Oct 2008
Posts: 11

Original Poster
Rep: Reputation: 0
I think, I did not make my requirement very clear earlier.

I have developed a web app, which allows my users to connect to a set of Linux box. I want them to connect using the ssh (in my case its NXclient) client that gets launched from the web app using ssh keypair authentication.

However, user can save this key and connect to servers from outside of the web app. Using NX client, certain restrictions are applied for the user, which does not apply when user connects using any other ssh clients.
 
Old 03-01-2009, 11:27 AM   #8
smbhat
LQ Newbie
 
Registered: Oct 2008
Posts: 11

Original Poster
Rep: Reputation: 0
can this be done using iptables? does linux firewall get to know from which client the ssh connect request originated?
 
Old 03-11-2009, 07:36 AM   #9
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
Yes you could restrict it with iptables. SSH will not know about which hosts are trying to connect but iptables will and if the ip matches the rules then it will allow connection to sshd.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH restrict by client version htb Linux - Security 2 10-18-2008 01:21 PM
Unable to restrict SSH sessions through PAM livetoday Linux - Security 3 04-13-2007 01:46 PM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration