- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ssh - listing of authorized_keys file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 09:38 AM
тАО11-12-2007 09:38 AM
I see that most of the lines in "authorized_keys" end in "root@servername" but not all. Some end in just "root" and some have no eyecatcher at the end.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 09:43 AM
тАО11-12-2007 09:43 AM
Re: ssh - listing of authorized_keys file
At the end of each key is the username@host of the allowed remotes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 10:43 AM
тАО11-12-2007 10:43 AM
Re: ssh - listing of authorized_keys file
the easy answer is to check the knownhosts files in etc and the users home directory(ies). of course, you could not be using the known hosts files, not very wise to do but you can.
and that will only tell you which clients have connected, not which one could.
your sshd could be complied to use other files as the default. the defaults could be overridden by commandline options, or keyword values, etc, etc.
while the authorized keys might end with a user@server, remember the file is editable by the user. so there is no gaurantee that is correct.
your logging (you are doing that aren't you) should tell you where users have logged in from.
of course, with port forwarding, they might really be logging in from a different client
who can can loggin without a password all depends on how you have the authentication setup. if password authentication isn't required then anyone can loggin using the other authentication methods that you allow, public key, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 12:29 PM
тАО11-12-2007 12:29 PM
SolutionSo the lines in authorized_keys do indeed tell what computer is allowed to communicate use ssh to this local system, but it is up to the remote computer's keygen program to create the ending string. So some of the remote computers are not generating the optional user@host string.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 01:19 PM
тАО11-12-2007 01:19 PM
Re: ssh - listing of authorized_keys file
All, I ended up pulling the 3rd parm off the lines in root's id_dsa.pub file to get the list of what other servers can ssh in.
I have some lines with just "root" at the end, not "root@hostname".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 07:35 PM
тАО11-12-2007 07:35 PM
Re: ssh - listing of authorized_keys file
Anyway, the "root@servername" or whatever at the _end_ of the key line is just a comment: it has no meaning at all in determining whether the access is allowed or not, or where the connection is coming from. The private keys can be grabbed from one host and used on another host. If this is done, the comment(s) on the public key(s) on the target server will no longer be up to date. So the best you can do is get some information on where the corresponding private key may have been generated.
Furthermore, anyone handling the public key is free to edit the comment field at will - so if someone wants to put false or incomplete information to the comment field, nothing prevents him/her from doing so.
With SSH keys, unless specified otherwise, the identity of the client host is considered unimportant as long as the proper key is presented. You'll need to examine your firewalls and other forms of access restriction, otherwise all the hosts on the Internet will be on your list of "other servers that can possibly connect to this server".
You can use the 'from="pattern-list"' syntax in authorized_keys file to enforce a limited set of hosts from which a connection is accepted. This list is specified separately for each key, so each key can have a different list of accepted hostname patterns. Options like these go on the _beginning_ of the public key lines in the authorized_keys file. See "man sshd" and read the "AUTHORIZED_KEYS FILE FORMAT" chapter for more information.
If there are no firewalls, it's perfectly possible to snatch a SSH private key from one of your servers, feed it to a SSH client on a BlackBerry and use it to connect from the other side of the country.
If a traditional physical key is lost (or you lose track of people who have a key that fits a particular lock), you'll have to change the lock in case someone malicious now has the key and attempts to use it. If you have a SSH public key in the authorized_keys file and you don't know who has the corresponding private key, you should treat it much the same way.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 08:41 PM
тАО11-12-2007 08:41 PM
Re: ssh - listing of authorized_keys file
If you run a pretty recent version of SSH its ssh-keygen utility's list option can be somewhat exploited if directed at the users' authorized_keys files instead of public keys files.
Some versions may print the fingerprints of each entry along with the comment that usually contains the ssh client's source address.
But this is by far not guaranteed to work,
especially as comments are more or less optional as well as their contents.
e.g.
# awk -F: '{print$6}' /etc/passwd|while read home;do ak=$home/.ssh/authorized_keys;[ -f $ak -a -s $ak ] && ssh-keygen -l -f $ak;done
This could print an easily parseable list of fingerprints.
Anyway, you could use a similar loop and parse the users' authorized keys files instead directly for the trailing comments in each key's line.
This would only mean slightly more effort,
but is also not fool proof.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 08:56 PM
тАО11-12-2007 08:56 PM
Re: ssh - listing of authorized_keys file
Several ideas come to mind.
1)TCP Wrappers. Limit by hostname or IP address. Can be problematic in a DHCP environment.
2) Key only login for root. You can set up ssh to only permit root login if a public key has been placed. id_dsa.pub as authorized_keys. This disables interactive ssh login. I do this on Internet exposed servers. I also leave console login enabled so if there is a problem I can get in via the back door.
< #PermitRootLogin yes
---
> #PermitRootLogin no
> PermitRootLogin without-password
42c43
< #PubkeyAuthentication yes
---
> PubkeyAuthentication yes
106a108
>
Thats the diff output between a standard sshd_config file and the internet exposed system.
PermitRootLogin without-password
You will note that we tried to block root login altogether but this stopped automated file transfer between the secure network and this system which sits in a DMZ
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 09:25 PM
тАО11-12-2007 09:25 PM
Re: ssh - listing of authorized_keys file
Between cluster nodes root logins should still be permitted for automated cluster maintenance (sw distribution, job scheduling, monitoring etc.)
So obviously, no matter how sensible in such a hostile environment usually, PermitRootLogins No obviously was too restrictive.
So I used the AllowUsers directive in sshd_config with an exact list of users and the hosts they come from to restrict ssh logins altogether.
Apart from that the DMZ firewalls should drop all TCP frames to the sshd's listening port which don't originate from legitimate source addresses or belong to established or related connections.
Added to this fencing the bastion host itself
could run a packet filter.
Also, one could have several sshd listening that bind to different IP addresses.
As clusters usually have private inter connect networks for exchange of heartbeat packets one could PermitRootLogins only to the sshd instance that bound to the IC IP,
and PermitRootLogins No to the second sshd that bound to the node's IP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2007 10:20 PM
тАО11-12-2007 10:20 PM
Re: ssh - listing of authorized_keys file
http://www.hpux.ws/?p=19
Better explanation than my post.
Yes the flipping website is back up. Got to be careful not to reassing ownership to mysql database files.
DOH!
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com