Sudah sekian lama blog ini tidak tersentuh. Sekarang ini mencoba untuk konsisten menulis lagi, mendokumentasikan kerjaan harian, karena semakin lama semakin sering lupa :P. Too much multitasking will kill you haha..
Postingan berikut-berikutnya juga masih sama, catatan mengenai kegiatan, percobaan instalasi, atau apapun yang lebih banyak kerjaan related, IT related.
Yang jelas target saya adalah kembali belajar FreeBSD setelah sekian lama saya tidak update mengenai packagenya yang udah ganti ke pkgng, proses instalasinya yang semakin simple di versi 9 ke atas dan hal lain yg terkait dengan security, webserver dan database server.
Posting baru setelah lama vakum
| Tuesday, March 29, 2016
NFS server di FreeBSD
| Friday, November 22, 2013
- % su
- # ee /etc/exports
- add the following line:
/usr/ports/distfiles -maproot=root 10.10.7.4Start NFS server
- % su
- # rpcbind
- # nfsd -u -t -n 4
- # mountd -r
- % su
- # /etc/rc.d/mountd onereload
- % su
- # showmount -e
Rsync dari remote server ke lokal
| Thursday, November 21, 2013
rsync -Pae "ssh -p 2233" root@10.10.7.25:/var/hosting /dataku/
mengarahkan eth ke vlan pada cisco
cisco | Friday, November 23, 2012
Berikut ini adalah cara untuk menambahkan port 17 pada switch untuk masuk ke vlan2 pada cisco switch catalys
catalyst-ku(config)#interface Fa0/17
catalyst-ku(config-if)#sw
catalyst-ku(config-if)#switchport ac
catalyst-ku(config-if)#switchport access vl
catalyst-ku(config-if)#switchport access vlan 2
Untuk menghilangkan mode trunk ketik perintah berikut :
no switchport mode access
no switchport trunk encapsulation dot1q
php.ini dan httpd.conf
| Tuesday, November 20, 2012
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 128M / 1024M
error_log = php_errors.log
post_max_size = 8M
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
allow_url_fopen = Off
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-include
allow_url_include = Off
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
ServerRoot "/usr/local"
Listen 80
#LoadModule authn_file_module libexec/apache22/mod_authn_file.so
#LoadModule authn_default_module libexec/apache22/mod_authn_default.so
#LoadModule authn_alias_module libexec/apache22/mod_authn_alias.so
#LoadModule cgi_module libexec/apache22/mod_cgi.so
#LoadModule version_module libexec/apache22/mod_version.so
LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so
LoadModule mime_module libexec/apache22/mod_mime.so
LoadModule charset_lite_module libexec/apache22/mod_charset_lite.so
LoadModule ssl_module libexec/apache22/mod_ssl.so
LoadModule authz_host_module libexec/apache22/mod_authz_host.so
LoadModule authz_user_module libexec/apache22/mod_authz_user.so
LoadModule authz_owner_module libexec/apache22/mod_authz_owner.so
LoadModule auth_basic_module libexec/apache22/mod_auth_basic.so
LoadModule include_module libexec/apache22/mod_include.so
LoadModule filter_module libexec/apache22/mod_filter.so
LoadModule deflate_module libexec/apache22/mod_deflate.so
LoadModule log_config_module libexec/apache22/mod_log_config.so
LoadModule logio_module libexec/apache22/mod_logio.so
LoadModule headers_module libexec/apache22/mod_headers.so
LoadModule unique_id_module libexec/apache22/mod_unique_id.so
LoadModule setenvif_module libexec/apache22/mod_setenvif.so
LoadModule autoindex_module libexec/apache22/mod_autoindex.so
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so
LoadModule dir_module libexec/apache22/mod_dir.so
LoadModule alias_module libexec/apache22/mod_alias.so
LoadModule rewrite_module libexec/apache22/mod_rewrite.so
LoadModule php5_module libexec/apache22/libphp5.so
FreeBSD as Router
| Monday, November 05, 2012
Berikut ini tulisan mengenai instalasi freebsd sebagai router.
Setelah melakukan fresh install sesuai http://runia2001.blogspot.com/search?q=instalasi+freebsd. Akan muncul konfirmasi apakah reboot atau melakukan setting. Jangan lgs reboot tapi pilih configure.
Lakukan hal berikut :
1. Ganti root passwd dengan memilih "root password", masukkan password root.
2. Tambah user dengan memilih user management, pastikan group berisi angka 0 atau isi dgn wheel itu artinya user kita setara root / admin
3. Sesuaikan time zone dengan memilih menu "time zone"
4. Pilih networking, centang sshd, centang gateway, pilih interfaces dan masukkan IP untuk mesin tsb.
5. konfigure ttys, beri tanda # dari ttyv3 s/d ttyv7. hal ini akan mematikan console ttyv3 sd 7.
Reboot.
Setelah masuk ke login, masukkan password root dan pastikan bisa ping ke jaringan. Jika sudah bisa di ping dari jaringan maka coba lakukan ssh dari komputer lain, hal ini akan memudahkan instalasi dan configure karena Anda tidak harus berdiam diri dalam ruang server ;).
Migrasi email account dan data dari postfixadmin mysql ke zimbra
| Thursday, October 18, 2012
Hal yang perlu dilakukan untuk migrasi tentu saja instalasi zimbra mailserver. Saya menggunakan OS Ubuntu 10 LTS dgn ZCS 7.2
Langkah berikutnya kurang lebih sbb :
1. List semua domain yg ada pada mailserver lama dan tambahkan domain ke zimbra melalui zimbra admin https://webmai.domain.ltd:7071. Klik pada panel kiri menu configuration klik domain. Klik new tambahkan domain email di server lama klik finish.
2. Eksport email account dari mailserver lama
3. Import email account ke server zimbra
4. Pindahkan data email dari server lama ke server zimbra.
Detailnya sbb :
Point 1 saya kira sudah jelas, point2 selanjutnya penjelasannya sbb :
2. Eksport email account dari mailserver lama
Gunakan script php berikut berikut, sesuaikan login dan nama db email.
Simpan dgn nama misalnya eksport.php dan jalankan dgn perintah php eksport.php
jika berhasil maka akan file exported.sh akan digenerate.
<?php
/////////////////////////////////////////////////////////
$user="Your_mysql_login";
$pass="Your_mysql_pass";
$base="Your_mysql_database";
$tabl="Your_Table_mailbox"; //table
$file="exported.sh";
/////////////////////////////////////////////////////////
echo "Usage: as "zimbra" user on destination server:n";
echo "# sh ./exported.shnn";
echo "";
$mydb = mysql_connect('localhost',$user, $pass) or die ('Error of connection with server');
mysql_select_db($base);
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
$query = "SELECT username,password,name,maildir,quota,domain FROM ".$tabl;
$dane = mysql_query($query) or die ('Error during query for bazy1'.mysql_error());
$handle = fopen($file, "w");
while ($row = mysql_fetch_array($dane, MYSQL_NUM))
{
$StringData = "zmprov ca ".$row[0]." dsfs123hsdyfgbsdgfbsd displayName '".$row[2]."'n";
fwrite($handle, $StringData);
$StringData = "zmprov ma ".$row[0]." userPassword '{crypt}".$row[1]."'"."n";
fwrite($handle, $StringData);
}
?>
3. Import email account ke server zimbra
Copy file exported.sh ke mailserver zimbra, ubah owner filenya jadi milik zimbra dan beri hak akses eksekusi (chmod), ketik : # su - zimbra $ ./home/aku/exported.sh Tunggu sampai proses selesai dan coba cek pada halaman zimbra admin, apakah account sudah masuk atau belum.
4. Pindahkan data email dari server lama ke server zimbra.
Pada mailserver lama email disimpan pada directory /usr/local/virtual. Gunakan perintah scp di server zimbra untuk mengambil semua file.
# cd /usr/local
# scp -r -P 22 root@ipserverlama:/usr/local/virtual .
Tunggu sampai selesai.
Format dari file email sbb /usr/local/virtual/nmdomain/username/...
Setelah selesai proses pengambilan email lewat scp, buat sebuah file dgn nama convertmail.sh yg isinya script sbb :
Tunggu hingga proses selesai, dan coba login ke account anda di mailserver zimbra.
#!/bin/bash # Postfix virtual transport -> Zimbra mailbox migration # written by NERvOus (http://www.nervous.it) - 2009-12-25, Modified By Gigih Forda Nama 2011 # base folder where msgs will be imported BFOLDER="Arsip-Mail" ZMMBOX="/opt/zimbra/bin/zmmailbox" BDIR=$(pwd) echo You must run $0 from inside /var/mail/virtual directory echo $0 expects to find the mailboxes in the current path! echo The structure of maildirs must be as follows: echo echo "domain/username/{cur|new|tmp}" echo "domain/username/subfolder1/{cur|new|tmp}" echo "domain/username/subfolder2/{cur|new|tmp}" echo ... echo echo All folders will be stored in a subfolder called $BFOLDER echo The hierarchy of subfolders will be maintained under $BFOLDER. echo echo Press Enter to start, CTRL+C to abort. read # handle folders with a space inside, they are more common than you may # think IFS=' ' for p in $(find . -type d -name cur); do DOMAIN=`echo $p | cut -d'/' -f2` UNAME=`echo $p | cut -d'/' -f3` DIRNAME=`echo $p | cut -d'/' -f4` # this may fail, if folder already exists. Who cares. Ignore the # error. echo createFolder /$BFOLDER | $ZMMBOX -z -m $UNAME@$DOMAIN if [ "$DIRNAME" == "cur" ]; then echo Importing INBOX folder for $UNAME@$DOMAIN from $BDIR/$DOMAIN/$UNAME/ 1>&2 # we are importing the top level folder echo addMessage /$BFOLDER $BDIR/$DOMAIN/$UNAME/cur | $ZMMBOX -z -m $UNAME@$DOMAIN echo addMessage /$BFOLDER $BDIR/$DOMAIN/$UNAME/new | $ZMMBOX -z -m $UNAME@$DOMAIN else DIRNAME=$(echo $DIRNAME | sed -e 's//cur$//') echo Importing folder $DIRNAME for $UNAME@$DOMAIN from $BDIR/$DOMAIN/$UNAME/$DIRNAME 1>&2 echo createFolder '/$BFOLDER/$DIRNAME' | $ZMMBOX -z -m $UNAME@$DOMAIN echo addMessage '/$BFOLDER/$DIRNAME' '$BDIR/$DOMAIN/$UNAME/$DIRNAME/cur' | $ZMMBOX -z -m $UNAME@$DOMAIN echo addMessage '/$BFOLDER/$DIRNAME' '$BDIR/$DOMAIN/$UNAME/$DIRNAME/new' | $ZMMBOX -z -m $UNAME@$DOMAIN fi done
Script taken from : http://staff.unila.ac.id/gigih/2011/08/04/mail-migration-from-postfix-mysql-to-zimbraldap-backend-again/
Error upload dan install template pada joomla There was an error uploading this file to the server.
| Wednesday, September 19, 2012
Ini nih pengalaman baru, waktu mau ada yg coba install template baru di joomlanya. Ketika upload file template (zip file) dr menu extension manager keluar error kalo upload gagal.
Pertama aku cek sih emang salah path foldernya karena awalnya kan di install di windows terus di pindah ke server unix based.
Nah udah aku benerin, kalo permission file sih aku yakin ga ada masalah. Udah ta buka error info php, disable function juga udah aku kosongi masihh aja belum bisa.. hampir frustasi karena error log ga ada juga.
Sampe aku coba tak chmod 777 saking gemesnya hahah.. tetep ga bisa.
Aku cek php.ini post_max_size udah 8MB nahh file template ini sizenya cmn 2MB lebih dikit. duhhh masih ga bisa juga.
Finally aku cek upload_max_size nahh ini nihh cm 2MB. Kucoba naikkan dan restart webserver.
Alhamdulilahhhh bisaaaaa..... ;)
mengambil baris tertentu dari data dgn awk
| Thursday, September 13, 2012
Sebenarnya bingung dgn judul postingnya, yang jelas saya butuh manipulasi dari data/list yg tampil lewat shell..
Contohnya sbb :
Saya ingin merubah owner banyak directory beserta subnya. Nah ownernya folder saat ini ada milik root sedangkan di server lain beda-beda. Sebagai contoh sbb :
Data awal :
# pwd
/home
# ls (data saya di server A)
drwxr-xr-x 10 a a 4096 2012-03-20 09:04 BACKUP/
drwxr-xr-x 17 b b 4096 2012-03-03 11:35 Image/
drwxr-xr-x 17 c c 4096 2012-03-03 11:35 Image2/
dst..
# Setelah saya copy ke server B ownernya berubah milik root semua
maka saya perlu merubah sesuai list diatas dgn perintah chown
akan tetapi terlalu capek dan ribet kan kalo manual.
So lets begin with the magic of awk
di server A ketik :
# ll | awk '{print "chown -R " $3":"$4,$8}' >> /home/ubahmode
Perintah awk diatas untuk memodif sedikit dari tampilan ls dan menyimpannya pada file di home dgn nama file ubahmode
$3 : artinya ambil data kolom ke 3
":" : menyisipkan tanda petik
Jika selesai tinggal copy file ubahmode ke server B, tambahkan hak eksekusi dgn perintah chmod +x ubahmode
Jalankan dgn perintah sh -x ./ubahmode
;)
Untuk kalimat yg gandeng juga bisa diambil lohh
Misalnya mau ambil text tertentu dari /etc/passwd
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
Nah kalo cuman butuh data user, uid dan hak shellnya bisa pake perintah
more /etc/passwd | awk 'BEGIN {FS=":"};{print $1,$3,$7}'
instalasi dan sinkronisasi file menggunakan rsync dan ssh
| Tuesday, April 24, 2012
Tulisan ini sekaligus update tulisan lama saya. Yang sepertinya kurang lengkap :) Disini misal ada 2 Server 10.10.10.14(server) dan 10.10.10.16(backup/mirror). Dan port ssh 22 Langkah2nya sbb : 1. Masuk ke /home di 10.10.10.16 (server backup) Di directory /home inilah nanti file authentifikasi akan disimpan. Dan perintah rsync dijalankan. 2. Ketik ssh-keygen -f loginku -t rsa dan tekan enter. Pada pilihan passwd langsung tekan enter 2x. Dan akan ada 2 file loginku dan loginku.pub 3. Copykan file loginku.pub ke /root/.ssh pada server utama (10.10.10.14) dan rename menjadi authorized_keys2. hasilnya sbb /root/.ssh/authorized_keys2 4. Sekarang coba login dari server backup masuk ke /home dan ketik : ssh -i loginku root@10.10.7.14 -p 22 Jika berhasil maka tanpa passwd harusnya login bisa dilakukan tanpa password. 5. Perintah rsync sbb : /usr/local/bin/rsync -e "ssh -i loginku -l root -p 22" -avz root@10.10.10.14:/home/coba /home/coba sent 188 bytes received 35168 bytes 70712.00 bytes/sec total size is 42515051 speedup is 1202.48 Nah ada satu tips lagi agar lebih secure. Yaitu hanya mengijinkan root untuk login dari ip 10.10.10.16 (server backup saja). Caranya sbb : 1. Tambahkan baris berikut pada /etc/security/access.conf -:root:ALL EXCEPT 10.10.7.16 Perintah diatas adalah mengijinkan semua user untuk login dr ip manapun kecuali untuk root harus login dari 10.10.7.16 2. Tambahkan baris berikut pada /etc/pam.d/sshd account required pam_access.so
Installasi NFS server di SLES
| Saturday, April 21, 2012
Instalasi NFS server di SLES 11 SP 1 Jika dari yast : # yast2 # pilih network service # pilih NFS # Setting directory, IP NFS client # Finish Jika dari Zypper # zypper install -y nfs-kernel-server # nano /etc/exports /home 10.10.7.1(rw,sync,no_root_squash) atau bisa juga /home/www 10.10.7.1 10.10.7.22 10.10.7.23 *(fsid=0,crossmnt,ro,root_squash,sync,no_subtree_check) Start daemon # /etc/init.d/rpcbind start # /etc/init.d/nfsserver start Edit startup # chkconfig rpcbind on # chkconfig nfsserver on
Apache22 Port di FreeBSD 8.2 Stable
Kemarin setelah update ke FreeBSD stable 8.2 dan CVsup it coz me trouble.
In da middle on installation i got
/usr/ports/www/apache22/work/httpd-2.2.16/support/htpasswd.c:133: undefined reference to `apr_generate_random_bytes'
*** Error code 1
1 error
it made me frustated, after a day search and following instruction from freebsd forum i got nothing. so i assume that maybe something wrong with the port and i have to fix it.
Here is the solution i've found from the inet to fix a broken port.
It works for me .. :)
# Change into the ports directory
cd /usr/ports/
# First fetch ports index
make fetchindex
# Build the ports database
portsdb -u
# Show out of date ports
pkg_version -l "<"
# Upgrade ports
portupgrade -arR
# Check for stale dependencies
pkgdb -F
# Clean out work directories and delete old distfiles
portsclean -CDD _________________
Next...
| Tuesday, November 08, 2011
Ternyata banyak sekali aplikasi di OS yg kupake ini yg sangat berguna
tapi aku belum tahu, dan sekarang sudah tahu tambah bingung..
mau yg mana duluan..
baru coba ngoprek openLDAP kok malah macet..
hikss...
belum lagi HAST untuk clustering storage..
uCARP untuk balancingnya..
Wow..
Wow..
Wowowowow...
Speechless...
mengaktifkan log pada mysql
Buat directory log mysql, misal
mkdir /var/log/mysql
chown mysql:mysql /var/log/mysql
Tambahkan baris berikut pada config file mysql my.cnf
[mysqld_safe]
log-error=/var/log/mysql/error.log
# The MySQL server
[mysqld]
log-error=/var/log/mysql/error.log
restart mysql
Instalasi dan Konfigurasi SYSLOG-NG dengan database MYSQL.
| Saturday, July 02, 2011
SYSLOG-NG adalah daemon yang bisa digunakan untuk menggantikan syslogd di FreeBSD atau di Linux yang berfungsi untuk merekam log2 yang ada, baik itu server berbasis linux, bsd ataupun mikrotik ;)
Dengan SYSLOG-NG yang digabung dengan database MySQL maka kita bisa menyimpan semua log secara terpusat dalam satu database, sehingga mudah untuk di manage.
Untuk Web Interface tampilan log saya memakai php-syslog-ng yg bisa di download di http://php-syslog-ng.googlecode.com/files/php-syslog-ng-2.9.8.tgz
Syaratnya server anda sudah ada webserver support php
# cd /usr/local/www
# fetch http://php-syslog-ng.googlecode.com/files/php-syslog-ng-2.9.8.tgz
# tar -xzvf php-syslog-ng-2.9.8.tgz
# chown -R www:www php-syslog-ng
# edit httpd.conf
Alias /log "/usr/local/www/php-syslog-ng/html/"
Options None
AllowOverride None
Order allow,deny
Allow from all
Jika sudah selesai langsung restart webserver dan akses http://ipserver/log
Akan muncul menu instalasi php-syslog, pastikan fitur2 PHP dan file web sudah sesuai (tidak ada warning) klik next, centang konfirmasi, next.
Isikan user root dan password mysql, nama database yang akan digunakan untuk menyimpan log, dan user untuk database dan password (user dan password ini diingat2 yah, karena untuk
konfigurasi syslog servernya),
Misalkan disini
user mysql : syslog
pass mysql : 123abc
nama db : syslogserv
Hilangkan centang dimenu bawah, klik next. next akan muncul :
URL : http://ipserver/log
site : log/ (ingat belakang harus ada backslash)
email : abc@aaaa.com
passwd : syslogadmin
Klik next, akan muncul user : admin passwd: syslogadmin
Selesaaiiii.. hehe untuk web interface sama database doang hehe..
Selanjutnya install via port :
# cd /usr/ports/sysutils/syslog-ng
# make install clean
# cd /usr/local/etc/syslog-ng/
# cp syslog-ng.conf.sample syslog-ng.conf
options { long_hostnames(off);
sync(0);
use_dns(yes);
use_fqdn(no); };
#
# sources
#
source src { unix-dgram("/var/run/log");
unix-dgram("/var/run/logpriv" perm(0600));
internal(); file("/dev/klog"); };
source netsrc { udp(ip("0.0.0.0") port(514));
tcp(ip("0.0.0.0") port(514)); };
#
# destinations
#
destination messages { file("/var/log/messages"); };
destination security { file("/var/log/security"); };
destination authlog { file("/var/log/auth.log"); };
destination maillog { file("/var/log/maillog"); };
destination lpd-errs { file("/var/log/lpd-errs"); };
destination xferlog { file("/var/log/xferlog"); };
destination cron { file("/var/log/cron"); };
destination debuglog { file("/var/log/debug.log"); };
destination consolelog { file("/var/log/console.log"); };
destination all { file("/var/log/all.log"); };
destination newscrit { file("/var/log/news/news.crit"); };
destination newserr { file("/var/log/news/news.err"); };
destination newsnotice { file("/var/log/news/news.notice"); };
destination slip { file("/var/log/slip.log"); };
destination ppp { file("/var/log/ppp.log"); };
destination console { file("/dev/console"); };
destination allusers { usertty("*"); };
#destination loghost { udp("loghost" port(514)); };
# CISCO Destinations...
destination netlog { file("/var/log/network/$HOST/$YEAR$MONTH$DAY.log" owner(root) group(wheel) perm(0644) create_dirs(yes)); };
destination netsql
{
program("/usr/local/bin/mysql --user=syslog --password=123abc syslogserv < /var/log/mysql.pipe");
pipe ("/var/log/mysql.pipe"
template ("INSERT INTO syslogserv.logs (host, facility, priority, level, tag, datetime, program, msg) VALUES ('$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$ISODATE', '$PROGRAM', '$MESSAGE' );\n")
template_escape(yes));
};
#
# log facility filters
#
filter f_auth { facility(auth); };
filter f_authpriv { facility(authpriv); };
filter f_not_authpriv { not facility(authpriv); };
filter f_console { facility(console); };
filter f_cron { facility(cron); };
filter f_daemon { facility(daemon); };
filter f_ftp { facility(ftp); };
filter f_kern { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_mail { facility(mail); };
filter f_news { facility(news); };
filter f_security { facility(security); };
filter f_user { facility(user); };
filter f_uucp { facility(uucp); };
filter f_local0 { facility(local0); };
filter f_local1 { facility(local1); };
filter f_local2 { facility(local2); };
filter f_local3 { facility(local3); };
filter f_local4 { facility(local4); };
filter f_local5 { facility(local5); };
filter f_local6 { facility(local6); };
filter f_local7 { facility(local7); };
#
# log level filters
#
filter f_emerg { level(emerg); };
filter f_alert { level(alert..emerg); };
filter f_crit { level(crit..emerg); };
filter f_err { level(err..emerg); };
filter f_warning { level(warning..emerg); };
filter f_notice { level(notice..emerg); };
filter f_info { level(info..emerg); };
filter f_debug { level(debug..emerg); };
filter f_is_debug { level(debug); };
#
# program filters
#
filter f_ppp { program("ppp"); };
filter f_slip { program("startslip"); };
#
# host filters
#
# CISCO Filters
filter f_netswitch001 {host("10.1.5.1"); };
filter f_netswitch002 {host("10.1.5.2"); };
filter f_netswitch003 {host("10.1.5.3"); };
filter f_netswitch004 {host("10.1.5.4"); };
filter f_netswitch005 {host("172.16.4.1"); };
filter f_netrouter001 {host("10.1.5.9"); };
filter f_netrouter002 {host("172.16.4.2"); };
filter f_netserver001 {host("server1.example.com"); };
filter f_netserver002 {host("server2.example.com"); };
#
# *.err;kern.warning;auth.notice;mail.crit /dev/console
#
log { source(src); filter(f_err); destination(console); };
log { source(src); filter(f_kern); filter(f_warning); destination(console); };
log { source(src); filter(f_auth); filter(f_notice); destination(console); };
log { source(src); filter(f_mail); filter(f_crit); destination(console); };
#
# *.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
#
log { source(src); filter(f_notice); filter(f_not_authpriv); destination(messages); };
log { source(src); filter(f_kern); filter(f_debug); destination(messages); };
log { source(src); filter(f_lpr); filter(f_info); destination(messages); };
log { source(src); filter(f_mail); filter(f_crit); destination(messages); };
log { source(src); filter(f_news); filter(f_err); destination(messages); };
#
# security.* /var/log/security
#
log { source(src); filter(f_security); destination(security); };
#
# auth.info;authpriv.info /var/log/auth.log
log { source(src); filter(f_auth); filter(f_info); destination(authlog); };
log { source(src); filter(f_authpriv); filter(f_info); destination(authlog); };
#
# mail.info /var/log/maillog
#
log { source(src); filter(f_mail); filter(f_info); destination(maillog); };
#
# lpr.info /var/log/lpd-errs
#
log { source(src); filter(f_lpr); filter(f_info); destination(lpd-errs); };
#
# ftp.info /var/log/xferlog
#
log { source(src); filter(f_ftp); filter(f_info); destination(xferlog); };
#
# cron.* /var/log/cron
#
log { source(src); filter(f_cron); destination(cron); };
#
# *.=debug /var/log/debug.log
#
log { source(src); filter(f_is_debug); destination(debuglog); };
#
# *.emerg *
#
log { source(src); filter(f_emerg); destination(allusers); };
#
# !startslip
# *.* /var/log/slip.log
#
log { source(src); filter(f_slip); destination(slip); };
#
# !ppp
# *.* /var/log/ppp.log
#
log { source(src); filter(f_ppp); destination(ppp); };
#
# CISCO Program Filters
#
log { source(netsrc); destination(netlog); };
log { source(netsrc); destination(netsql); };
taken from : http://www.freebsdwiki.net/index.php/Syslog-NG_Installation#Installation
# mkfifo /var/log/mysql.pipe
# ee /etc/rc.conf
syslogd_enable="NO"
syslog_ng_enable="YES"
syslogd_program="/usr/local/sbin/syslog-ng"
syslogd_flags=""
Setelah saya cek ternyata field yg digenerate oleh php-syslog ada yg kurang jadi silahkan login ke mysql server dan tambahkan sbb :
CREATE TABLE `logs` (
`host` varchar(128) default NULL,
`facility` varchar(10) default NULL,
`priority` varchar(10) default NULL,
`level` varchar(10) default NULL,
`tag` varchar(10) default NULL,
`datetime` datetime default NULL,
`program` varchar(15) default NULL,
`msg` text,
`seq` bigint(20) unsigned NOT NULL auto_increment,
`counter` int(11) NOT NULL default '1',
`fo` datetime default NULL,
`lo` datetime default NULL,
PRIMARY KEY (`seq`),
KEY `host` (`host`),
KEY `program` (`program`),
KEY `datetime` (`datetime`),
KEY `priority` (`priority`),
KEY `facility` (`facility`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
Ok insya Allah sudah finish. Silahkan reboot server anda. Pastikan mysql server jalan dulu baru syslog-ng server.
bersambungg...
Merubah data directory pada mysql server FreeBSD Server
Secara default, jika kita install mysql server via port maka data-data dari database yang ada dalam mysql server akan tersimpan pada dir /var/db/mysql
Akan merepotkan kalau ternyata partisi /var kita terlalu kecil, sehingga data nambah sedikit aja partisi /var udah penuh.
Ada 2 cara untuk mensiasati hal tsb,
pertama ada merubah letak data directory pada file konfigurasi mysql kita my.cnf.
Hal ini memerlukan perubahan pada file konfigurasi my.cnf
# ee /var/db/mysql/my.cnf
[mysqld]
datadir=/data/mysqlbaru
Create directory tempat data baru disimpan
# mkdir /data/mysqlbaru
merubah owner directory tsb menjadi milik mysql
#chown -R mysql:mysql /data/mysqlbaru
kemudian start mysql
# /usr/local/etc/rc.d/mysql-server start
Cara kedua adalah dengan memindah dan melakukan linking directory mysql.
Detailnya sbb :
matikan server :
# /usr/local/etc/rc.d/mysql-server stop
# cd /var/db
pindahkan directory data mysql ke directory baru yang kapasitasnya lebih lega :
# mv mysql /data
lakukan linking directory
# ln -s /data/mysql /var/db/mysql
start server :
# /usr/local/etc/rc.d/mysql-server start
Block http brute force dengan PF
Lumayan ada ilmu baru hasil diskusi dengan admin sebelah dan baca manual PF.
Rulenya sbb :
out_if = bce0
table
pass quick from 10.10.3.0/29
block quick from
pass in on $int_if proto { tcp } from any to 10.10.7.4 port 80 flags S/SA keep state \
(max-src-conn 2, max-src-conn-rate 5/5, overload
Penjelasan sbb :
max-src-conn number
Limit the maximum number of simultaneous TCP connections which have completed the 3-way handshake that a single host can make.
max-src-conn-rate number / interval
Limit the rate of new connections to a certain amount per time interval.
Bagi saya yg awam sulit sekali memahami maksudnya, Hiks..
So dicoba aja testing dengan rule diatas saya coba sebagai berikut :
Saya membuka http://10.10.7.4 di 5 tab firefox dan saya reload dalam waktu bersamaan.Dan halaman masih bisa dibuka.
Akan tetapi jika saya buka 6 halaman http://10.10.7.4 dengan browser berbeda maupun browser yg sama maka saya cek :
# pfctl -t bruteforces -Tshow
10.10.7.1
IP saya terjaring dalam rule tsb.
Kemudian rule coba saya ubah
pass in on $int_if proto { tcp } from any to 10.10.7.4 port 80 flags S/SA keep state \
(max-src-conn 1, max-src-conn-rate 5/5, overload
max-src-conn nya saya set 1 saja.
Saya coba buka http://10.10.7.4 pada 1 tab saja di firefox dan coba buka halaman tsb di chrome.
Alhasil :
# pfctl -t bruteforces -Tshow
10.10.7.1
Saya coba juga buka dengan IP berbeda, ternyata ip ke 2 langsung kena jaring
# pfctl -t bruteforces -Tshow
10.10.7.10
Saya menyimpulkan sbb :
max-src-conn : berapa banyak browser yg akan di launch untuk mengakses web kita ternyata.
Tidak membedakan IP. oh ternyata sekali buka browser dan akses itu dihitung 1 TCP connection hehe..
max-src-conn-rate a/b : dalam b detik berapa a tab yg akan dibuka/direfresh.
ada juga max-src-node : asumsi saya ini melimit berapa banyak ip yg boleh mengakses, tidak disarankan kalau web kita untuk umum.
Membangun Server dari Awal dengan FreeBSD (part1)
1. Optimasi Kernel
Setelah instalasi yg perlu di perhatikan adalah kompile kernel.
Buang device2 yang tidak diperlukan. eth driver, pcmcia dll.
1. DIsable IPv6
2. DISABLE NFS
Untuk option tambahan mgkn bisa ditambahkan pada kernel sbb :
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_FORWARD
options IPFIREWALL_DEFAULT_TO_ACCEPT
options DUMMYNET
options IPFILTER
options IPFILTER_LOG
#### PF OPTION ####
device pf
device pflog
device pfsync
2. Setting SSHD
ee /etc/ssh/sshd.config
Port 1234
Protocol 2
MaxAuthTries 2
MaxSessions 8
PermitRootLogin no
#StrictModes yes
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys
PermitEmptyPasswords no
UseDNS no
Banner none
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
AllowUsers user1
AllowUsers user2
3. Setting TTYS
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none unknown off insecure
#
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
#ttyv3 "/usr/libexec/getty Pc" cons25 on secure
#ttyv4 "/usr/libexec/getty Pc" cons25 on secure
#ttyv5 "/usr/libexec/getty Pc" cons25 on secure
#ttyv6 "/usr/libexec/getty Pc" cons25 on secure
#ttyv7 "/usr/libexec/getty Pc" cons25 on secure
ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
Saran dari Dru Lavigne sbb :
General Hardening Tips
• restricting ssh access using the AllowUsers keyword in / etc/ssh/sshd_config
• using chflags to set the schg flag on system binaries and configuration files that
don't require modifications
• implementing a file integrity checking system such as tripwire
(http:/ /www.tripwire.com), aide (http:/ /www.cs.tut.fi/~rammer /aide.html)or
implementing your own using mtree
• changing /etc/motd removing the COPYRIGHT notice
• subscribing to the FreeBSD security advisories mailing list
(http:/ /lists.freebsd.org/mailman/listinfo/freebsd- security- notifications)
• reviewing mount(8) to see if any options are applicable to your filesystems
• reviewing your sysctl(8) settings; http:/ /sysctl.enderunix.org/ provides some
helpful descriptions
• reviewing your rc.conf(5) settings
Finally, do:
• read root's emails daily and have a log review action plan
General hardening tips from Dru..
security |
does this system really need IPv6 support?
• do I really want NFS (and its inherent security risks) on an Internet facing server?
• should I be loading filesystems I'll never use? (e.g. DOS, CD9660)
• do I need SCSI drivers on a non- SCSI system?
• do I need hardware RAID drivers if I'm using software RAID?
• do I really need to load dozens of NIC drivers if I always buy the same brand of NIC?
• do I need PCMCIA or wireless support on a non- laptop system?
• will I be using USB or Firewire?
KERNEL
1. DIsable IPv6
2. DISABLE NFS
There are many tools available to create a custom backup solution, ranging
built- in FreeBSD utilities to third- party software applications available through
ports collection. In a more complex scenario you may wish to investigate:
• bacula http://www.bacula.org
• rsnapshot http://www.rsnapshot.org
• boxbackup http://www.fluffy.co.uk/boxbackup/
General Hardening Tips
• restricting ssh access using the AllowUsers keyword in / etc/ssh/sshd_config
• using chflags to set the schg flag on system binaries and configuration files that
don't require modifications
• implementing a file integrity checking system such as tripwire
(http:/ /www.tripwire.com), aide (http:/ /www.cs.tut.fi/~rammer /aide.html)or
implementing your own using mtree
• changing /etc/motd , adding an ssh banner, and removing the COPYRIGHT notice
• subscribing to the FreeBSD security advisories mailing list
(http:/ /lists.freebsd.org/mailman/listinfo/freebsd- security- notifications)
• reviewing mount(8) to see if any options are applicable to your filesystems
• reviewing your sysctl(8) settings; http:/ /sysctl.enderunix.org/ provides some
helpful descriptions
• reviewing your rc.conf(5) settings
Finally, do:
• read root's emails daily and have a log review action plan
Lusca/cacheboy
proxy | Thursday, March 03, 2011
Lagi nyoba cacheboy tapi belum berhasil yang Tproxy karena mesinku amd. Googling nemu artikel berikut. Semoga bermanfaat
Diambil dari : http://hikmah-teknologi.blogspot.com/
LUSCA TPROXY on FREEBSD-7-STABLE
patch kernel:
cd /usr/src
fetch http://squid-proxy-pkg.googlecode.com/files/freebsd-tproxy-sys.patch
path -p0 < freebsd-tproxy-sys.patch
di kernel : /sys/i386/conf/PROXY
options IP_NONLOCALBIND
options IPDIVERT
options IPFIREWALL
options IPFIREWALL_NAT
options IPFIREWALL_VERBOSE
options IPFIREWALL_FORWARD
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IP_NONLOCALBIND
options LIBALIAS
#option tunning for squid
options VFS_AIO
options MAXFILES=262144
options MSGMNB=32768
options MSGMNI=82
options MSGSEG=4096
options MSGSSZ=128
options MSGTQL=2048
options SHMSEG=32
options SHMMNI=256
options SHMMAX=4194304
options SHMALL=16384
makeoptions COPTFLAGS="-O2 -pipe -funroll-loops -ffast-math"
makeoptions NO_MODULES=yes
build kernel
cd /usr/src
make buildkernel KERNCONF=PROXY && make installkernel KERNCONF=PROXY
di /etc/sysctl.conf
net.inet.ip.nonlocalok=1
cp /usr/src/sys/netinet/in.h /usr/include/netinet
install squid
pkg_add -v http://squid-proxy-pkg.googlecode.com/files/lusca-with-tproxy-r14371_3.tbz
di /usr/local/etc/squid/squid.conf
http_port XXX.INTERNAL.IP.XXX:3128 transparent tproxy
# em0 -> External interface (to mikrotik)
# em1 -> Internal interface (to client)
di /etc/ipfw.tproxy
ipfw add fwd 192.168.1.1,3128 tcp from 192.168.1.0/24 to any 80 in via em1 # default rule to transparent proxy
ipfw add fwd 192.168.1.1 tcp from any 80 to 192.168.1.0/24 in via em0 # catch the packets that come back using the clients IPs
di rc.conf
gateway_enable="YES"
ifconfig_em0="192.168.0.1 255.255.255.252"
ifconfig_em1="192.168.1.1 255.255.255.0"
firewall_enable="YES"
firewall_script="/etc/ipfw.tproxy"
firewall_type="open"
firewall_logging="YES"
fsck_y_enable="YES"
background_fsck="NO"
squid_enable="YES"
#disini tidak menggunakan bind taoi dnsmasq
dnsmasq_enable="YES"
dnsmasq_flags="--conf-file=/usr/local/etc/dnsmasq.conf"
dan jangan lupa di router paling atas untuk membuat NAT dan static routes utk ip di bawah proxy