We're trying to setup a openvpn server on centos 6.

We have blocked all IP adresses except a couple in a whitelist via /etc/hosts.deny, also we did the same with csf.deny (except for the whitelist).

This block seems to be working, can't reach the machine from a non-whitelisted ip adres by ssh.

However, when we go to the openvpn server from the same non-whitelisted ip (via 943) we can login the web panel.

How can we block all traffic including openvpn from everywhere except for the ips in our whitelist ?

  • 1
    Which protocol does your OpenVPN server use? UDP or TCP? AFAIK, /etc/hosts.deny won't work for UDP. – gf_ Jul 15 '16 at 14:01
  • Just TCP, indeed because UDP doesn't block – DDdW Jul 15 '16 at 15:27
  • Can you post a sample of your hosts.deny – Andrew Case Jul 15 '16 at 21:07

You can use IPTables for it, just set allow rules for your whitelisted IPs and reject all others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.