Skip to main content

FreeBSD - SSHGuard

http://www.sshguard.net/

SSHGuard adalah salah satu tools yang ada di ports untuk melindungi ssh servis anda dari diserang secara bruteforce. Ia menggunakan sistem log dari syslog untuk mengesan IP yang gagal untuk login ke server.

- Install dari ports

proxy# /usr/ports/security/sshguard-pf
proxy# make install clean

- Konfigurasi PF
shell> nano /etc/pf.conf


#di bahagian table
table "" persist #sila buang "", <> tak boleh :P

#bahagian block rules
block in quick on $ext_if proto tcp from to any port 22 label "ssh bruteforce"

- Aktifkan rules pf yang baru
shell> pfctl -ef /etc/pf.conf

- Edit /etc/syslog.conf
uncomment line yang berkenaan sshguard

proxy# nano /etc/syslog.conf
GNU nano 2.0.9 File: /etc/syslog.conf


# $FreeBSD: src/etc/syslog.conf,v 1.28.20.1 2009/04/15 03:14:26 kensmith Exp $
#
# Spaces ARE valid field separators in this file. However,
# other *nix-like systems still insist on using tabs as field
# separators. If you are sharing this file between systems, you
# may want to use only tabs as field separators here.
# Consult the syslog.conf(5) manpage.
auth.info;authpriv.info |exec /usr/local/sbin/sshguard
*.err;kern.warning;auth.notice;mail.crit /dev/console
*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
security.* /var/log/security
auth.info;authpriv.info /var/log/auth.log
mail.info /var/log/maillog
lpr.info /var/log/lpd-errs
ftp.info /var/log/xferlog
cron.* /var/log/cron
*.=debug /var/log/debug.log
*.emerg *
# uncomment this to log all writes to /dev/console to /var/log/console.log
#console.info /var/log/console.log
# uncomment this to enable logging of all log messages to /var/log/all.log
# touch /var/log/all.log and chmod it to mode 600 before it will work
#*.* /var/log/all.log
# uncomment this to enable logging to a remote loghost named loghost
#*.* @loghost
# uncomment these if you're running inn
# news.crit /var/log/news/news.crit
# news.err /var/log/news/news.err
# news.notice /var/log/news/news.notice
!startslip
*.* /var/log/slip.log
!ppp
*.* /var/log/ppp.log

- Aktifkan konfigurasi syslog yang baru

shell> /etc/rc.d/syslogd reload

- Untuk mencuba sila login dengan username yang salah secara berturut menggunakan host yang berlainan dari pc anda yang remote secara terus ke server, ia bagi mengelakkan pc anda di block terus dan tidak dapat diakses sama sekali.

- Untuk melihat table PF bagi IP yang sudah di block, boleh menggunakan pfctl

shell> pfctl -Ts how -t sshguard
No ALTQ support in kernel
ALTQ related functions disabled
200.200.200.199

- Untuk delete IP yang diblock boleh juga menggunakan pfctl

shell> pfctl -t sshguard -T delete 200.200.200.119

Comments

Popular posts from this blog

Building a KVM Proxy

Traditionally we seldomly connect our KVM from the port directly to the server that consists of usb for keyboard and mouse, vga cable for display purposes. More advanced you may have an experience using the iKVM which connect all you kvm port from the internet where you can have a remote location as long as you have the internet connection. When technology evolve, physical server are becoming obsolete since we have the virtualization technology. Since that to access your virtual machine (vm) are more easier. Instead of using SSH, like a Xen hypervisor, the Xen itself can host as a KVM server and map to the vm on different port as configured from the config file.

Warning Nuffnanger's!

Dear Nuffnangers, As you might already know, there are 2 different types of campaigns from Nuffnang: Metered (mCPM) Campaigns , which pay according to the number of visitors who see the ads; and Cost-Per-Click (CPC) campaigns, which pay bloggers based on the number of clicks generated on the ads. It has come to our attention that certain groups have been committing click fraud, which is defined as clicking on CPC advertisements intentionally just to generate earnings for a blog's owner. Do note that this act is an abuse of our Terms & Conditions under Section 6. Banner ads are only supposed to be clicked on if the viewer is interested to find out more about the advertising campaign, and not for the intention of earning extra money. Should this situation worsen, the frequency of ad campaigns might be significantly reduced as we'll only be able to sell ad spaces on blogs with no click fraud record. Our system is capable of tracking these illegal actions...

Python - Xen and libvirt

more function can be found in python dir libvirtclass.txt shell> find / -name libvirtclass.txt Generated Classes for libvir-python # # Global functions of the module # # functions from module libvirt open() openReadOnly() virEventRegisterImpl() virInitialize() # functions from module virterror virGetLastError() virResetLastError() # # Set of classes of the module # Class virDomain()     # functions from module libvirt     ID()     OSType()     XMLDesc()     attachDevice()     blockPeek()     connect()     coreDump()     create()     destroy()     detachDevice()     maxMemory()     maxVcpus()     memoryPeek() migrate()     name()     reboot()     ref()     resume()  ...