What is the correct way to set up a VPN and then only allowing SSH from that VPN? I want to set this up to remove my SSH from the open internet and only allow access via a dedicated VPN connection, I'm just not 100% sure how to implement everything.
-
What steps have you taken so far?– RevulaiAug 21, 2015 at 21:26
-
So far I have verified that I need to remove SSH from the open internet, and need to only allow connections through said VPN. I'm not really 100% sure where to start, so I came here to get some advice in how to start said implementation. Thanks for the comment!– user84051Aug 21, 2015 at 21:28
-
I guess the good start would be chroot, if you want to ban all the other unix tools.– JakujeAug 21, 2015 at 22:00
-
What sort of VPN? OpenVPN? IPSec? Something else?– MadHatterAug 22, 2015 at 14:47
Add a comment
|
2 Answers
edit sshd_config
located in /etc/ssh/sshd_config
and add this line at the bottom :
AllowUsers root@YOUR_VPN_IP
This allows you to log in to SSH as the root user from your IP.
Don't forget to restart ssh service
:
service sshd restart
Or set up iptables rules to allow inbound ssh only over VPN interface/IP and deny in other if's.