Archive for May, 2009

การทำ 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 ที่ต้องการปิดกั้น

การแก้ไข default gateway

Posted: 25th May 2009 by admin in Linux How to
Tags:

route del default route add default gw xxx.xxx.xxx.xxx

บางครั้ง อัพโหลด 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

เพื่อเป้นการป้องกัน Cross-site scripting (XSS)  ผ่านทาง TRACK/TRACE วิธีที่ 1 เป็นการใช้ rewrite_module ปิดการใช้งาน Trace การติดตั้งให้นำข้อความด้านล่างไปใส่ใน httpd.conf เซฟ แล้ว restart apache ใหม่ <IfModule rewrite_module>   RewriteEngine On   RewriteCond %{REQUEST_METHOD} ^TRAC(E|K)   RewriteRule .* – [F] </IfModule> วิธีที่ 2  เป็นการปิดการใช้งาน Trace การติดตั้งให้นำข้อความด้านล่างไปใส่ใน httpd.conf เซฟ แล้ว restart apache ใหม่ TraceEnable off

How to install mod_rpaf – reverse proxy wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz tar -xvzf mod_rpaf-0.6.tar.gz cd mod_rpaf-0.6 apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c   add this to httpd.conf and save it LoadModule rpaf_module /usr/lib/apache/mod_rpaf-2.0.so #Reverse proxy RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 xxx.xxx.xxx.xxx <– set your public ip xxx.xxx.xxx.xxx RPAFheader X-Forwarded-For   restart service apache #/etc/init.d/httpd restart

การ backup/restore OpenLdap (BerkleyDB)

Posted: 25th May 2009 by admin in Linux How to
Tags:

Backup: slapcat > backup.ldif Restore: slapadd < backup.ldif