Discussion Locked

Closing ports in a Linux Web server

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

When we put nmap, a linux system supplies the port numbers, services name for those known services and unknown for those unknown services.

I would like to know any command or utility to close all the ports for a time and to close some specific ports so that none can access the web server in that particular time.

Thanks

peter@indofuji.soft.net

www.peterindia.com

7 replies

by mckaytech

Well... disconnecting the network cable would pretty much close all the ports. Crude, but effective.

But probably an easier way would be to implement ipchains and just change the firewall rules when you want to take the Web site off-line.

paul

by cybergod

One possible solution is to write a script (shell,perl, etc)which will add and remove a rule in ipchains and you can add it to cron to run at specific time of the day.

by g.j.busser

several answers.
The 1st and easiest, also least secure, is to
replace everything in /etc/hosts.deny with
'All: ALL' (to close everything). Clean out
/etc/hosts.allow too, and add there what you
want to open (example: telnet: 192.168.0.1
opens telnet port (23) for ip 192.168.0.1.
The second is (config and) activate firewall
(ipfwadm/ipchains/iptables, several
scripts/utils available).
The third is clean out all services. And
activate needed ones as and when needed.
The best/most reliable/most secure is all 3.
Of course you then have to edit all 3 to
(re)activate specific services ...

This discussion is closed to new replies.