Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2010
    Posts
    647

    How to block an ip from accessing my vps ?

    My host had some firewall installed not sure what it is, I guess its CSF. I'd returned today after a short trip to find out, there were at least 45 Hack Attempts were made by some user to get into my script Admin panel, with in 3 days. All the attempts were made by a single ip address. I'm not sure whether revealing the ip address on wht is according to WHT rules or not, so I've posted it over here.

    I would like to know, is there a way I can block this ip from even accessing my VPS ? I'm pretty much a noob with Linux & SSH, so kindly do lemme know in simple steps how can I block this particular notorious user's ip.

  2. #2
    Join Date
    Dec 2005
    Posts
    3,110
    If you have a firewall such as CSF installed, there is an anti-bruteforce element (LFD) which should automatically pick up on this activity.

    Here are some examples on how you can block an IP from SSH

    CSF Firewall:

    csf -d xx.xx.xx.xx

    APF Firewall:

    apf -d xx.xx.xx.xx

    IPTables (If you have no firewall):

    iptables -I INPUT -s xx.xx.xx.xx -j DROP

    Then iptables-save >> /etc/sysconfig/iptables will ensure it survives a reboot. That assumes you are on RedHat/CentOS, the configuration location may be slightly different on other distro's.

  3. #3
    Join Date
    Nov 2001
    Location
    Ashburn, VA
    Posts
    1,207
    If you are in fact using CSF, just do the following from the shell.

    csf -d IPADDRESS
    There are many other methods that could be used as well if you aren't running CSF.
    Affordable web hosting, design, & domain registration services since 2001
    www.serve-you.net

  4. #4
    Join Date
    Oct 2010
    Posts
    647
    Thanks friends for the assistance

    Is there a way I can find out which firewall I'm using by running any specific command ?

  5. #5
    Join Date
    May 2012
    Location
    Linux World
    Posts
    1,137
    check the init scripts ls /etc/init.d/* and see if csf/apf is there or do a ps aux |egrep 'csf|apf' , or do a 'which csf; which apf'
    Kevin Cheri : Senior Server Administrator / Freelancer : 13+ years Exp, reach me out for any help
    Server Optimization Expert / Mysql Guru / Migration Specialist
    Skype : lynxmaestro
    Gmail : cheri.kevin@gmail.com

  6. #6
    Join Date
    May 2013
    Location
    India
    Posts
    747
    just type csf and click enter in the command prompt. If csf is installed you will get the list of options that you can use with csf. If not try apf and iptables will be there by default.

    But I suggest you to get csf installed as you can use it from WHM also

  7. #7
    Check in /etc folder also. If CSF is installed then there will be a folder like /etc/csf. Actually, CSF works on top of iptables, so it is a better idea to use CSF as a firewall and if you have cPanel/WHM installed then you will get an option of plugin of CSF which makes it easy to manage via WHM.

  8. #8
    Join Date
    Oct 2010
    Posts
    647
    Thanks for your help friends CSF was disabled for some reason, I had to enable it & I've added the necessary ip to the block list

    Really appreciate each & everyone of you, for ur time in helping me out

Similar Threads

  1. how to block some IPs from accessing my site?
    By bhatmahesht in forum Hosting Security and Technology
    Replies: 11
    Last Post: 11-24-2012, 10:33 AM
  2. Challenge: Block all IP addresses except one from accessing server.
    By StackHost in forum Hosting Security and Technology
    Replies: 1
    Last Post: 01-28-2007, 02:43 AM
  3. How to block countries from accessing my site
    By superprogram in forum Hosting Security and Technology
    Replies: 7
    Last Post: 12-12-2004, 05:38 PM
  4. Block the whole country from accessing server
    By Shin Asuka in forum Hosting Security and Technology
    Replies: 10
    Last Post: 11-20-2004, 04:54 AM
  5. How to block an IP from accessing the server?
    By ymfm in forum Hosting Security and Technology
    Replies: 4
    Last Post: 05-11-2004, 05:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •