Memaparkan catatan dengan label Unix. Papar semua catatan
Memaparkan catatan dengan label Unix. Papar semua catatan

Rabu, 14 September 2011

Id "x" respawning too fast: disabled for 5 minutes

Hi, recently i found that my server show the following error:-

Id "x" respawning too fast: disabled for 5 minutes

I noticed this message appeared after I removed the gdm package.
To solve the above error i just disable the x:5:respawn:/etc/X11/prefdm - nodaemon

or you can set x:5:respawn:/etc/X11/prefdm - /dev/null

to test please insert telinit q to re-read the inifile

the errror message will stop.

done.

Configure SMTP mail client on Centos

vim /etc/sysconfig/sendmail

modify line DAEMON=yes to DAEMON=no

save and close.


vim /etc/mail/submit.cf

modify line D{MTAhost}[127.0.0.1] to D{MTAhost}[your.smtp.ip.address]

restart sendmail service service sendmail restart

try send the email.

done.

Khamis, 12 Mei 2011

Keep your linux box up to date

Gua noticed yang default version of yum-updatesd does not function reliably. So gua cari better solution to make sure centos box gua updated. So untuk memastikan server gua always on up to date gua lebih prefer guna kan cron.. Steps seperti berikut:-


1. Disable yum-updatesd:-



/sbin/chkconfig yum-updatesd off



2. Create yum.cron and make it executeble dan letakkan dia di folder /etc/cron.daily ataupun /etc/cron.weekly. Didalam file yum.cron itu masukan line seperti berikut:-



#!/bin/sh
/usr/bin/yum -R 120 -e 0 -d 0 -y update yum
/usr/bin/yum -R 10 -e -0 -d 0 -y update

Rabu, 19 Januari 2011

Remove Squid footer completely

Removing the version number from the footer is very easy.

In squid.conf enable
httpd_suppress_version_string

But what if you want to remove the whole message.
Generated Thu, 08 Jun 2000 06:58:30 GMT by proxy1.proxy.com (Squid/2.6.STABLE1)

There is no configuration available to remove it but you can always edit the source file for that and recompile it. Don't worry its very easy. Easy because its really easy.

Just follow the following steps:
Go to squid source. /usr/src/squid/src
Backup the existing file errorpage.c cp ./errorpage.c ./errorpage.c.bkp
Remove errorpage.o rm errorpage.o
Edit the file errorpage.c vim errorpage.c
{
ERR_SQUID_SIGNATURE,
"\n<\BR clear=\"all\">\n"
"<\HR noshade size=\"1px\">\n"
"
\n"
"Generated %T by %h (%s)\n"
"
\n"
"<\/BODY><\/HTML>\n"
}
Remove the line "Generated %T by %h (%s)\n"
Save and exit :wq
Reconfigure squid with old options ./configure .........
Make clean make clean
Make make
Make all make all
Make install make install
Stop squid /usr/local/squid/sbin/squid -k shutdown
Start squid /usr/local/squid/sbin

Selasa, 28 September 2010

fw.proxy scripts

#!/bin/sh
# squid server IP
SQUID_SERVER="192.168.1.1"
# Interface connected to Internet
INTERNET="eth0"
# Interface connected to LAN
LAN_IN="eth1"
# Squid port
SQUID_PORT="3128"
# DO NOT MODIFY BELOW
# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Load IPTABLES modules for NAT and IP conntrack support
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# For win xp ftp client
#modprobe ip_nat_ftp
echo 1 > /proc/sys/net/ipv4/ip_forward
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
# Unlimited access to loop back
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT
# set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE
iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT
# unlimited access to LAN
iptables -A INPUT -i $LAN_IN -j ACCEPT
iptables -A OUTPUT -o $LAN_IN -j ACCEPT
# DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy
iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$SQUID_PORT
# if it is same system
iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j REDIRECT --to-port $SQUID_PORT
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP

Isnin, 27 September 2010

Squid hostname error

[root@sawi squid]# less /var/log/squid/squid.out
[root@sawi squid]# vim squid.conf
[root@sawi squid]# service squid start
init_cache_dir /var/spool/squid... /etc/init.d/squid: line 62: 13530 Aborted $SQUID -z -F -D >> /var/log/squid/squid.out 2>&1
Starting squid: /etc/init.d/squid: line 42: 13532 Aborted $SQUID $SQUID_OPTS >> /var/log/squid/squid.out 2>&1
[FAILED]
---------------------------------------------------------------------
#add below line for above error

visible_hostname [your_hostname]

Selasa, 29 Disember 2009

Auto reboot if kernel panic

