Archive for the ‘linux security’ Category

Edit ld.config on solaris 10

Posted: 28th July 2010 by admin in system

Edit Default Library Path on solaris 10 type “crle” for list Default Library Path crle Configuration file [version 4]: /var/ld/ld.config Default Library Path (ELF): /usr/local/lib:/lib:/usr/lib Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default) Command line: crle -c /var/ld/ld.config -l /usr/local/lib:/lib:/usr/lib type “crle -c /var/ld/ld.config -l /usr/local/lib:/lib:/usr/lib” to change Default Library Path crle -c /var/ld/ld.config -l /usr/local/lib:/lib:/usr/lib

enable php curl proxy

Posted: 2nd January 2010 by admin in php

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_PROXY,”$host:$port”);

ubuntu build essential

Posted: 2nd January 2010 by admin in system

apt-get install build-essential

snmptranslate

Posted: 26th June 2009 by admin in linux security, network

snmptranslate -IR tcpPassiveOpens.0 TCP-MIB::tcpPassiveOpens.0 snmptranslate -On TCP-MIB::tcpPassiveOpens.0 .1.3.6.1.2.1.6.6.0 snmptranslate .1.3.6.1.2.1.6.6.0 TCP-MIB::tcpPassiveOpens.0

command count tcp state

Posted: 8th June 2009 by admin in network, system
Tags:

netstat -tan | grep ‘:80 ‘ | awk ‘{print $6}’ | sort | uniq -c

การทำ null route บน linux

Posted: 31st May 2009 by admin in network
Tags:

คำสั่งดรอปการโจมตีจาก ip ด้วยคำสั่ง route  บน linux route add xxx.xxx.xxx.xxx reject คำสั่งตรวจสอบว่าทำการปิดกันเรียบร้อยหรือยังถ้าแสดงข้อความแบบด้านล่างแสดงว่าได้ปิดกั้น ip นั้นเรียบร้อยแล้ว ip route get  xxx.xxx.xxx.xxx RTNETLINK answers: Network is unreachable ใช้คำสั่งด้านล่างเพื่อดู ตารางการ route [[email protected] ~]#route -n ใช้คำสั่งด้านล่างเพื่อยกเลิกการปิดกัน ip ดังกล่าว [[email protected] ~]#route del -host xxx.xxx.xxx.xxx reject  หมายเหตุ xxx.xxx.xxx.xxx คือ ip ที่ต้องการปิดกั้น

บางครั้ง อัพโหลด files นามสกุล เหล่านี้ขึ้นไปโดยไม่ได้ตั้งใจ อาจทำให้ โดน hacker เข้ามาแอบอ่าน .bak ของ config สำคัญเราได้ เพื่อเป็นการป้องกันทำได้โดยการเพิ่มข้อความด้านล่างลงไปใน httpd.conf <FilesMatch “.(sql|bak|old|torrent)$”>     Order allow,deny     Deny from all </FilesMatch> แล้วสั่ง restart apache ใหม่เท่านี้ก็สามารถป้องกันไม่ให้ผู้ใช้ files นามสกุล ที่เราไม่อนุญาติได้แล้ว

แก้ไขที่ php.ini หาบรรทัดที่มีข้อความว่า   disable_functions = โดย เพิ่มข้อความเหล่านี้ไปหลัง เครื่องหมาย = แล้วจัดการเซฟ escapeshellarg, escapeshellcmd, exec, passthru, proc_open,proc_close,proc_get_status, proc_nice, proc_terminate,shell_exec, system,apache_child_terminate, apache_get_modules,apache_get_version,apache_getenv, apache_lookup_uri, apache_note,apache_request_headers,apache_reset_timeout, apache_response_headers,apache_setenv, getallheaders, virtual, popen, pclose สั่ง restart apache

ตัวอย่างนี้เป้นการป้องกันไม่ให้ user apache ใช้งาน crontab [[email protected] ~]#echo “apache” >> /etc/cron.deny

ให้ทำการเพิ่มข้อความด้านล่างลงไปใน my.cnf แล้วทำการ restart mysql local-infile=0