Archive for the ‘apache’ Category

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

เพื่อเป้นการป้องกัน 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