## Secara defaultnya linux tidak akan reboot sekiranya berlaku kernel panic. Jika untuk reboot linux sekiranya berlaku kernel panic ikut langkah2 dibawah:

vim /etc/sysctl.conf

## kemudian masukkan baris dibawah kedalam config file yang sedia ada.

kernel.panic = 15

Khamis, 3 Disember 2009

Memeriksa proses yang tidak sepatutnya

## Fikirkan apa akan terjadi sekiranya box anda diserang penggodam yang tidak diingin dan mereka telah running beberapa application yang boleh memperlahankan proses CPU anda. Senario ini juga sering berlaku di mana2 server, terutama sekali yang sering menjadi sasaran penggodam adalah web server hosting..

## Jadi untuk mengenal pasti service yang tidak di run oleh anda. Maka masukkan arahan serperti dibawah:

[root@ketutu ~]# ps aux | grep -v 'whoami'
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2140 632 ? Ss Nov23 0:01 init [5]
root 2 0.0 0.0 0 0 ? S Nov23 0:00 [migration/0]
root 3 0.0 0.0 0 0 ? SN Nov23 0:00 [ksoftirqd/0]
root 4 0.0 0.0 0 0 ? S Nov23 0:00 [watchdog/0]
root 5 0.0 0.0 0 0 ? S Nov23 0:00 [migration/1]
root 6 0.0 0.0 0 0 ? SN Nov23 0:00 [ksoftirqd/1]
root 7 0.0 0.0 0 0 ? S Nov23 0:00 [watchdog/1]
root 8 0.0 0.0 0 0 ? S< Nov23 0:00 [events/0]
root 9 0.0 0.0 0 0 ? S< Nov23 0:00 [events/1]
root 10 0.0 0.0 0 0 ? S< Nov23 0:00 [khelper]

## Cara arahan diatas mungkin akan memeningkan kepala anda untuk memeriksa satu persatu senarai proses yang sedang running. Untuk menjadi lebih bijak, kenapa tidak list 10 senarai yang prosesnya membazir sahaja..


[root@ketutu ~]# ps aux --sort=%cpu | grep -m 11 -v 'whoami'
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 4 0.0 0.0 0 0 ? S Nov23 0:00 [watchdog/0]
root 6 0.0 0.0 0 0 ? SN Nov23 0:00 [ksoftirqd/1]
root 7 0.0 0.0 0 0 ? S Nov23 0:00 [watchdog/1]
root 8 0.0 0.0 0 0 ? S< Nov23 0:00 [events/0]
root 9 0.0 0.0 0 0 ? S< Nov23 0:00 [events/1]
root 10 0.0 0.0 0 0 ? S< Nov23 0:00 [khelper]
root 11 0.0 0.0 0 0 ? S< Nov23 0:00 [kthread]
root 51 0.0 0.0 0 0 ? S< Nov23 0:00 [kblockd/0]
root 52 0.0 0.0 0 0 ? S< Nov23 0:00 [kblockd/1]
root 53 0.0 0.0 0 0 ? S< Nov23 0:00 [kacpid]

Rabu, 19 Ogos 2009

not infected?

Saya tidak berapa yakin dgn tools chkrootkit yang saya gunakan untuk mengesan aktiviti godam pada pelayan-pelayan saya. Oleh itu sebagai langkah lain saya juga memasang rkhunter pada setiap pelayan saya dan ternyata saya lebih senang menggunakan rkhunter berbanding chkrootkit kerana rkhunter mengimbas dengan lebih detail dan siap dengan report.


ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
Checking `cron'... not infected
Checking `crontab'... not infected
Checking `date'... not infected
Checking `du'... not infected
Checking `dirname'... not infected
Checking `echo'... not infected
Checking `egrep'... not infected
Checking `env'... not infected
Checking `find'... not infected
Checking `fingerd'... not found
Checking `gpm'... not infected
Checking `grep'... not infected
Checking `hdparm'... not infected
Checking `su'... not infected
Checking `ifconfig'... not infected
Checking `inetd'... not tested
Checking `inetdconf'... not found
Checking `identd'... not found
Checking `init'... not infected
Checking `killall'... not infected
Checking `ldsopreload'... not infected
Checking `login'... not infected
Checking `ls'... not infected
Checking `lsof'... not infected
Checking `mail'... not infected
Checking `mingetty'... not infected
Checking `netstat'... not infected
Checking `named'... not infected
Checking `passwd'... not infected
Checking `pidof'... not infected
Checking `pop2'... not found
Checking `pop3'... not found
Checking `ps'... not infected
Checking `pstree'... not infected
Checking `rpcinfo'... not infected
Checking `rlogind'... not found
Checking `rshd'... not found
Checking `slogin'... not infected
Checking `sendmail'... not infected
Checking `sshd'... not infected
Checking `syslogd'... not infected
Checking `tar'... not infected
Checking `tcpd'... not infected
Checking `tcpdump'... not infected
Checking `top'... not infected
Checking `telnetd'... not infected
Checking `timed'... not found
Checking `traceroute'... not infected
Checking `vdir'... not infected
Checking `w'... not infected
Checking `write'... not infected
Checking `aliens'... no suspect files
Searching for sniffer's logs, it may take a while... nothing found
Searching for HiDrootkit's default dir... nothing found
Searching for t0rn's default files and dirs... nothing found
Searching for t0rn's v8 defaults... nothing found
Searching for Lion Worm default files and dirs... nothing found
Searching for RSHA's default files and dir... nothing found
Searching for RH-Sharpe's default files... nothing found
Searching for Ambient's rootkit (ark) default files and dirs... nothing found
Searching for suspicious files and dirs, it may take a while...
/usr/lib/perl5/5.8.6/i386-linux-thread-multi/.packlist

