Two levels of security on SSH for two usage


On my server, I used to use SSH for one single purpose: remote administration. I am the only administrator. Only I have the required credentials to open a remote shell on the server. I use a pair of keys, a strong password and a one-time password, only my personal IP address is allowed to reach the SSH port and the request rate is limited. I used up-to-date algorithms to encrypt my connection.

Now, I would like to use the SSH server for a second purpose: use SFTP to store my password database on my server so that I can “sync” it between my computers and my smartphone. There are a few problems however:

  • Keepass2Android, the only app I know to use my password database on my smartphone cannot work with today’s recommended algorithms. It seems like the library the app use cannot be upgraded on Android, and that there is nothing the developer (let alone myself) can do about it (see here and here). The available algorithms are:
  • Cipher: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
  • MAC: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
  • Host key: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
  • If I want to be able to access my database “on the go” I cannot restrict the incoming connections to my personal IP address anymore.
  • I cannot (and do not want to) use OTP to access my database.

So here is the solution I came with:

  • Regarding my admin user:
    • He is the only one allowed to access shell through SSH.
    • I configured PAM so that only him needs OTP to log in.
    • I make sure that my client always use the recommended algorithms when I open a remote shell.
  • Regarding my SFTP user:
    • He has no shell access (ForceCommand internal-sftp).
    • He is chrooted in his home directory.
    • When connecting from the android app, the used algorithm won’t be the strongest available, but it’s all right because the only data that will be exchanged is my already well encrypted database.
  • Plus :
    • I limit the incoming connection rate on the SSH port
    • I use Fail2Ban to ban any IP which makes too many login attempts for a long time

I have three questions mainly:

  • What do you think about this setup?
  • Can you confirm that allowing weaker algorithms will only affect security by making the data exchange less “secret” when a client actually use it? In other words am I right to think that when my Android app will download/upload the database the exchange will be less secure than usual, but the rest of the time security level doesn’t change? Allowing weaker cipher, MAC or host key algorithm won’t make it easier to hack into my server?
  • Is allowing only these two users with custom settings for each (Match User) the good way to go, or should I go even further by running to sshd instances?

Thank you for your insight!

Flyerjet