How to install GotRoot ModSecurity Rules

Make sure you have at least version 2.6.1 of modsecurity installed. Cpanel includes its own modsecurity configuration files and its own modsecurity module. To install gotroot modsecurity rules for the first time you will need to do the following:

  1. Download the Free Delayed/Unsupported feed here. Keep in mind the Delayed feed is released 90 days after the realtime feed (that includes any fixes).
  2. Unpack the rules in /usr/local/apache/conf/
  3. Create the following directories and chmod them accordingly:

    mkdir /var/asl
    mkdir /var/asl/data/
    mkdir /var/asl/data/msa
    mkdir /var/asl/data/audit
    mkdir /var/asl/data/suspicious
    chown nobody.nobody /var/asl/data/msa
    chown nobody.nobody /var/asl/data/audit
    chown nobody.nobody /var/asl/data/suspicious
    chmod o-rx -R /var/asl/data/*
    chmod ug+rwx -R /var/asl/data/*

    you will never need to use these directories but they have to be present for the rules to work.

  4. Read the rest of this entry »

How to restore Incremental backup on cPanel Machine

Most of you got the Incremental backup located at ‘/backup’ so if you are not the one of those please modify the value of ‘/backup’ path to the correct path.

Step 1) Taring the backup folder

/usr/local/cpanel/bin/cpuwatch 4.0 tar -czf /home/user.tar.gz /backup/cpbackup/daily/user

* /usr/local/cpanel/bin/cpuwatc is used to monitor the cpu load. If the load goes past the set limit, it will stop the application and resume it after the load averages are below the threshold for a few seconds

Step 2) Restoring the backup

/scripts/restorepkg user

** Modify ‘user’ to your correct user value

Never Delete Any Files From /home/virtfs/

/home/virtfs folder is used to chroot the user into jailed shell. Cpanel will hard link files into this directory so deleting files in /home/virtfs will also delete the files on the server in the actual location. (example: rm /home/virtfs/user/etc/exim.pl will delete /etc/exim.pl)

If a user is reporting double the quota and it is from /home/virtfs then we need to umount or kill and hanging jailshell process. To do this run

ps aufx |grep user |grep jailshell

If there are no jailshell processes then run

cat /proc/mounts

It will show,
/dev/root /home/virtfs/user/lib ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/lib ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/sbin ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/share ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/bin ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/man ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/X11R6 ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/kerberos ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/libexec ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/local/bin ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/local/share ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/local/Zend ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/include ext3 rw,data=ordered,usrquota 0 0
/dev/sda2 /home/virtfs/user/usr/local/lib ext3 rw,data=ordered,usrquota 0 0
/dev/sda3 /home/virtfs/user/var/spool ext3 rw,noatime,nodiratime,data=ordered,usrquota 0 0
/dev/sda3 /home/virtfs/user/var/lib ext3 rw,noatime,nodiratime,data=ordered,usrquota 0 0
/dev/sda3 /home/virtfs/user/var/run ext3 rw,noatime,nodiratime,data=ordered,usrquota 0 0
/dev/sda3 /home/virtfs/user/var/log ext3 rw,noatime,nodiratime,data=ordered,usrquota 0 0
/dev/sda6 /home/virtfs/user/tmp ext3 rw,nosuid,nodev,noexec,data=ordered 0 0
/dev/root /home/virtfs/userbin ext3 rw,data=ordered,usrquota 0 0

You will need to unmount each of these by running
umount /home/virtfs/user/tmp and so on

You can also run

for i in `cat /proc/mounts |grep virtfs |grep user |awk ‘{print$2}’`; do umount $i; done

Make sure to replace user with the cpanel username in the above command. This will then clear up the files in /home/virtfs and the quota should return to normal.

Secure FTP menggunakan Filezilla

Untuk menjamin keamanan selama transfer data via FTP silakan gunakan SFTP ketika akses ke server via FTP.

Step 1: Klik File
Step 2: Klik “New Site” dan beri nama koneksi anda
Step 3: Masukkan nama domain atau Ip address
Step 4: Pilih server type “SFTP”
Step 5: Pilih login type “Normal”
Step 6: Masukkan username dan password akun FTP
Step 7: Klik Connect

Untuk memastikan bahwa anda sedang terkoneksi via SFTP, akan muncul tampilan “initializing SFTP connection” pada jendela Filezilla dan terlihat gambar ‘kunci gembok’ pada status bar FileZilla seperti gambar di bawah ini.

Mengcopy data besar tetapi space tidak mencukupi

Berikut ini adalah tips mengcopy data dari server1 ke server2 dengan mengkompres terlebih dahulu data di server1 tetapi space sudah tidak mencukupi

server1# tar zcf – /backup | ssh root@server2 cat > /server1/backup.tgz

perintah di atas akan melakukan kompresi terhadap data di folder /backup  tanpa terlebih dahulu disimpan di local disk tetapi langsung dicopy ke server2 yang memiliki space yang mencukupi, dengan demikian space yang kurang di server1 tidak menjadi masalah.