Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    1

    Default hosts.allow/deny

    Hi,

    I have a problem. I set up Host Access Control (block IP access) to block ALL FTP requests except a couple specific IP addresses.

    But when I try to use FTP client - it would still connect to FTP. Do you know why is this happening? Do I have to reboot the server or something?

    Thank you!

  2. #2
    Member
    Join Date
    Apr 2009
    Posts
    230

    Default

    Quote Originally Posted by investsource View Post
    Hi,

    I have a problem. I set up Host Access Control (block IP access) to block ALL FTP requests except a couple specific IP addresses.

    But when I try to use FTP client - it would still connect to FTP. Do you know why is this happening? Do I have to reboot the server or something?

    Thank you!
    You do not need to reboot the server but you might need to save the rules (service iptables save) / restart the firewall.

  3. #3
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by InstaCarma_Tech View Post
    You do not need to reboot the server but you might need to save the rules (service iptables save) / restart the firewall.
    InstaCarma_Tech, you missed that he's using hosts.allow/deny. These files don't work with all applications, they have to be coded specially to use them and hosts.allow and deny have now been superseded with iptables. I wouldn't recommend using them for anything.

    Unfortunately, you'll have to use iptables to do the job, but the good news is it applies to all applications on the server. You may be able to go to configserver.com and install CSF which is a set of tools that make iptables much, much easier; but do spend the time reading the notes and fine tuning it.

  4. #4
    Member
    Join Date
    Apr 2009
    Posts
    230

    Default

    You are right Brianoz..I missed that. But yeah, what I was suggesting was indeed iptables or a firewall like CSF

  5. #5
    Member votethehost.com's Avatar
    Join Date
    Oct 2009
    Location
    Chicago
    Posts
    27

    Default

    Well, you can do this easily with hosts.allow/deny

    ===========================================
    open /etc/hosts.deny

    and the following line in it

    service_name: ALL
    ===========================================

    The above entry will deny access from all IP's to the specified server EXCEPT the IP's allowed in file /etc/hosts.allow

    Now open /etc/hosts.allow

    and add the following:

    ===========================================
    Open /etc/hosts.allow

    and the following line in it

    service_name: IP here (xx.xx.xx.xx)

    ===========================================
    Doing this the specified service will be blocked for all IP's except the one specified in hosts.allow
    file.

    Hope this helps you

  6. #6
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Exclamation

    Hosts.deny is not the best choice if you went to only block specific services!

    This would be better done with a firewall rule, such as:
    Code:
    # iptables -A INPUT -s ! x.x.x.x -p tcp --dport 21 -j REJECT
    "x.x.x.x" in the above example would be the IP Address or CIDR Range
    that you want to allow to have FTP access and all others are rejected.

    If you forget the "!" above then the logic is reversed and the IP address or CIDR range becomes the specific address(es) you want to block.

Similar Threads & Tags
Similar threads

  1. clear hosts allow/deny script.
    By caeos in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-26-2008, 01:12 PM
  2. hosts.deny not doing a $%^% thing, Any ideas?
    By mygregory in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 12-04-2005, 09:17 AM
  3. BFD and hosts.deny
    By DavidR in forum cPanel Developers
    Replies: 18
    Last Post: 05-18-2005, 10:37 AM
  4. Deny hosts
    By mikelc in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-13-2004, 11:09 AM
  5. hosts.deny
    By h2oski in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-28-2002, 09:23 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube