问题原文
原帖链接 · Collin · CC BY-SA 4.0
I am currently in the process of setting up and hardening a small VPS running Debian 11. I have already followed this guide, which involves some basic security measures. However, I would additionally like to limit SSH access to my home IP address and perhaps also 1 or 2 more. The issue is that my home IP is liable to change at any time.
Rather than IP addresses, I would like to whitelist one or more hostnames for SSH access. This would allow me to simply update one of my domain's DNS records whenever my home IP changes to restore my access to the VPS.
How can I do this within Debian itself without installing additional packages? Thank you so much.
-Collin
已采纳解答
原帖链接 · asktyagi · CC BY-SA 4.0
Try hosts.deny and hosts.allow file. You can use both ip wild card and as well as dns name wild cards.
#FILE: /etc/hosts.deny(it will deny requests from 192.168.1.* and *.abc.com for ssh)
sshd : 192.168.1. , .abc.com
#FILE: /etc/hosts.allow(it will allow requests from 192.16.1.* and *.myabc.com for ssh)
sshd : 192.16.1. , .myabc.com
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
