Whitelist IP's from cms to iptables or any firewall

Posted May 17, 2016 3.6k views

I have members that only should have access to a server and i want to auth by IP.
So i need to write from a webinterface to my firewall /iptables.

Is there an easy way to write to the firewall?
(Running ubuntu)

  • Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi @gr44bli,

There are a few options for you to be able to do what you’re asking. The first option is of course as you’ve listed, to use an iptables configuration to limit who can connect to your server on port 80. Here’re two tutorials we have on the subject:

An alternative would be to setup permissions within your apache configuration using a .htaccess file. You can see how to do this in one of our other tutorials:

Let us know how it goes, and if you have any further questions!

by Etel Sverdlov
This tutorial covers five common uses for the .htaccess file. These include: Mod_Rewrite, Authentication, Custom Error Pages, Mime Types, and Server Side Includes.

Youtube tutorial of how to whitelist IP address with Digital Ocean’s firewall: