Only allow internal password ssh logins, always allow external ssh logins with key

saleetzo

I'm trying to only allow external SSH connections with an ssh key, but allow internal ssh logins with a password. It seems like this is possible but I can't seem to make it work with the options that I am trying.

I thought the following entries in sshd_config would only permit root logins from the listed subnets -- is that wrong? It doesn't seem to work properly.

AllowUsers [email protected].*
AllowUsers [email protected].* 

I'm unable to block the SSH ports on the network firewall since it will block the vendors from logging in with their SSH keys. Too late for me to change the ports to something higher. I basically just want to allow root to login from local IPs and remove the possibility of people attempting to try to ssh to root all day long. IPS rules are helping with that but i'd like to have the piece of mind that external login without a key is never going to work.

Patrick Mevzek

Something like:

AuthenticationMethods publickey
Match Address 192.168.0.0/16
    AuthenticationMethods publickey password

Adapting the IP block to what you need.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to allow unauthenticated logins over ssh on FreeBSD?

From Dev

Allow password authentication in SSH only when there is no key in authorized_keys

From Dev

How to allow SSH only with RSA key, and SFTP with password and chroot?

From Dev

How do I completely disable password ssh logins?

From Dev

Is there a way to have parse allow Facebook Logins?

From Dev

Only allow SSH incoming and outgoing

From Dev

about number of failed ssh logins in ubuntu server

From Dev

lockout local logins on reverse-ssh appliance

From Dev

How can I disable ssh logins for accounts?

From Dev

chain a series of SSH logins and process killing

From Dev

Allow http access only from two selected IPs and get alerts for other attempted logins

From Dev

How do I allow SFTP with a password BUT not SSH?

From Dev

How do I allow SFTP with a password BUT not SSH?

From Dev

How to allow only ssh and internet access with iptables?

From Dev

Only allow one user on system to be SSH'd into

From Dev

Bearer token for external logins

From Dev

SSH with private key always require password

From Dev

How to allow a user ssh using password only if he's using the local network?

From Dev

How to only make one user authenticate via SSH keys and allow password authentication to all others

From Dev

How can I allow SSH password authentication from only certain IP addresses?

From Dev

How to restrict an SSH user to only allow SSH-tunneling?

From Dev

How to Use who/w with Non-Interactive SSH logins

From Dev

allow access to ssh and proftp from LAN and one external IP

From Dev

Allow regular users to SSH using a private key they cannot read

From Dev

Allow a UNIX group access to only a single file through SSH

From Dev

How to only allow access to web server through SSH?

From Dev

How can I allow SSH and SMTP only using IPTables?

From Dev

VirtualBox allow ssh through NAT only after login local user

From Dev

Allow reverse SSH tunnel but not simple SSH

Related Related

  1. 1

    How to allow unauthenticated logins over ssh on FreeBSD?

  2. 2

    Allow password authentication in SSH only when there is no key in authorized_keys

  3. 3

    How to allow SSH only with RSA key, and SFTP with password and chroot?

  4. 4

    How do I completely disable password ssh logins?

  5. 5

    Is there a way to have parse allow Facebook Logins?

  6. 6

    Only allow SSH incoming and outgoing

  7. 7

    about number of failed ssh logins in ubuntu server

  8. 8

    lockout local logins on reverse-ssh appliance

  9. 9

    How can I disable ssh logins for accounts?

  10. 10

    chain a series of SSH logins and process killing

  11. 11

    Allow http access only from two selected IPs and get alerts for other attempted logins

  12. 12

    How do I allow SFTP with a password BUT not SSH?

  13. 13

    How do I allow SFTP with a password BUT not SSH?

  14. 14

    How to allow only ssh and internet access with iptables?

  15. 15

    Only allow one user on system to be SSH'd into

  16. 16

    Bearer token for external logins

  17. 17

    SSH with private key always require password

  18. 18

    How to allow a user ssh using password only if he's using the local network?

  19. 19

    How to only make one user authenticate via SSH keys and allow password authentication to all others

  20. 20

    How can I allow SSH password authentication from only certain IP addresses?

  21. 21

    How to restrict an SSH user to only allow SSH-tunneling?

  22. 22

    How to Use who/w with Non-Interactive SSH logins

  23. 23

    allow access to ssh and proftp from LAN and one external IP

  24. 24

    Allow regular users to SSH using a private key they cannot read

  25. 25

    Allow a UNIX group access to only a single file through SSH

  26. 26

    How to only allow access to web server through SSH?

  27. 27

    How can I allow SSH and SMTP only using IPTables?

  28. 28

    VirtualBox allow ssh through NAT only after login local user

  29. 29

    Allow reverse SSH tunnel but not simple SSH

HotTag

Archive