Searching for LPD Worm files and dirs... nothing found
Searching for Ramen Worm files and dirs... nothing found
Searching for Maniac files and dirs... nothing found
Searching for RK17 files and dirs... nothing found
Searching for Ducoci rootkit... nothing found
Searching for Adore Worm... nothing found
Searching for ShitC Worm... nothing found
Searching for Omega Worm... nothing found
Searching for Sadmind/IIS Worm... nothing found
Searching for MonKit... nothing found
Searching for Showtee... nothing found
Searching for OpticKit... nothing found
Searching for T.R.K... nothing found
Searching for Mithra... nothing found
Searching for LOC rootkit... nothing found
Searching for Romanian rootkit... nothing found
Searching for HKRK rootkit... nothing found
Searching for Suckit rootkit... nothing found
Searching for Volc rootkit... nothing found
Searching for Gold2 rootkit... nothing found
Searching for TC2 Worm default files and dirs... nothing found
Searching for Anonoying rootkit default files and dirs... nothing found
Searching for ZK rootkit default files and dirs... nothing found
Searching for ShKit rootkit default files and dirs... nothing found
Searching for AjaKit rootkit default files and dirs... nothing found
Searching for zaRwT rootkit default files and dirs... nothing found
Searching for Madalin rootkit default files... nothing found
Searching for Fu rootkit default files... nothing found
Searching for ESRK rootkit default files... nothing found
Searching for rootedoor... nothing found
Searching for ENYELKM rootkit default files... nothing found
Searching for common ssh-scanners default files... nothing found
Searching for suspect PHP files... nothing found
Searching for anomalies in shell history files... nothing found
Checking `asp'... not infected
Checking `bindshell'... not infected
Checking `lkm'... chkproc: nothing detected
chkdirs: nothing detected
Checking `rexedcs'... not found
Checking `sniffer'... eth0: not promisc and no PF_PACKET sockets
eth0:1: not promisc and no PF_PACKET sockets
eth1: not promisc and no PF_PACKET sockets
Checking `w55808'... not infected
Checking `wted'... chkwtmp: nothing deleted
Checking `scalper'... not infected
Checking `slapper'... not infected
Checking `z2'... chklastlog: nothing deleted
Checking `chkutmp'... chkutmp: nothing deleted

Rabu, 8 Julai 2009

Set Hostname di Mac OS

Setelah komputer riba DELL XPS saya rosak, maka saya terpaksa menggunakan MacBook saya semula sepenuhnya. Seperti sedia maklum OS mac ini berbasiskan backend UNIX. Disebabkan benci melihat default hostname yang panjang. Saya telah mengubah hostname defaultnya dengan pilihan saya sendiri. Command utk menukar Hostname agak berbeza berbanding OS linux biasa.


sudo scutil --set HostName rox


bila selesai cuba masukkan command dibawah:


hostname

rox



rox:~ Anuar$ uname -a
Darwin rox 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386

Sabtu, 30 Mei 2009

Pelayan Eksperimental

Dengan adanya komputer-komputer lama yang masih berfungsi dengan baik, ianya telah banyak membantu saya dalam menjalankan eksperimen pada aplikasi dan sistem operasi sumber terbuka sebelum ianya dipasang atau dibangunkan pada pelayan dan persekitaran sebenar. ekperimen atau kaji selidik dan keberkesanan pada sesuatu sistem operasi mahupun aplikasi adalah faktor utama bagi memastikan persekitaran jaringan sentiasa baik tanpa gangguan trafik pada talian mahupun kegagalan pelayan berfungsi dengan baik.


Bagi membangunkan aplikasi asterisk (VOIP), saya telah menggunakan box dengan kapasiti pekakasnya amat minima dimana kelajuan processor hanya Celeron 1.8MHZ dan memori SDRAM 512. Bagi menjalankan tahap uji pada IPCOP saya telah menggunakan box dengan processor nya berkelajuan AMD Athloan 1.8mhz dan memori serendah 256mb dari jenis DDR1 Bagi pelayan NAGIOS dan LDAP saya menggunakan box yang berkapasiti Intel Celeron 1.8mhz dan memeri DDR1 256mb dengan menggunakan sistem operasi Fedore Core 6.


Jadi sekiranya anda masih memiliki komputer/box yang ingin dihapuskan, sila hubungi saya. saya masih perlukan box bagi menjalankan beberapa eksperimental pada beberapa aplikasi yang lain.

Jumaat, 29 Mei 2009

IPCOP 1.4.21

Setelah puas mencuba beberapa aplikasi sumber terbuka bagi firewall yang ada di jaringan. Saya berpendapat IPCOP merupakan salah satu aplikasi firewall yang terbaik pernah saya cuba selain VYATTA dan ENDIAN. Tidak silap saya IPCOP berbasiskan sumber aplikasi SmoothWall yang juga merupakan aplikasi firewall. Cara instalasi juga amat mudah dengan memuat turun file ISO dan pindahkan ke dalam cd atau sekiranya anda mahu berjimat, boleh pindahkan file ISO tersebut kedalam USB thumbdrive anda. Untuk instalasi IPCOP ini saya telah memindahkan fail tersebut ke dalam CD. Langkah-langkah instalasi IPCOP boleh rujuk disini.

Yang membuatkan saya begitu senang dengan IPCOP adalah fitur-fitur addonn yang banyak disediakan. Pelbagai servis disediakan di IPCOP seperti OpenVPN, P2P Block Protocol, QoS dan banyak lagi dengan hanya muat turun fail-fail addon tersebut dari laman rasmi IPCOP


IPCOP juga menyediakan graf bagi koneksi eth1 dan eth0 seperti dibawah. Adanya graf seperti ini ianya dapat membantu saya dalam menambah baik dan memerhati network dipejabat saya.

Untuk membuat blocking pada laman web tertentu, saya telah memasang addonn URLFilter yang mana URLFilter ini dibangunkan dengan menggunakan aplikasi squid dan squidGuard. Ianya juga berfungsi sebagai proksi kepada pelayan saya. URLFilter juga akan merekod log seperti dibawah yang mana telah memudahkan saya untuk mengesan komputer didalam rangkaian anda. Tidak perlu lagi menggunakan arahan "tail -f /", dengan IPCOP dan addon URLFilter semunya telah tersedia.

selamat mencuba! :)

Isnin, 9 Februari 2009

Sun SparcUltra IIi

Khamis lalu saya berjaya mendapatkan box idaman saya, iaitu Sun UltraSparc IIi dari syarikat BGS Solution Sdn Bhd di Jalan Ipoh berhadapan dengan Sungai Mas. Walaupun spesifikasi box itu sangat rendah dengan kelajuan processor sebanyak 440mhz dan memori sebanyak 256mb, namun itu semua tidak menjadi masalah bagi saya, asalkan saya berjaya mendapatkan box sun ini dengan harga yang murah dan berpatutan. Menurut tuan penyamun harga box ini pada waktu mula-mula keluar dahulu mampu mencecah harga seunit kereta kancil.. dan kini banyangkanlah saya hanya mendapatkan dengan harga hanya RM500.
Dengan bantuan tuan penyamun yang meminjamkan saya papan kekunci sun dan installer solaris 10 berserta software companionnya sekali. Maka saya berjaya memasang Solaris 10 release 2006. Berikutan dengan spesifikasi box yang sangat minima, maka box itu hanya mampu menampung untuk setakat solaris release 2006 sahaja.
walaupun buruk tapi ianya tetap tidak uzur dan masih gagah beroperasi secara normal.. :)

## cara-cara konfigurasi di obp (open boot prom)
  1. pada obp tekan butang 'stop' + 'a'
  2. masukkan arahan 'probe-ide' tujuan mengenal pasti hw ide (Harddisk & CDRom)
  3. jika senarai hw anda terpapar pada screen obp maka masukkan arahan 'setenv boot-device cdrom disk'
  4. masukan arahan 'boot cdrom'. obp akan load file dari sistem fail imej dari cd installer kamu dan memulakan proses pemasangan..