loulou ange
11-02-2013, بتوقيت غرينيتش 02:15 AM
السلام عليكم ورحمة الله وبركـاته
نـظرا لكثرة الطلبات على شرح كيفية اعداد وادارة السيرفر SERVER وحمايته
ونظرا لان اغلب الشروحات القيمه اصبحت قديمه بعض الشىء .. فقمت باجتهاد شخصى بجمع افضل الشروحات الموجوده وضعها بالشكل الذى يناسب التحديث updateات الجديده والتغييرات التى حدثت
الموضوع هذا مزيج من عدة مواضيع وشروحات واجتهاد شخصى لى ايضا
برعــاية فـور سيرف نت
http://4Serv.net (http://4serv.net/)
اولا سنبـدا بشرح طريقة تركيب install الـ cPanel
بفرض ان السيرفر SERVER الخاص بك لم يتم تركيب install عليه اى لوح ونريد نركب اللوحه الشعبيه والمفضله وهو الـ cPanel
نسجل دخــول للشـل عن طريق احدى البرامج وليكن Putty
ونتــابع الصــور ..
http://img156.imageshack.us/img156/3614/11255258.jpg
http://img156.imageshack.us/img156/6170/19733621.jpg
http://img219.imageshack.us/img219/9792/75372095.jpg
بعد الخــول سنقوم بتركيب install الـ cPanel عن طريق الاوامر التاليه
رمز PHP:
<code style="white-space:nowrap"> <code> cd /home
</code> </code>
رمز PHP:
<code style="white-space:nowrap"> <code> wget -N http://layer1.cpanel.net/latest
</code> </code>
رمز PHP:
<code style="white-space:nowrap"> <code> sh latest
</code> </code>
http://img338.imageshack.us/img338/620/67056001.jpg
وننتظــر من 45 دقيــقه الى اكثر حسب امكانات السيرفر SERVER ....
الان بعد الانتهـــاء من التركيب install يمكن عمل ريبوت للسيرفر SERVER عن طريق
رمز PHP:
<code style="white-space:nowrap"> <code> reboot -n
</code> </code>
الان سندخل على الوحه بعد ان تم تركيب installها لنستكمل باقى الاعدادات
http://IP:2086 (http://ip:2086/)
طبعــا
IP : الايبى الرئيسيى للسيرفر SERVER
2086 : البورت الخاص بـ WHM
بعد الدخــول سيطلب منك تسجيل الدخول
وستكــون بنفس بيانات سيرفر SERVERك
ونستكمــل كمـا بالصــور
http://img338.imageshack.us/img338/1715/72101287.jpg
http://img823.imageshack.us/img823/2905/43779878.jpg
http://img823.imageshack.us/img823/6052/65338371.jpg
http://img823.imageshack.us/img823/11/96417498.jpg
http://img833.imageshack.us/img833/1811/93822906.jpg
http://img156.imageshack.us/img156/7633/57222140.jpg
الان بعــد ان انتهيــنا من التنصيـب نذهب للمرحله القادمه وهى المراجعة والتعديل على النيم سيرفر SERVER والـ Dns الخ ..
------------------------------------------------------------------------------------------------------
الان بعد ان قمنـا بتركيب install الـ cPanel
نقــوم ببعـض التعديلات والهـامه جدا بعد التركيب install
من الشـل
نضع الامر ونتــابع
رمز Code:
pico /etc/wwwacct.conf
رمز Code:
ADDR 184.154.10.101 CONTACTEMAIL info@4serv.net CONTACTPAGER DEFMOD x3 ETHDEV venet0:0 HOMEDIR /home HOMEMATCH home HOST server.4serv.info LOGSTYLE combined MINUID NS ns1.4serv.info NS2 ns2.4serv.info NS3 NS4 NSTTL 86400 SCRIPTALIAS y TTL 14400
كل مانريد التدقيق عليه بالملف التالى
الايبــى الرئيسيى للسيرفر SERVER
ADDR
الميل الرئيسيى لسيرفر SERVER
CONTACTEMAIL
النيم سيرفر SERVER الخاصه بك
NS&NS2
سنضع n بدل y لمزيد من الحمايه
SCRIPTALIAS
14400
TTL
الان بعد التاكد والتعديل
سنقوم بغلق الملف عن طريق Ctrl+x
ثم
ثم
y Enter
ثم الان ندخل الى الملف التالى
رمز Code:
pico /etc/nameserverips
رمز Code:
ip=ns1.domain.com ip2=ns2.domain.com ip3=0
رمز Code:
ip و ip2 هم ايبهـات الدى ان اس اللى كتبناهم ف السابق وف الاغلب متتالين مثال 10.10.10.10 10.10.10.11 ونلاحظ ايضا القيمه 0 وضعت لعدم وجود ايبى ثالث مستخدم فنضعها 0 ويمكن وضع رابع ايضا حسب استخدامك بعد الانتهـاء نقوم بالحفظ والخروج من الملف ونقوم بعمل ريستارت للخدمات المطلوبه
رمز Code:
service named restart /scripts/restartsrv chkservd service cpanel restart
الان ندخل الى الملف التالى عن طريق الامر
رمز Code:
pico /etc/resolv.conf
رمز Code:
nameserver ip1 nameserver ip2
نلاحظ هنا انى اضفت ريسولف وهى مطلوبه لبعض الداتا سنترات مثل
SOFTLAYER,SINGLEHOP
ويمكننا الاكتفاء بها ف الملف ان وجدت
وسنقوم بتغير الايبهات امام nameserver بالخاصه بك
ملحوظه: الافضل انك تسيب فيه ايبهات الداتا سنتر بس عشان يكون شغال بصورة أفضل في كل الدول
ونحفظ ونغلق الملف
ونقوم بعمل ريستارت للخدمات المطلوبه
رمز Code:
service named restart /scripts/restartsrv chkservd service cpanel restart
ونتابع
رمز Code:
pico /etc/named.conf
رمز Code:
ونضع تحت include "/etc/rndc.key"; التالى
رمز Code:
acl "trusted" {ip;ip2;ip3;127.0.0.1;};
ونعدل كما تعودنا ip,ip2,ip3 وان وجد الرابع حسب سيرفر SERVERنا
ونضع التالى
رمز Code:
allow-recursion { trusted; }; allow-notify { trusted; }; allow-transfer { trusted; };
كالصــوره التاليــه
http://www.sa3eka.com/image/server/css/name.JPG
ثم نغلق الملف وونقوم بعمل ريستارت للخدمات المطلوبه
رمز Code:
service named restart /scripts/restartsrv chkservd service cpanel restart
والان سوقف نقوم بتحديث update الـ cPanel وبعض الخدمات
رمز Code:
/scripts/upcp --force
رمز Code:
/scripts/eximup --force
رمز Code:
/scripts/ftpup --force
رمز Code:
/scripts/sysup
ثم اصلاح بعض الاشياء بالسيرفر SERVER
رمز Code:
/scripts/mailperm
رمز Code:
/scripts/fixquotas
رمز Code:
/scripts/fixcommonproblems
رمز Code:
/scripts/fixeverything
رمز Code:
/scripts/fixndc
رمز Code:
/scripts/fixvaliases
الجزء القادم هو لترقيـة الاباتشى
الان سنقوم باعادة بناء الاباتشى بطريقتين يدويا او عن طريق اسكربت ايهما تفضل
اولا : يدويا من الشـل
نكتب الامر
رمز Code:
/scripts/easyapache
والصـور تتكلم
http://img338.imageshack.us/img338/50/26608789.jpg
http://img338.imageshack.us/img338/1200/23539440.jpg
http://img338.imageshack.us/img338/9200/83503984.jpg
http://img338.imageshack.us/img338/9296/79635458.jpg
http://img338.imageshack.us/img338/9104/59436136.jpg
http://img338.imageshack.us/img338/9526/62248764.jpg
http://img338.imageshack.us/img338/1530/48962384.jpg
http://img338.imageshack.us/img338/2025/12076572.jpg
http://img834.imageshack.us/img834/7241/51531168.jpg
http://img834.imageshack.us/img834/736/67716002.jpg
http://img834.imageshack.us/img834/6727/70000262.jpg
http://img834.imageshack.us/img834/8323/89179887.jpg
http://img834.imageshack.us/img834/824/70682305.jpg
http://img834.imageshack.us/img834/7555/32665970.jpg
http://img834.imageshack.us/img834/61/91155936.jpg
http://img830.imageshack.us/img830/7618/67368689.jpg
http://img830.imageshack.us/img830/7712/87214410.jpg
http://img830.imageshack.us/img830/534/43799784.jpg
http://img830.imageshack.us/img830/8136/32413948.jpg
ونتركه لحيــن الانتهاء
او
باستخدام سكربت الرائع للاخ مصطفى لاعـادة بناء الاباتشى مع الموديلات المطلوبه
ف الشل
رمز Code:
wget http://dolphin4h.com/ssh/DL-apache.sh sh DL-apache.sh
وسنتركه فتره حتى ينتهى من اعـادة بناء الاباتشى
قد يواجهنـا مشكلة ترخيص الـ cPanel كمـا بالشكل
http://img220.imageshack.us/img220/4011/94978419.jpg
والحل بسيط جدا وهو زرع هذا الامر بالشل
رمز Code:
/usr/local/cpanel/cpkeyclt
والان ندخل الى لوحة WHM ونتابع
Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration
ونتأكد من الاعدادت كالتلى
http://img242.imageshack.us/img242/8594/43622501.jpg
نأتى ببعض التحديث updateات الهامه
بعد متابعة كل الخطوات السابقه ناتى لتحديث updateات هامه جدا للحمايه من الثغرات والمشاكل فيما بعد
اولا تحديث update الـ Bind
رمز Code:
cd /usr/local/src
رمز Code:
wget http (http://ftp.isc.org/isc/bind9/9.7.2-P2/bind-9.7.2-P2.tar.gz)://ftp.isc.org/isc/bind9/9.7.2-P2/bind-9.7.2-P2.tar.gz (http://ftp.isc.org/isc/bind9/9.7.2-P2/bind-9.7.2-P2.tar.gz)
رمز Code:
tar -xzf bind-9.7.2-P2.tar.gz
رمز Code:
cd bind-9.7.2-P2
رمز Code:
./configure
رمز Code:
make
رمز Code:
make install
بعد الانتهاء من التحديث update نفوم بعمل ريستارت
رمز Code:
service named restart
ثانيا نقوم الان بتحديث update الـ OpenSSL
رمز Code:
cd /usr/src
رمز Code:
wget http (http://www.openssl.org/source/openssl-1.0.0a.tar.gz): (http://www.openssl.org/source/openssl-1.0.0a.tar.gz)//www.openssl.org/source/openssl-1.0.0a.tar.gz (http://www.openssl.org/source/openssl-1.0.0a.tar.gz)
رمز Code:
tar -zxf openssl-1.0.0a.tar.gz
رمز Code:
cd openssl-1.0.0a
رمز Code:
./config
رمز Code:
make
رمز Code:
make test
رمز Code:
make install
ثالثا نقوم الان بتحديث update الـ OpenSSH
رمز Code:
cd /usr/src
رمز Code:
wget http (http://mirror.mcs.anl.gov/openssh/portable/openssh-5.6p1.tar.gz)://mirror.mcs.anl.gov/openssh/portable/openssh-5.6p1.tar.gz (http://mirror.mcs.anl.gov/openssh/portable/openssh-5.6p1.tar.gz)
رمز Code:
tar -zxf openssh-5.6p1.tar.gz
رمز Code:
cd openssh-5.6p1
رمز Code:
./configure --prefix=/usr --sysconfdir=/etc/ssh --without-zlib-version-check
رمز Code:
make
رمز Code:
make install
ثم نعمل ريستارت للشل
رمز Code:
service sshd restart
التالى عمل حمايه لملفات النظام والتصاريح الضروريه لحمايه اقوى
طبق الامر التالى
رمز Code:
echo 1 > /proc/sys/net/ipv4/tcp_syn******s
رمز Code:
/scripts/compilers off
ملحوظة: يفضل فتحه عن عمل اى تحديث update لضمان اكتمال التحديث update بكل كامل
وتعديل صلحيات البيرل للروت
رمز Code:
chmod 700 /usr/bin/perl
رمز Code:
chown root:root /usr/bin/perl
رمز Code:
chmod 700 /bin/dmesg chmod 700 /bin/mount chmod 700 /bin/rpm chmod 700 /usr/bin/write chmod 700 /usr/bin/talk chmod 700 /usr/bin/ipcrm chmod 700 /usr/bin/ipcs chmod 700 /usr/bin/free chmod 700 /usr/bin/locate chmod 700 /usr/bin/wall chmod 700 /usr/bin/finger chmod 700 /sbin/arp chmod 700 /sbin/ifconfig chmod 700 /usr/sbin/repquota chmod 700 /usr/sbin/tcpdump chmod 700 /usr/bin/wget chmod 700 /usr/bin/lynx chmod 700 /usr/lib/bcc/bcc-cc1 chmod 700 /usr/bin/perlcc chmod 700 /usr/bin/bcc chmod 700 /usr/bin/cc chmod 700 /usr/bin/gcc chmod 700 /usr/bin/who chmod 700 /usr/bin/w chmod 711 / chmod 711 /home chmod 711 /etc chmod 711 /var chmod 711 /usr/etc chmod 711 /usr/local/etc chmod 711 /var/log chmod 711 /sbin chmod 711 /usr/sbin chmod 711 /usr/local/sbin
رمز Code:
chattr +i /usr/bin/cmp chattr +i /usr/bin/diff chattr +i /usr/bin/diff3 chattr +i /usr/bin/sdiff chattr +i /usr/bin/find chattr +i /usr/bin/xargs chattr +i /usr/bin/eu-addr2line chattr +i /usr/bin/eu-ar chattr +i /usr/bin/eu-elfcmp chattr +i /usr/bin/eu-elflint chattr +i /usr/bin/eu-findtextrel chattr +i /usr/bin/eu-make-debug-archive chattr +i /usr/bin/eu-nm chattr +i /usr/bin/eu-objdump chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/eu-readelf chattr +i /usr/bin/eu-size chattr +i /usr/bin/eu-strings chattr +i /usr/bin/eu-strip chattr +i /usr/bin/eu-unstrip chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/eu-addr2line chattr +i /usr/bin/eu-ar chattr +i /usr/bin/eu-elfcmp chattr +i /usr/bin/eu-elflint chattr +i /usr/bin/eu-findtextrel chattr +i /usr/bin/eu-make-debug-archive chattr +i /usr/bin/eu-nm chattr +i /usr/bin/eu-objdump chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/eu-readelf chattr +i /usr/bin/eu-size chattr +i /usr/bin/eu-strings chattr +i /usr/bin/eu-strip chattr +i /usr/bin/eu-unstrip chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/dig chattr +i /usr/bin/host chattr +i /usr/bin/nslookup chattr +i /usr/bin/nsupdate chattr +i /bin/ping chattr +i /bin/ping6 chattr +i /bin/tracepath chattr +i /bin/tracepath6 chattr +i /sbin/arping chattr +i /sbin/ifenslave chattr +i /sbin/rdisc chattr +i /usr/sbin/arping chattr +i /usr/sbin/clockdiff chattr +i /usr/sbin/ping6 chattr +i /usr/sbin/tracepath chattr +i /usr/sbin/tracepath6 chattr +i /usr/bin/compress-dummy chattr +i /usr/bin/mail-files chattr +i /usr/bin/mailshar chattr +i /usr/bin/remsync chattr +i /usr/bin/shar chattr +i /usr/bin/unshar chattr +i /usr/bin/uudecode chattr +i /usr/bin/uuencode chattr +i /usr/bin/chage chattr +i /usr/bin/faillog chattr +i /usr/bin/gpasswd chattr +i /usr/bin/lastlog chattr +i /usr/bin/newgrp chattr +i /usr/bin/sg chattr +i /usr/sbin/adduser chattr +i /usr/sbin/chpasswd chattr +i /usr/sbin/groupadd chattr +i /usr/sbin/groupdel chattr +i /usr/sbin/groupmod chattr +i /usr/sbin/grpck chattr +i /usr/sbin/grpconv chattr +i /usr/sbin/grpunconv chattr +i /usr/sbin/newusers chattr +i /usr/sbin/pwck chattr +i /usr/sbin/pwconv chattr +i /usr/sbin/pwunconv chattr +i /usr/sbin/useradd chattr +i /usr/sbin/userdel chattr +i /usr/sbin/usermod chattr +i /usr/bin/addr2line chattr +i /usr/bin/ar chattr +i /usr/bin/as chattr +i /usr/bin/c++filt chattr +i /usr/bin/gprof chattr +i /usr/bin/ld chattr +i /usr/bin/nm chattr +i /usr/bin/objcopy chattr +i /usr/bin/objdump chattr +i /usr/bin/ranlib chattr +i /usr/bin/readelf chattr +i /usr/bin/size chattr +i /usr/bin/strings chattr +i /usr/bin/strip chattr +i /usr/lib/libbfd-2.17.50.0.6-14.el5.so chattr +i /usr/lib/libopcodes-2.17.50.0.6-14.el5.so chattr +i /usr/bin/ranlib chattr +i /usr/lib/libbfd-2.17.50.0.6-14.el5.so chattr +i /usr/lib/libopcodes-2.17.50.0.6-14.el5.so chattr +i /bin/doexec chattr +i /bin/ipcalc chattr +i /bin/usleep chattr +i /sbin/consoletype chattr +i /sbin/fstab-decode chattr +i /sbin/genhostid chattr +i /sbin/getkey chattr +i /sbin/ifdown chattr +i /sbin/ifup chattr +i /sbin/initlog chattr +i /sbin/netreport chattr +i /sbin/ppp-watch chattr +i /sbin/service chattr +i /sbin/setsysfont chattr +i /usr/sbin/sys-unconfig chattr +i /usr/sbin/usernetctl chattr +i /lib/udev/rename_device chattr +i /sbin/grubby chattr +i /sbin/installkernel chattr +i /sbin/mkinitrd chattr +i /sbin/new-kernel-pkg chattr +i /lib/bdevid/ata.so chattr +i /lib/bdevid/scsi.so chattr +i /lib/bdevid/usb.so chattr +i /usr/lib/libbdevid.so.5.1.19.6 chmod 644 /etc/profile chattr +i /etc/profile chmod 644 /etc/bashrc chattr +i /etc/bashrc chmod 644 /etc/csh.login chattr +i /etc/csh.login chmod 644 /etc/csh.cshrc chattr +i /etc/csh.cshrc chmod 644 /root/.bash_profile chattr +i /root/.bash_profile chmod 644 /root/.bashrc chattr +i /root/.bashrc chmod 644 /root/.bash_logout chattr +i /root/.bash_logout chmod 644 /root/.cshrc chattr +i /root/.cshrc chmod 644 /root/.tcshrc chattr +i /root/.tcshrc chmod 750 /usr/bin/wget chmod 750 /usr/bin/lynx
تم حماية الـ tmp
رمز Code:
/scripts/securetmp
والان من WHM
Main >> Service Configuration >> Exim Configuration Editor
ننزل للاسفل ونختار advanced editor
http://img135.imageshack.us/img135/7862/30542340.jpg
ثم
رمز Code:
service exim restart service cpanel restart
الان سوف نركب LES المتميز جدا ف حماية ملفات النظام ايضا
رمز Code:
cd /usr/src
رمز Code:
wget http (http://www.r-fx.ca/downloads/les-current.tar.gz): (http://www.r-fx.ca/downloads/les-current.tar.gz)//www.r-fx.ca/downloads/les-current.tar.gz (http://www.r-fx.ca/downloads/les-current.tar.gz)
رمز Code:
tar -zxvf les-current.tar.gz
رمز Code:
cd les*
رمز Code:
sh install.sh
رمز Code:
/usr/local/sbin/les -ea 1
الان سوف نركب العمــلاق CSF بالاعدادات المطلوبه عن طريق اسكربت الاخ مصطفى الغالى
رمز Code:
wget http://www.dolphin4h.com/ssh/csf.sh chmod +x csf.sh sh csf.sh
تركيب install ELS ونتابع
رمز Code:
wget --output-document=installer.sh http://servermonkeys.com/projects/els/installer.sh; chmod +x installer.sh; sh installer.sh
ونكتب
رمز Code:
els --chkrootkit
رمز Code:
els --chkrootkitcron
رمز Code:
Ensure this is correct. Proceed? (y/n):
نكتب y ثم ENTER
ثم نركب
رمز Code:
els --rkhunter
رمز Code:
ELS can now install RKHunter. Proceed? (y/n):
ثم y
رمز Code:
els --rkhuntercron
Admin (your) E-Mail Address (this should NOT be on this server):
نكتب البريد
ثم نتابع y
رمز Code:
rkhunter -c
رمز Code:
els --chmodfiles
رمز Code:
els --disabletelnet
رمز Code:
els --imagemagick
رمز Code:
els --zendopt
رمز Code:
els --securepartitions
رمز Code:
els --tweakcpsettings
رمز Code:
els --fixrndc
الان نأتى للتعديل على الاباتشى
رمز Code:
pico /usr/local/apache/conf/httpd.conf
نقوم بوضع ف اول الملف التالى
رمز Code:
RLimitMEM 1161234090 RLimitCPU 350
ثم نبحث ف الملف عن طريق Ctrl+w
هنبحث عن
ServerSignature
نجعلها off
ثم عمل ريستارت لاباتشى
رمز Code:
httpd restart
الان نعــدل على php.ini
رمز Code:
pico /usr/local/lib/php.ini
نضع ف اول الملف
رمز Code:
reveal_php 0
نبحث عن
رمز Code:
safe_mode
نجعله
رمز Code:
safe_mode = on
نبحث عن
رمز Code:
allow_url_fopen
نجعله
رمز Code:
allow_url_fopen = off
نبحث عن
رمز Code:
expose_php
نجعله
رمز Code:
expose_php = off
تبحث عن
رمز Code:
enable_dl
نجعله
رمز Code:
enable_dl = off
نبحث عن
رمز Code:
register_globals
نجعله
رمز Code:
register_globals = off
نبحث
رمز Code:
display_errors
نجعله
رمز Code:
display_errors = off
الان سوف نعدل بعض القيم الهامه
نبحث عن
رمز Code:
max_execution_time
نجعله
رمز Code:
max_execution_time = 3600
نبحث عن
رمز Code:
memory_limit
نجعله
رمز Code:
memory_limit = 128 M
نبحث على
رمز Code:
upload_max_filesize
نجعله
رمز Code:
upload_max_filesize = 20M
نبحث
رمز Code:
post_max_size
نجعله
رمز Code:
post_max_size = 50M
نبحث عن
رمز Code:
include_path
نجعلها
رمز Code:
include_path "/usr/lib/php:/usr/local/lib/php:/tmp:/home"
نبحث عن
رمز Code:
disable_functions
نجعلها
رمز Code:
dl,escapeshellarg,escapeshellcmd,exec,passthru,pro c_close,proc_get_status,proc_nice,proc_open,proc_t erminate,shell_exec,system,pcntl_exec,getrusage,ch own,chgrp,closelog,openlog,syslog,define_syslog_va riables,php_ini_scanned_files,php_ini_loaded_file, ini_get_all,get_cfg_var,getservbyname,getservbypor t
الان اغلاق البيرل نهائيا فى السيرفر SERVER وعدم تشغيلة باى طريقة كانت والحماية من السيم لينك
عمـل الاخ انس عاطف
من الشل نقوم بالدخول
رمز Code:
cd /usr/local/apache/conf/
نكتب
رمز Code:
nano pro.conf
نضع به التالى
رمز Code:
<Directory "/"> Options -ExecCGI -FollowSymLinks -Includes IncludesNOEXEC Indexes -MultiViews SymLinksIfOwnerMatch AllowOverride AuthConfig Indexes Limit FileInfo Options=IncludesNOEXEC,Indexes,Includes,MultiViews ,SymLinksIfOwnerMatch </Directory>
رمز Code:
#AddHandler cgi-script .cgi .pl .plx .ppl .perl
نحفظ العمل ونقوم بالدخول الى
رمز Code:
nano /usr/local/apache/conf/httpd.conf
نبحث عن
رمز Code:
<Directory "/"> Options AllowOverride All </Directory>
ثم نقوم بحذفها بالكامل
ثم نبحث عن
رمز Code:
LoadModule
و نضعها اسفل الـ include الموجودين
رمز Code:
Include "/usr/local/apache"/conf/pro.conf
ثم نقوم بالبحث عن
رمز Code:
<Directory "/usr/local/apache/htdocs">
غيرها الى
رمز Code:
<Directory "/usr/local/apache/htdocs"> Options Includes Indexes SymLinksIfOwnerMatch AllowOverride None Order Deny,Allow Deny from all </Directory>
ثم نبحث عن
رمز Code:
<Directory "/usr/local/apache/cgi-bin">
نبدلها بـ
رمز Code:
<Directory "/usr/local/apache/cgi-bin"> AllowOverride None Options None Order allow,deny Deny from all </Directory>
ثم نبحث عن
رمز Code:
AddHandler cgi-script .cgi .pl .plx .ppl .perl
نجعلها
رمز Code:
#AddHandler cgi-script .cgi .pl .plx .ppl .perl
ثم نحفظ ونغلق الملف
ونعمل ريستارت للاباتشى
رمز Code:
httpd restart
ثم ننفذ التالى لحفظ الاعدادات
رمز Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
الان مع تعطيـل اغلب الشــلات نهائيــا http://www.dzbatna.com/images/smilies/eek.gif
وسوف تعطينا صفحه بيضـاء
نطبق الامر
رمز Code:
php -v
ونبحث عن SuHosin
ان لم يكون موجود نقوم بتنصيب setupه عن طريق الامر التالى
رمز Code:
/scripts/phpextensionmgr install PHPSuHosin
ندخل الان الى
رمز Code:
pico /usr/local/lib/php.ini
ونضع
رمز Code:
suhosin.executor.func.blacklist =dl,system,passthru,exec,popen,proc_close,proc_get _status,proc_nice,proc_open,proc_terminate,shell_e xec,escape,shellcmd,pclose,pfsockopen,chgrp,debugg er_off,debugger_on,leak,listen,define_syslog_varia bles,ftp_exec,posix_uname,posix_getpwuid,get_curre nt_user,getmyuid,getmygid,apache_child_terminate,p osix_kill,posix_mkfifo,posix_setpgid,posix_setsid, posix_setuid,pfsockopen,chgrp,debugger_off,debugge r_on,leak,listen,define_syslog_variables,ftp_exec, posix_uname,posix_getpwuid,get_current_user,getmyu id,getmygid,apache_child_terminate,posix_kill,posi x_mkfifo,posix_setpgid,posix_setsid,posix_setuid,e scapeshellarg,getservbyport,getservbyname,myshelle xec,escapeshellarg,symlink,shell_exec,exec,proc_cl ose,proc_open,popen,system,dl,passthru,escapeshell arg,escapeshellcmd,posix_getgid,posix_getgrgid,dl, exec,pclose,proc_nice,proc_terminate,proc_get_stat us,pfsockopen,leak,apache_child_terminate,posix_ki ll,posix_mkfifo,posix_setpgid,posix_setsid,posix_s etuid,hypot,pg_host,pos,posix_access,posix_getcwd, posix_getservbyname,myshellexec,getpid,posix_getsi d,posix_getuid,posix_isatty,posix_kill,posix_mknod ,posix_setgid,posix_setsid,posix_setuid,posix_time s,posix_uname,ps_fill,posix_getpwuid,global,ini_re store,bzopen,bzread,bzwrite,apache_get_modules,apa che_get_version,phpversionphpinfo,php_ini_scanned_ files,get_current_user,error_log,disk_total_space, diskfreespace,leak,imap_list,hypo,filedump,gethost byname,safe_mode,getmygid,php_uname,apache_getenv, apache_setenv,bzread,bzwrite,posix_access,bzopen,p hpini,dos_conv,get_current_user,get_cwd,error_log, cmd,e_name,vdir,get_dir,only_read
كما بالصوره
http://img413.imageshack.us/img413/443/14415384.jpg
الان درس مفصل مهم جدا لمستخدمى Suphp وطبعا اللى متابع معايا الدوره هيكمل عادى جدا
وشكرا خاص لاخوى صهيب الفهـداوى للدرس مفصل المتميز
نذهب لاعدادات ملف suphp
رمز Code:
pico /home/cpeasyapache/src/suphp.conf
نعدل جميع القيم بالملف كالتالى
Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
check_vhost_docroot=true
userdir_overrides_usergroup=false
full_php_process_display=true
[handlers]
;Handler for php-scripts
application/x-httpd-php="php:/usr/bin/php"
application/x-httpd-php4="php:/usr/php4/bin/php"
application/x-httpd-php5="php:/usr/bin/php"
;Handler for CGI-scripts
;x-suphp-cgi="execute:!self"
[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
;application/x-httpd-php=/usr/local/lib/
;application/x-httpd-php4=/usr/local/php4/lib/
application/x-httpd-php5=/usr/local/lib/
حذفت علامة
;
بعد ذلك
رمز Code:
pico /etc/httpd/conf/php.conf
ابحث عن
رمز Code:
suPHP_Engine on
ونضع تحتها
رمز Code:
SuPHP_ConfigPath /usr/local/lib/php.ini
ونقوم بالحفظ والخروج
ومن ثم ندخل
رمز Code:
pico /etc/my.cnf
رمز Code:
[mysqld] set-variable=local-infile=0 local-infile=0 datadir=/var/lib/mysql skip-locking skip-innodb skip-networking safe-show-database query_cache_limit=1M query_cache_size=64M ## 32MB for every 1GB of RAM query_cache_type=1 max_user_connections=300 max_connections=500 interactive_timeout=300 wait_timeout=300 connect_timeout=20 thread_cache_size=40 key_buffer=128M ## 128MB for every 1GB of RAM join_buffer=1M max_connect_errors=20 max_allowed_packet=45M table_cache=1024 record_buffer=1M sort_buffer_size=1M ## 1MB for every 1GB of RAM read_buffer_size=1M ## 1MB for every 1GB of RAM read_rnd_buffer_size=4M ## 1MB for every 1GB of RAM thread_concurrency=8 ## Number of CPUs x 2 myisam_sort_buffer_size=64M server-id=1 collation-server=latin1_general_ci [mysql.server] user=mysql [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/lib/mysql/mysql.pid open_files_limit=8192 [mysqldump] quick max_allowed_packet=45M [mysql] no-auto-rehash #safe-updates [isamchk] key_buffer=94M sort_buffer=94M read_buffer=16M write_buffer=16M [myisamchk] key_buffer=64M sort_buffer=64M read_buffer=16M write_buffer=16M [mysqlhotcopy] interactive-timeout [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [isamchk] key_buffer = 96M sort_buffer_size = 64M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 96M sort_buffer_size = 64M read_buffer = 2M write_buffer = 2M
الان مع درس مفصل تغيير بورت الشل
طريقة تغيير بورت الشل 22 الى اى بورت اخر
ندخل
رمز Code:
pico /etc/ssh/sshd_config
نبحث عن
رمز Code:
#Port 22
ونغير 22 الى رقم مكون من 4 ارقام
وليكن 123
ونعدل على اعدادات الـ CSF كما بالصوره
http://img844.imageshack.us/img844/4636/54680510.jpg
تم
http://img135.imageshack.us/img135/5074/26808444.jpg
نلاحظ هنا وضعنا البورت الجديد 1234وفصلنا بينه وبين اللى قبله بـ ","
الا
نعمل ريستارت SHH
رمز Code:
/etc/init.d/sshd restart
وملحوظه يجب وضع البورت الجديد ف الجدار النارى CSF او APF وغيره حتى تجد كل شىء على ما يرام
يرجى عدم الرد لحين الانتهاء
الملفات المرفقة
http://www.traidnt.net/vb/images/attach/txt.gif ruls.txt (http://www.traidnt.net/vb/attachments/526474d1287413030-ruls.txt) (47.1 كيلوبايت, عدد مرات المشاهدة 402 مرة)
http://www.traidnt.net/vb/images/attach/txt.gif Rules2.txt (http://www.traidnt.net/vb/attachments/526475d1287413030-rules2.txt) (42.9 كيلوبايت, عدد مرات المشاهدة 235 مرة)
https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/482113_236967293114455_1193518507_n.png (http://www.dzbatna.com)
©المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى (http://www.dzbatna.com)©
نـظرا لكثرة الطلبات على شرح كيفية اعداد وادارة السيرفر SERVER وحمايته
ونظرا لان اغلب الشروحات القيمه اصبحت قديمه بعض الشىء .. فقمت باجتهاد شخصى بجمع افضل الشروحات الموجوده وضعها بالشكل الذى يناسب التحديث updateات الجديده والتغييرات التى حدثت
الموضوع هذا مزيج من عدة مواضيع وشروحات واجتهاد شخصى لى ايضا
برعــاية فـور سيرف نت
http://4Serv.net (http://4serv.net/)
اولا سنبـدا بشرح طريقة تركيب install الـ cPanel
بفرض ان السيرفر SERVER الخاص بك لم يتم تركيب install عليه اى لوح ونريد نركب اللوحه الشعبيه والمفضله وهو الـ cPanel
نسجل دخــول للشـل عن طريق احدى البرامج وليكن Putty
ونتــابع الصــور ..
http://img156.imageshack.us/img156/3614/11255258.jpg
http://img156.imageshack.us/img156/6170/19733621.jpg
http://img219.imageshack.us/img219/9792/75372095.jpg
بعد الخــول سنقوم بتركيب install الـ cPanel عن طريق الاوامر التاليه
رمز PHP:
<code style="white-space:nowrap"> <code> cd /home
</code> </code>
رمز PHP:
<code style="white-space:nowrap"> <code> wget -N http://layer1.cpanel.net/latest
</code> </code>
رمز PHP:
<code style="white-space:nowrap"> <code> sh latest
</code> </code>
http://img338.imageshack.us/img338/620/67056001.jpg
وننتظــر من 45 دقيــقه الى اكثر حسب امكانات السيرفر SERVER ....
الان بعد الانتهـــاء من التركيب install يمكن عمل ريبوت للسيرفر SERVER عن طريق
رمز PHP:
<code style="white-space:nowrap"> <code> reboot -n
</code> </code>
الان سندخل على الوحه بعد ان تم تركيب installها لنستكمل باقى الاعدادات
http://IP:2086 (http://ip:2086/)
طبعــا
IP : الايبى الرئيسيى للسيرفر SERVER
2086 : البورت الخاص بـ WHM
بعد الدخــول سيطلب منك تسجيل الدخول
وستكــون بنفس بيانات سيرفر SERVERك
ونستكمــل كمـا بالصــور
http://img338.imageshack.us/img338/1715/72101287.jpg
http://img823.imageshack.us/img823/2905/43779878.jpg
http://img823.imageshack.us/img823/6052/65338371.jpg
http://img823.imageshack.us/img823/11/96417498.jpg
http://img833.imageshack.us/img833/1811/93822906.jpg
http://img156.imageshack.us/img156/7633/57222140.jpg
الان بعــد ان انتهيــنا من التنصيـب نذهب للمرحله القادمه وهى المراجعة والتعديل على النيم سيرفر SERVER والـ Dns الخ ..
------------------------------------------------------------------------------------------------------
الان بعد ان قمنـا بتركيب install الـ cPanel
نقــوم ببعـض التعديلات والهـامه جدا بعد التركيب install
من الشـل
نضع الامر ونتــابع
رمز Code:
pico /etc/wwwacct.conf
رمز Code:
ADDR 184.154.10.101 CONTACTEMAIL info@4serv.net CONTACTPAGER DEFMOD x3 ETHDEV venet0:0 HOMEDIR /home HOMEMATCH home HOST server.4serv.info LOGSTYLE combined MINUID NS ns1.4serv.info NS2 ns2.4serv.info NS3 NS4 NSTTL 86400 SCRIPTALIAS y TTL 14400
كل مانريد التدقيق عليه بالملف التالى
الايبــى الرئيسيى للسيرفر SERVER
ADDR
الميل الرئيسيى لسيرفر SERVER
CONTACTEMAIL
النيم سيرفر SERVER الخاصه بك
NS&NS2
سنضع n بدل y لمزيد من الحمايه
SCRIPTALIAS
14400
TTL
الان بعد التاكد والتعديل
سنقوم بغلق الملف عن طريق Ctrl+x
ثم
ثم
y Enter
ثم الان ندخل الى الملف التالى
رمز Code:
pico /etc/nameserverips
رمز Code:
ip=ns1.domain.com ip2=ns2.domain.com ip3=0
رمز Code:
ip و ip2 هم ايبهـات الدى ان اس اللى كتبناهم ف السابق وف الاغلب متتالين مثال 10.10.10.10 10.10.10.11 ونلاحظ ايضا القيمه 0 وضعت لعدم وجود ايبى ثالث مستخدم فنضعها 0 ويمكن وضع رابع ايضا حسب استخدامك بعد الانتهـاء نقوم بالحفظ والخروج من الملف ونقوم بعمل ريستارت للخدمات المطلوبه
رمز Code:
service named restart /scripts/restartsrv chkservd service cpanel restart
الان ندخل الى الملف التالى عن طريق الامر
رمز Code:
pico /etc/resolv.conf
رمز Code:
nameserver ip1 nameserver ip2
نلاحظ هنا انى اضفت ريسولف وهى مطلوبه لبعض الداتا سنترات مثل
SOFTLAYER,SINGLEHOP
ويمكننا الاكتفاء بها ف الملف ان وجدت
وسنقوم بتغير الايبهات امام nameserver بالخاصه بك
ملحوظه: الافضل انك تسيب فيه ايبهات الداتا سنتر بس عشان يكون شغال بصورة أفضل في كل الدول
ونحفظ ونغلق الملف
ونقوم بعمل ريستارت للخدمات المطلوبه
رمز Code:
service named restart /scripts/restartsrv chkservd service cpanel restart
ونتابع
رمز Code:
pico /etc/named.conf
رمز Code:
ونضع تحت include "/etc/rndc.key"; التالى
رمز Code:
acl "trusted" {ip;ip2;ip3;127.0.0.1;};
ونعدل كما تعودنا ip,ip2,ip3 وان وجد الرابع حسب سيرفر SERVERنا
ونضع التالى
رمز Code:
allow-recursion { trusted; }; allow-notify { trusted; }; allow-transfer { trusted; };
كالصــوره التاليــه
http://www.sa3eka.com/image/server/css/name.JPG
ثم نغلق الملف وونقوم بعمل ريستارت للخدمات المطلوبه
رمز Code:
service named restart /scripts/restartsrv chkservd service cpanel restart
والان سوقف نقوم بتحديث update الـ cPanel وبعض الخدمات
رمز Code:
/scripts/upcp --force
رمز Code:
/scripts/eximup --force
رمز Code:
/scripts/ftpup --force
رمز Code:
/scripts/sysup
ثم اصلاح بعض الاشياء بالسيرفر SERVER
رمز Code:
/scripts/mailperm
رمز Code:
/scripts/fixquotas
رمز Code:
/scripts/fixcommonproblems
رمز Code:
/scripts/fixeverything
رمز Code:
/scripts/fixndc
رمز Code:
/scripts/fixvaliases
الجزء القادم هو لترقيـة الاباتشى
الان سنقوم باعادة بناء الاباتشى بطريقتين يدويا او عن طريق اسكربت ايهما تفضل
اولا : يدويا من الشـل
نكتب الامر
رمز Code:
/scripts/easyapache
والصـور تتكلم
http://img338.imageshack.us/img338/50/26608789.jpg
http://img338.imageshack.us/img338/1200/23539440.jpg
http://img338.imageshack.us/img338/9200/83503984.jpg
http://img338.imageshack.us/img338/9296/79635458.jpg
http://img338.imageshack.us/img338/9104/59436136.jpg
http://img338.imageshack.us/img338/9526/62248764.jpg
http://img338.imageshack.us/img338/1530/48962384.jpg
http://img338.imageshack.us/img338/2025/12076572.jpg
http://img834.imageshack.us/img834/7241/51531168.jpg
http://img834.imageshack.us/img834/736/67716002.jpg
http://img834.imageshack.us/img834/6727/70000262.jpg
http://img834.imageshack.us/img834/8323/89179887.jpg
http://img834.imageshack.us/img834/824/70682305.jpg
http://img834.imageshack.us/img834/7555/32665970.jpg
http://img834.imageshack.us/img834/61/91155936.jpg
http://img830.imageshack.us/img830/7618/67368689.jpg
http://img830.imageshack.us/img830/7712/87214410.jpg
http://img830.imageshack.us/img830/534/43799784.jpg
http://img830.imageshack.us/img830/8136/32413948.jpg
ونتركه لحيــن الانتهاء
او
باستخدام سكربت الرائع للاخ مصطفى لاعـادة بناء الاباتشى مع الموديلات المطلوبه
ف الشل
رمز Code:
wget http://dolphin4h.com/ssh/DL-apache.sh sh DL-apache.sh
وسنتركه فتره حتى ينتهى من اعـادة بناء الاباتشى
قد يواجهنـا مشكلة ترخيص الـ cPanel كمـا بالشكل
http://img220.imageshack.us/img220/4011/94978419.jpg
والحل بسيط جدا وهو زرع هذا الامر بالشل
رمز Code:
/usr/local/cpanel/cpkeyclt
والان ندخل الى لوحة WHM ونتابع
Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration
ونتأكد من الاعدادت كالتلى
http://img242.imageshack.us/img242/8594/43622501.jpg
نأتى ببعض التحديث updateات الهامه
بعد متابعة كل الخطوات السابقه ناتى لتحديث updateات هامه جدا للحمايه من الثغرات والمشاكل فيما بعد
اولا تحديث update الـ Bind
رمز Code:
cd /usr/local/src
رمز Code:
wget http (http://ftp.isc.org/isc/bind9/9.7.2-P2/bind-9.7.2-P2.tar.gz)://ftp.isc.org/isc/bind9/9.7.2-P2/bind-9.7.2-P2.tar.gz (http://ftp.isc.org/isc/bind9/9.7.2-P2/bind-9.7.2-P2.tar.gz)
رمز Code:
tar -xzf bind-9.7.2-P2.tar.gz
رمز Code:
cd bind-9.7.2-P2
رمز Code:
./configure
رمز Code:
make
رمز Code:
make install
بعد الانتهاء من التحديث update نفوم بعمل ريستارت
رمز Code:
service named restart
ثانيا نقوم الان بتحديث update الـ OpenSSL
رمز Code:
cd /usr/src
رمز Code:
wget http (http://www.openssl.org/source/openssl-1.0.0a.tar.gz): (http://www.openssl.org/source/openssl-1.0.0a.tar.gz)//www.openssl.org/source/openssl-1.0.0a.tar.gz (http://www.openssl.org/source/openssl-1.0.0a.tar.gz)
رمز Code:
tar -zxf openssl-1.0.0a.tar.gz
رمز Code:
cd openssl-1.0.0a
رمز Code:
./config
رمز Code:
make
رمز Code:
make test
رمز Code:
make install
ثالثا نقوم الان بتحديث update الـ OpenSSH
رمز Code:
cd /usr/src
رمز Code:
wget http (http://mirror.mcs.anl.gov/openssh/portable/openssh-5.6p1.tar.gz)://mirror.mcs.anl.gov/openssh/portable/openssh-5.6p1.tar.gz (http://mirror.mcs.anl.gov/openssh/portable/openssh-5.6p1.tar.gz)
رمز Code:
tar -zxf openssh-5.6p1.tar.gz
رمز Code:
cd openssh-5.6p1
رمز Code:
./configure --prefix=/usr --sysconfdir=/etc/ssh --without-zlib-version-check
رمز Code:
make
رمز Code:
make install
ثم نعمل ريستارت للشل
رمز Code:
service sshd restart
التالى عمل حمايه لملفات النظام والتصاريح الضروريه لحمايه اقوى
طبق الامر التالى
رمز Code:
echo 1 > /proc/sys/net/ipv4/tcp_syn******s
رمز Code:
/scripts/compilers off
ملحوظة: يفضل فتحه عن عمل اى تحديث update لضمان اكتمال التحديث update بكل كامل
وتعديل صلحيات البيرل للروت
رمز Code:
chmod 700 /usr/bin/perl
رمز Code:
chown root:root /usr/bin/perl
رمز Code:
chmod 700 /bin/dmesg chmod 700 /bin/mount chmod 700 /bin/rpm chmod 700 /usr/bin/write chmod 700 /usr/bin/talk chmod 700 /usr/bin/ipcrm chmod 700 /usr/bin/ipcs chmod 700 /usr/bin/free chmod 700 /usr/bin/locate chmod 700 /usr/bin/wall chmod 700 /usr/bin/finger chmod 700 /sbin/arp chmod 700 /sbin/ifconfig chmod 700 /usr/sbin/repquota chmod 700 /usr/sbin/tcpdump chmod 700 /usr/bin/wget chmod 700 /usr/bin/lynx chmod 700 /usr/lib/bcc/bcc-cc1 chmod 700 /usr/bin/perlcc chmod 700 /usr/bin/bcc chmod 700 /usr/bin/cc chmod 700 /usr/bin/gcc chmod 700 /usr/bin/who chmod 700 /usr/bin/w chmod 711 / chmod 711 /home chmod 711 /etc chmod 711 /var chmod 711 /usr/etc chmod 711 /usr/local/etc chmod 711 /var/log chmod 711 /sbin chmod 711 /usr/sbin chmod 711 /usr/local/sbin
رمز Code:
chattr +i /usr/bin/cmp chattr +i /usr/bin/diff chattr +i /usr/bin/diff3 chattr +i /usr/bin/sdiff chattr +i /usr/bin/find chattr +i /usr/bin/xargs chattr +i /usr/bin/eu-addr2line chattr +i /usr/bin/eu-ar chattr +i /usr/bin/eu-elfcmp chattr +i /usr/bin/eu-elflint chattr +i /usr/bin/eu-findtextrel chattr +i /usr/bin/eu-make-debug-archive chattr +i /usr/bin/eu-nm chattr +i /usr/bin/eu-objdump chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/eu-readelf chattr +i /usr/bin/eu-size chattr +i /usr/bin/eu-strings chattr +i /usr/bin/eu-strip chattr +i /usr/bin/eu-unstrip chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/eu-addr2line chattr +i /usr/bin/eu-ar chattr +i /usr/bin/eu-elfcmp chattr +i /usr/bin/eu-elflint chattr +i /usr/bin/eu-findtextrel chattr +i /usr/bin/eu-make-debug-archive chattr +i /usr/bin/eu-nm chattr +i /usr/bin/eu-objdump chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/eu-readelf chattr +i /usr/bin/eu-size chattr +i /usr/bin/eu-strings chattr +i /usr/bin/eu-strip chattr +i /usr/bin/eu-unstrip chattr +i /usr/bin/eu-ranlib chattr +i /usr/bin/dig chattr +i /usr/bin/host chattr +i /usr/bin/nslookup chattr +i /usr/bin/nsupdate chattr +i /bin/ping chattr +i /bin/ping6 chattr +i /bin/tracepath chattr +i /bin/tracepath6 chattr +i /sbin/arping chattr +i /sbin/ifenslave chattr +i /sbin/rdisc chattr +i /usr/sbin/arping chattr +i /usr/sbin/clockdiff chattr +i /usr/sbin/ping6 chattr +i /usr/sbin/tracepath chattr +i /usr/sbin/tracepath6 chattr +i /usr/bin/compress-dummy chattr +i /usr/bin/mail-files chattr +i /usr/bin/mailshar chattr +i /usr/bin/remsync chattr +i /usr/bin/shar chattr +i /usr/bin/unshar chattr +i /usr/bin/uudecode chattr +i /usr/bin/uuencode chattr +i /usr/bin/chage chattr +i /usr/bin/faillog chattr +i /usr/bin/gpasswd chattr +i /usr/bin/lastlog chattr +i /usr/bin/newgrp chattr +i /usr/bin/sg chattr +i /usr/sbin/adduser chattr +i /usr/sbin/chpasswd chattr +i /usr/sbin/groupadd chattr +i /usr/sbin/groupdel chattr +i /usr/sbin/groupmod chattr +i /usr/sbin/grpck chattr +i /usr/sbin/grpconv chattr +i /usr/sbin/grpunconv chattr +i /usr/sbin/newusers chattr +i /usr/sbin/pwck chattr +i /usr/sbin/pwconv chattr +i /usr/sbin/pwunconv chattr +i /usr/sbin/useradd chattr +i /usr/sbin/userdel chattr +i /usr/sbin/usermod chattr +i /usr/bin/addr2line chattr +i /usr/bin/ar chattr +i /usr/bin/as chattr +i /usr/bin/c++filt chattr +i /usr/bin/gprof chattr +i /usr/bin/ld chattr +i /usr/bin/nm chattr +i /usr/bin/objcopy chattr +i /usr/bin/objdump chattr +i /usr/bin/ranlib chattr +i /usr/bin/readelf chattr +i /usr/bin/size chattr +i /usr/bin/strings chattr +i /usr/bin/strip chattr +i /usr/lib/libbfd-2.17.50.0.6-14.el5.so chattr +i /usr/lib/libopcodes-2.17.50.0.6-14.el5.so chattr +i /usr/bin/ranlib chattr +i /usr/lib/libbfd-2.17.50.0.6-14.el5.so chattr +i /usr/lib/libopcodes-2.17.50.0.6-14.el5.so chattr +i /bin/doexec chattr +i /bin/ipcalc chattr +i /bin/usleep chattr +i /sbin/consoletype chattr +i /sbin/fstab-decode chattr +i /sbin/genhostid chattr +i /sbin/getkey chattr +i /sbin/ifdown chattr +i /sbin/ifup chattr +i /sbin/initlog chattr +i /sbin/netreport chattr +i /sbin/ppp-watch chattr +i /sbin/service chattr +i /sbin/setsysfont chattr +i /usr/sbin/sys-unconfig chattr +i /usr/sbin/usernetctl chattr +i /lib/udev/rename_device chattr +i /sbin/grubby chattr +i /sbin/installkernel chattr +i /sbin/mkinitrd chattr +i /sbin/new-kernel-pkg chattr +i /lib/bdevid/ata.so chattr +i /lib/bdevid/scsi.so chattr +i /lib/bdevid/usb.so chattr +i /usr/lib/libbdevid.so.5.1.19.6 chmod 644 /etc/profile chattr +i /etc/profile chmod 644 /etc/bashrc chattr +i /etc/bashrc chmod 644 /etc/csh.login chattr +i /etc/csh.login chmod 644 /etc/csh.cshrc chattr +i /etc/csh.cshrc chmod 644 /root/.bash_profile chattr +i /root/.bash_profile chmod 644 /root/.bashrc chattr +i /root/.bashrc chmod 644 /root/.bash_logout chattr +i /root/.bash_logout chmod 644 /root/.cshrc chattr +i /root/.cshrc chmod 644 /root/.tcshrc chattr +i /root/.tcshrc chmod 750 /usr/bin/wget chmod 750 /usr/bin/lynx
تم حماية الـ tmp
رمز Code:
/scripts/securetmp
والان من WHM
Main >> Service Configuration >> Exim Configuration Editor
ننزل للاسفل ونختار advanced editor
http://img135.imageshack.us/img135/7862/30542340.jpg
ثم
رمز Code:
service exim restart service cpanel restart
الان سوف نركب LES المتميز جدا ف حماية ملفات النظام ايضا
رمز Code:
cd /usr/src
رمز Code:
wget http (http://www.r-fx.ca/downloads/les-current.tar.gz): (http://www.r-fx.ca/downloads/les-current.tar.gz)//www.r-fx.ca/downloads/les-current.tar.gz (http://www.r-fx.ca/downloads/les-current.tar.gz)
رمز Code:
tar -zxvf les-current.tar.gz
رمز Code:
cd les*
رمز Code:
sh install.sh
رمز Code:
/usr/local/sbin/les -ea 1
الان سوف نركب العمــلاق CSF بالاعدادات المطلوبه عن طريق اسكربت الاخ مصطفى الغالى
رمز Code:
wget http://www.dolphin4h.com/ssh/csf.sh chmod +x csf.sh sh csf.sh
تركيب install ELS ونتابع
رمز Code:
wget --output-document=installer.sh http://servermonkeys.com/projects/els/installer.sh; chmod +x installer.sh; sh installer.sh
ونكتب
رمز Code:
els --chkrootkit
رمز Code:
els --chkrootkitcron
رمز Code:
Ensure this is correct. Proceed? (y/n):
نكتب y ثم ENTER
ثم نركب
رمز Code:
els --rkhunter
رمز Code:
ELS can now install RKHunter. Proceed? (y/n):
ثم y
رمز Code:
els --rkhuntercron
Admin (your) E-Mail Address (this should NOT be on this server):
نكتب البريد
ثم نتابع y
رمز Code:
rkhunter -c
رمز Code:
els --chmodfiles
رمز Code:
els --disabletelnet
رمز Code:
els --imagemagick
رمز Code:
els --zendopt
رمز Code:
els --securepartitions
رمز Code:
els --tweakcpsettings
رمز Code:
els --fixrndc
الان نأتى للتعديل على الاباتشى
رمز Code:
pico /usr/local/apache/conf/httpd.conf
نقوم بوضع ف اول الملف التالى
رمز Code:
RLimitMEM 1161234090 RLimitCPU 350
ثم نبحث ف الملف عن طريق Ctrl+w
هنبحث عن
ServerSignature
نجعلها off
ثم عمل ريستارت لاباتشى
رمز Code:
httpd restart
الان نعــدل على php.ini
رمز Code:
pico /usr/local/lib/php.ini
نضع ف اول الملف
رمز Code:
reveal_php 0
نبحث عن
رمز Code:
safe_mode
نجعله
رمز Code:
safe_mode = on
نبحث عن
رمز Code:
allow_url_fopen
نجعله
رمز Code:
allow_url_fopen = off
نبحث عن
رمز Code:
expose_php
نجعله
رمز Code:
expose_php = off
تبحث عن
رمز Code:
enable_dl
نجعله
رمز Code:
enable_dl = off
نبحث عن
رمز Code:
register_globals
نجعله
رمز Code:
register_globals = off
نبحث
رمز Code:
display_errors
نجعله
رمز Code:
display_errors = off
الان سوف نعدل بعض القيم الهامه
نبحث عن
رمز Code:
max_execution_time
نجعله
رمز Code:
max_execution_time = 3600
نبحث عن
رمز Code:
memory_limit
نجعله
رمز Code:
memory_limit = 128 M
نبحث على
رمز Code:
upload_max_filesize
نجعله
رمز Code:
upload_max_filesize = 20M
نبحث
رمز Code:
post_max_size
نجعله
رمز Code:
post_max_size = 50M
نبحث عن
رمز Code:
include_path
نجعلها
رمز Code:
include_path "/usr/lib/php:/usr/local/lib/php:/tmp:/home"
نبحث عن
رمز Code:
disable_functions
نجعلها
رمز Code:
dl,escapeshellarg,escapeshellcmd,exec,passthru,pro c_close,proc_get_status,proc_nice,proc_open,proc_t erminate,shell_exec,system,pcntl_exec,getrusage,ch own,chgrp,closelog,openlog,syslog,define_syslog_va riables,php_ini_scanned_files,php_ini_loaded_file, ini_get_all,get_cfg_var,getservbyname,getservbypor t
الان اغلاق البيرل نهائيا فى السيرفر SERVER وعدم تشغيلة باى طريقة كانت والحماية من السيم لينك
عمـل الاخ انس عاطف
من الشل نقوم بالدخول
رمز Code:
cd /usr/local/apache/conf/
نكتب
رمز Code:
nano pro.conf
نضع به التالى
رمز Code:
<Directory "/"> Options -ExecCGI -FollowSymLinks -Includes IncludesNOEXEC Indexes -MultiViews SymLinksIfOwnerMatch AllowOverride AuthConfig Indexes Limit FileInfo Options=IncludesNOEXEC,Indexes,Includes,MultiViews ,SymLinksIfOwnerMatch </Directory>
رمز Code:
#AddHandler cgi-script .cgi .pl .plx .ppl .perl
نحفظ العمل ونقوم بالدخول الى
رمز Code:
nano /usr/local/apache/conf/httpd.conf
نبحث عن
رمز Code:
<Directory "/"> Options AllowOverride All </Directory>
ثم نقوم بحذفها بالكامل
ثم نبحث عن
رمز Code:
LoadModule
و نضعها اسفل الـ include الموجودين
رمز Code:
Include "/usr/local/apache"/conf/pro.conf
ثم نقوم بالبحث عن
رمز Code:
<Directory "/usr/local/apache/htdocs">
غيرها الى
رمز Code:
<Directory "/usr/local/apache/htdocs"> Options Includes Indexes SymLinksIfOwnerMatch AllowOverride None Order Deny,Allow Deny from all </Directory>
ثم نبحث عن
رمز Code:
<Directory "/usr/local/apache/cgi-bin">
نبدلها بـ
رمز Code:
<Directory "/usr/local/apache/cgi-bin"> AllowOverride None Options None Order allow,deny Deny from all </Directory>
ثم نبحث عن
رمز Code:
AddHandler cgi-script .cgi .pl .plx .ppl .perl
نجعلها
رمز Code:
#AddHandler cgi-script .cgi .pl .plx .ppl .perl
ثم نحفظ ونغلق الملف
ونعمل ريستارت للاباتشى
رمز Code:
httpd restart
ثم ننفذ التالى لحفظ الاعدادات
رمز Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
الان مع تعطيـل اغلب الشــلات نهائيــا http://www.dzbatna.com/images/smilies/eek.gif
وسوف تعطينا صفحه بيضـاء
نطبق الامر
رمز Code:
php -v
ونبحث عن SuHosin
ان لم يكون موجود نقوم بتنصيب setupه عن طريق الامر التالى
رمز Code:
/scripts/phpextensionmgr install PHPSuHosin
ندخل الان الى
رمز Code:
pico /usr/local/lib/php.ini
ونضع
رمز Code:
suhosin.executor.func.blacklist =dl,system,passthru,exec,popen,proc_close,proc_get _status,proc_nice,proc_open,proc_terminate,shell_e xec,escape,shellcmd,pclose,pfsockopen,chgrp,debugg er_off,debugger_on,leak,listen,define_syslog_varia bles,ftp_exec,posix_uname,posix_getpwuid,get_curre nt_user,getmyuid,getmygid,apache_child_terminate,p osix_kill,posix_mkfifo,posix_setpgid,posix_setsid, posix_setuid,pfsockopen,chgrp,debugger_off,debugge r_on,leak,listen,define_syslog_variables,ftp_exec, posix_uname,posix_getpwuid,get_current_user,getmyu id,getmygid,apache_child_terminate,posix_kill,posi x_mkfifo,posix_setpgid,posix_setsid,posix_setuid,e scapeshellarg,getservbyport,getservbyname,myshelle xec,escapeshellarg,symlink,shell_exec,exec,proc_cl ose,proc_open,popen,system,dl,passthru,escapeshell arg,escapeshellcmd,posix_getgid,posix_getgrgid,dl, exec,pclose,proc_nice,proc_terminate,proc_get_stat us,pfsockopen,leak,apache_child_terminate,posix_ki ll,posix_mkfifo,posix_setpgid,posix_setsid,posix_s etuid,hypot,pg_host,pos,posix_access,posix_getcwd, posix_getservbyname,myshellexec,getpid,posix_getsi d,posix_getuid,posix_isatty,posix_kill,posix_mknod ,posix_setgid,posix_setsid,posix_setuid,posix_time s,posix_uname,ps_fill,posix_getpwuid,global,ini_re store,bzopen,bzread,bzwrite,apache_get_modules,apa che_get_version,phpversionphpinfo,php_ini_scanned_ files,get_current_user,error_log,disk_total_space, diskfreespace,leak,imap_list,hypo,filedump,gethost byname,safe_mode,getmygid,php_uname,apache_getenv, apache_setenv,bzread,bzwrite,posix_access,bzopen,p hpini,dos_conv,get_current_user,get_cwd,error_log, cmd,e_name,vdir,get_dir,only_read
كما بالصوره
http://img413.imageshack.us/img413/443/14415384.jpg
الان درس مفصل مهم جدا لمستخدمى Suphp وطبعا اللى متابع معايا الدوره هيكمل عادى جدا
وشكرا خاص لاخوى صهيب الفهـداوى للدرس مفصل المتميز
نذهب لاعدادات ملف suphp
رمز Code:
pico /home/cpeasyapache/src/suphp.conf
نعدل جميع القيم بالملف كالتالى
Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
check_vhost_docroot=true
userdir_overrides_usergroup=false
full_php_process_display=true
[handlers]
;Handler for php-scripts
application/x-httpd-php="php:/usr/bin/php"
application/x-httpd-php4="php:/usr/php4/bin/php"
application/x-httpd-php5="php:/usr/bin/php"
;Handler for CGI-scripts
;x-suphp-cgi="execute:!self"
[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
;application/x-httpd-php=/usr/local/lib/
;application/x-httpd-php4=/usr/local/php4/lib/
application/x-httpd-php5=/usr/local/lib/
حذفت علامة
;
بعد ذلك
رمز Code:
pico /etc/httpd/conf/php.conf
ابحث عن
رمز Code:
suPHP_Engine on
ونضع تحتها
رمز Code:
SuPHP_ConfigPath /usr/local/lib/php.ini
ونقوم بالحفظ والخروج
ومن ثم ندخل
رمز Code:
pico /etc/my.cnf
رمز Code:
[mysqld] set-variable=local-infile=0 local-infile=0 datadir=/var/lib/mysql skip-locking skip-innodb skip-networking safe-show-database query_cache_limit=1M query_cache_size=64M ## 32MB for every 1GB of RAM query_cache_type=1 max_user_connections=300 max_connections=500 interactive_timeout=300 wait_timeout=300 connect_timeout=20 thread_cache_size=40 key_buffer=128M ## 128MB for every 1GB of RAM join_buffer=1M max_connect_errors=20 max_allowed_packet=45M table_cache=1024 record_buffer=1M sort_buffer_size=1M ## 1MB for every 1GB of RAM read_buffer_size=1M ## 1MB for every 1GB of RAM read_rnd_buffer_size=4M ## 1MB for every 1GB of RAM thread_concurrency=8 ## Number of CPUs x 2 myisam_sort_buffer_size=64M server-id=1 collation-server=latin1_general_ci [mysql.server] user=mysql [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/lib/mysql/mysql.pid open_files_limit=8192 [mysqldump] quick max_allowed_packet=45M [mysql] no-auto-rehash #safe-updates [isamchk] key_buffer=94M sort_buffer=94M read_buffer=16M write_buffer=16M [myisamchk] key_buffer=64M sort_buffer=64M read_buffer=16M write_buffer=16M [mysqlhotcopy] interactive-timeout [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [isamchk] key_buffer = 96M sort_buffer_size = 64M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 96M sort_buffer_size = 64M read_buffer = 2M write_buffer = 2M
الان مع درس مفصل تغيير بورت الشل
طريقة تغيير بورت الشل 22 الى اى بورت اخر
ندخل
رمز Code:
pico /etc/ssh/sshd_config
نبحث عن
رمز Code:
#Port 22
ونغير 22 الى رقم مكون من 4 ارقام
وليكن 123
ونعدل على اعدادات الـ CSF كما بالصوره
http://img844.imageshack.us/img844/4636/54680510.jpg
تم
http://img135.imageshack.us/img135/5074/26808444.jpg
نلاحظ هنا وضعنا البورت الجديد 1234وفصلنا بينه وبين اللى قبله بـ ","
الا
نعمل ريستارت SHH
رمز Code:
/etc/init.d/sshd restart
وملحوظه يجب وضع البورت الجديد ف الجدار النارى CSF او APF وغيره حتى تجد كل شىء على ما يرام
يرجى عدم الرد لحين الانتهاء
الملفات المرفقة
http://www.traidnt.net/vb/images/attach/txt.gif ruls.txt (http://www.traidnt.net/vb/attachments/526474d1287413030-ruls.txt) (47.1 كيلوبايت, عدد مرات المشاهدة 402 مرة)
http://www.traidnt.net/vb/images/attach/txt.gif Rules2.txt (http://www.traidnt.net/vb/attachments/526475d1287413030-rules2.txt) (42.9 كيلوبايت, عدد مرات المشاهدة 235 مرة)
https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/482113_236967293114455_1193518507_n.png (http://www.dzbatna.com)
©المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى (http://www.dzbatna.com)©