In order to simplify administration, I've used a single user for all clients, and called it
"portier" (a word used in German for the guy watching the door of a hotel or bureau buildings). This has the following benefits:
*) Only one system user to administer.
*) No password, so no one can brute-force it, and...
*) ... because you only use public/private keys, you can disable client accounts on the server side, which is great if someone has lost their key, or you simply don't want them to connect anymore.
That user should have no rights on the system, except being allowed to connect per SSH. It doesn't even require (or should have) a shell set in /etc/passwdHere's an example:
Code:
portier:x:1000:100::/home/portier:
Additionally, you should disable its password by putting an "x" instead of its password hash in /etc/shadow:
Code:
portier:x:12800:0:99999:7:::
Since all clients are using the same system user, you have to add their public keys to its
~/.ssh/authorized_keys file.
The first and important entry should be for a so called "connection test" key, which is used directly in the installer:
Code:
command="/home/portier/logon",environment="SSH_KEY=ConnectionTest",permitopen="0.0.0.255:65535",no-pty ssh-rsa XXXXXXXXXSSH_PUBLIC_KEY_DATAXXXXXXXX= ConnectionTest
So, for each user you need to add such a line with their public key - and the same settings as the one above. You need to change the value for "SSH_KEY" - The easiest way is to simply use the comment string from the SSH key as identification string.
Here's an example of another user:
Code:
command="/home/portier/logon",environment="SSH_KEY=My_Mom",permitopen="0.0.0.255:65535",no-pty ssh-rsa XXXXXXXXXSSH_PUBLIC_KEY_DATAXXXXXXXX= My_Mom
Here is a detailed explanation of these settings:
command="/home/portier/logon": Execute that script on logon of the portier user. This prevents users from being able to execute commands per SSH - and it is also used to log connections to a customized logfile, and provide the user feedback upon a successful connection.
environment="SSH_KEY=ConnTest"
Stores a string in the environment variable "SSH_KEY". I'm using this to identify which key is currently connected. Very useful for later processing in the logon script.
permitopen="0.0.0.255:65535"
This prevents the client to request ports on our side to be mapped, since that would pose a real ugly security threat.
no-pty
This simply tells SSH to *not* give the user a shell at all. Possibly saving us further trouble.
