znhost
February 9th, 2011, 13:12
سلام
داشتم تو فروم directadmin چرخ میزدم چیز جالبی پیدا کردم کمه حتما به دردتون میخوره.
یه برنامه که در حقیقت میشه اینستالر معرفی کرد.
قابل اجرا روی :
RedHat Linux
RedHat Fedora
RedHat Enterprise
CentOS
Debian
باهاش میشه این برنامه ها رو نصب کرد : (فقط با یک خط دستور)
OpenSSL (You need to build ssh, apache, php, etc after upgrade)
Exim
OpenSSH
ProFTP
ProFTP with mod_clamav
phpMyAdmin
AVG
ClamAV
MODclamAV
MRTG
SquirrelMail
SquirrelMail full language pack
SpamAssassin
IMAP (You need to build php after upgrade)
MODsecurity 2.5.x (Apache 2.x Only)
MODsecurity 2.5.x Rules
MODsecurity 1.x (Apache 1.x Only)
MODsecurity 1.x Rules
MODevasive
KISS My Firewall
eAccelerator
Freetype
ImageMagick
GraphicsMagick
FFMPEG-php
PHP Clamav
Webmin control panel (You need to open one port 10000 in your firewall)
MailScanner
Suhosin
NoBody Check
خوب نحوه اجراشم راحته :
mkdir /usr/local/updatescript
cd /usr/local/updatescript
wget http://tools.web4host.net/update.script
chmod 755 update.script
خوب برای استفاده میتونید این رو وارد کنید ، یه متن کامل و قابل درک ظاهر میشه:
./update.script
برای بروز کردن اسکریپت هم از:
./update.script UPDATEME
و برای پاک کرد پوشه آپدیت : (حتما بعد از آپدیت خط زیر رو وارد کنید)
./update.script CLEAN
ورژن اسکریت هم با
./update.script DATE
یک سری کارها هم هست که بعد از نصب هر برنامه با این اسکریپت باید انجام بشه:
اگه ClamAV رو نصب کردید :
nano -w /etc/exim.conf
بعد از :
[QUOTE]
primary_hostname =
[/CODE]
خط زیر را اضافه کنید:
av_scanner = clamd:127.0.0.1 3310
بعد از :
check_message:
اضافه کنید:
deny message = This message contains malformed MIME ($demime_reason)
demime = *
condition = ${if >{$demime_errorlevel}{2}{1}{0}}
deny message = This message contains a virus or other harmful content ($malware_name)
demime = *
malware = *
deny message = This message contains an attachment of a type which we do not accept (.$found_extension)
demime = bat:com:pif:prf:scr:vbs
warn message = X-Antivirus-Scanner: Clean mail though you should still use an Antivirus
بعد save کنید و با دستور زیر exim را ری استارت کنید:
/sbin/service exim restart
ProFTP with mod_clamav
nano /etc/proftpd.conf
بعد خط زیر:
<IfModule mod_clamav.c>
ClamAV on
ClamServer 127.0.0.1
ClamPort 3310
</IfModule>
</Global> رو اضافه کنید و save و ری استارت:
/sbin/service proftpd restart
MODsecurity 2.x
nano -w /etc/httpd/conf/extra/httpd-includes.conf
اگه سیستم 32 بیتی هست ، کد زیر رو در قسمت آخر کپی کنید:
LoadFile /usr/lib/libxml2.so
LoadModule security2_module /usr/lib/apache/mod_security2.so
<IfModule mod_security2.c>
# ModSecurity2 ONLY
# Do not change anything in included files
#
Include /etc/modsecurity2/*.conf
</IfModule>
اگه سیستم 64 بیتی هست ، کد زیر رو در قسمت آخر کپی کنید:
# Use This
LoadFile /usr/lib64/libxml2.so
# If you dont have libxml2.so use
#LoadFile /usr/lib64/libxml2.so.2
LoadModule security2_module /usr/lib/apache/mod_security2.so
<IfModule mod_security2.c>
# ModSecurity2 ONLY
# Do not change anything in included files
#
Include /etc/modsecurity2/*.conf
</IfModule>
save and restart:
/sbin/service httpd restart
MODsecurity 1.x
nano -w /etc/httpd/conf/httpd.conf
کد زیر را اظافه کنید:
[/CODE]
<IfModule mod_security.c>
# Only inspect dynamic requests
# (YOU MUST TEST TO MAKE SURE IT WORKS AS EXPECTED)
#SecFilterEngine DynamicOnly
SecFilterEngine On
# Reject requests with status 500
SecFilterDefaultAction "deny,log,status:500"
# Some sane defaults
SecFilterScanPOST On
SecFilterCheckURLEncoding On
SecFilterCheckCookieFormat On
SecFilterCheckUnicodeEncoding Off
SecFilterNormalizeCookies On
# enable version 1 (RFC 2965) cookies
SecFilterCookieFormat 1
#SecServerResponseToken Off
#If you want to scan the output, uncomment these
#SecFilterScanOutput On
#SecFilterOutputMimeTypes "(null) text/html text/plain"
# Accept almost all byte values
SecFilterForceByteRange 1 255
# Server masking is optional
#fake server banner - NOYB used - no one needs to know what we are using
SecServerSignature "Power MOD by web4host.net"
#SecUploadDir /tmp
#SecUploadKeepFiles Off
# Only record the interesting stuff
SecAuditEngine RelevantOnly
#SecAuditLog logs/audit_log
# You normally won't need debug logging
#SecFilterDebugLevel 0
#SecFilterDebugLog logs/modsec_debug_log
# Mini Rules
Include /etc/modsecurity/mini.conf
</IfModule>
[/CODE]
و در آخر:
/sbin/service httpd restart
MODevasive
برای Apache 1
nano -w /etc/httpd/conf/httpd.conf
اضافه کنید:
<IfModule mod_evasive.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSWhitelist 127.0.0.1
DOSEmailNotify your-email@your-domain.tld
</IfModule>
و:
/sbin/service httpd restart
اما اگه جواب نداد :
/usr/local/directadmin/customapache/
httpd.conf رو ویرایش کنید :
nano -w /etc/httpd/conf/httpd.conf
و بعد از دستور :
LoadModule perl_module /usr/lib/apache/libperl.so
خط ریر رو اضافه کنید:
LoadModule evasive_module /usr/lib/apache/mod_evasive.so
بعد از:
<IfDefine HAVE_PYTHON>
AddModule mod_python.c
</IfDefine>
اضافه کنید:
AddModule mod_evasive.c
و در آخر:
/sbin/service httpd restart
برای Apache 2
nano -w /etc/httpd/conf/extra/httpd-includes.conf
خط زیر رو اضافه کنید:
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSWhitelist 127.0.0.1
DOSEmailNotify your-email@your-domain.tld
</IfModule>
و در آخر:
/sbin/service httpd restart
اگه خواستید امتحان کنید ، (DOSWhitelist) را از توی httpd.conf پاک کنید و بعد:
wget http://tools.web4host.net/modevasive/test.txt
mv test.txt test.pl
chmod 755 test.pl
./test.pl
KISS My Firewall
اینم فایروال فکر کنم جدید باشه، خودم تست نکردم اما تو اون پست نوشته بود که برای Direct Admin و Plesk وWebmin و cPanel کار میکنه .
قبل از اینکه راش بندازید حتما پرت SSH رو توی TCP_OUT و TCP_IN بزارید. اگه نذلرید تغریبا ... میشید
برای راه اندازی:
kiss start
برای متوقف کردن:
kiss stop
برای نمایش وضعیت
kiss status
اگه میخواید آی پی خاصی رو بلوک کنید ، برید اینجا /usr/bin/kiss و BLOCK_LIST رو ویرایش کنید و در آخر کار مثل همیشه :
kiss restart
خوب این فایر والم مثل بقیست باید برید پرتای حیاتی رو براش تعریف کنید و در آخر خودتون میدونید دیگه
یک نکته:
باید برید تو فایل گانفیگ این فایر وال محترم و بهش بگید از چه سیستم عاملی استفاده میکنید:
برای Pre Fedora Core 2 یا Red Hat کد زیر :
EXTN="o"
برای Fedore Core 2 و بالاتر از : (CentOS هم شامل این ردیف میشه قاط نزنید)
EXTN="ko"
eAccelerator
وقتی نصب شد یک لینک مثل لینک زیر بهتون میده:
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
بعد میدویی میری تو php.ini و اونجا بعد Windows Extensions همون dll های توش ، کد زیر رو میزاری: (البته با لینک که بهتون داده بعد نصب ، حتما چک کنید)
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
و در آخر همون کار تکراری
/sbin/service httpd restart
FFMPEG-php
بعد نصب یه لینک میده تهش مثل :
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/
که میری تو php.ini
extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so"
و همون کار تکراری معروف
/sbin/service httpd restart
Freetype
خوب اول از همه آپدیت:
cd /usr/local/directadmin/custombuild
./build clean
./build php n
حالا بریم سر آپاچی
cd /usr/local/directadmin/customapache/
Apache 1
nano -w configure.php
Apache 2
nano -w configure2.php
جایگزین کنید
--with-gd \
--with-gd-dir=/usr/local \
با
--with-gd \
--with-gd-dir=/usr/local/lib \
--with-freetype \
--with-freetype-dir=/usr/local/lib \
سیوش کنید و خط زیر رو اجرا کنید.
./build clean
./build gd
Apache 1
./build clean
./build gd
./build php n
service httpd restart
Apache 2
./build clean
./build gd
./build php_ap2 n
service httpd restart
ImageMagick
بعد نصب :
cd /usr/local/directadmin/custombuild
./build clean
اگه از php 5 استفاده میکنید ، configure.php5ویرایش کنید و اگه از ورژن دیگه استفاده میکنید ، فایل مربوط به ان رو ویرایش کنید
Apache 1
nano -w /usr/local/directadmin/custombuild/configure/ap1/configure.php5
Apache 2
nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5
اضافه کنید:
--with-imagick=/usr/local \
بعد از
--with-freetype-dir=/usr/local/lib \
و ذخیره و
./build php n
GraphicsMagick
cd /usr/local/directadmin/custombuild
./build clean
اگه از php 5 استفاده میکنید ، configure.php5ویرایش کنید و اگه از ورژن دیگه استفاده میکنید ، فایل مربوط به ان رو ویرایش کنید
Apache 1
nano -w /usr/local/directadmin/custombuild/configure/ap1/configure.php5
Apache 2
nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5
اضافه کنید
--with-gmagick=/usr/local \
بعد از
--with-freetype-dir=/usr/local/lib \
ذخره کنید و
./build php n
IMAP
Apache 1
nano -w configure.php
Apache 2
nano -w configure2.php
اضافه کنید
--with-imap=/usr/local/imap-2004c1 \
بعد از
--with-zip \
ذخیره و در آخر همون کار تکراری یعنی:
service httpd restart
AVG Anti-Virus
خوب با دستور زیر میتونید کل پوشه های داخل دایرکتوری home را اسکن کنید:
avgscan -clean -ext=* -rt -arc /home
و با این دستور کل دایرکتوری home بدون فایل های آرشیو:
avgscan -clean -ext=* -rt /home
و برای بروز رسانی:
avgupdate --path="/opt/avg/avg8/update/download"
Nobody Check Security Tool
The Nobody Check tool is a new and unique security tool that can detect malicious processes that are running on your Linux server and report them to you in real time or by email. The tool can be configured to run at selected times and doesn’t eat up resources or interfere with server operations.
اونجور که من فهمیدم یه اسکریپت جدید هستش که هاگه یکی از کاربراتتون اسکریپت که به cpu فشار میاره رو فعال کنه به شما اعلام میکنه. من که کار نکردم باهاش ولی بنظر بدک نمیاد.
MailScanner
ویرایش کنید:
nano -w /etc/exim.conf
پیدا کنید (Ctrl + W)
primary_hostname
اضافه کنید
spool_directory = /var/spool/exim.in
queue_only = true
queue_only_override = false
ویرایش
nano -w /etc/init.d/exim
جستجو
QUEUE=
[ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim
[ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -bd"
[ -n "$QUEUE" ] && EXIM_OPTS="$EXIM_OPTS -q$QUEUE"
جایگذین کنید با
QUEUE="15m"
[ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim
[ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -bd"
[ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim
[ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -C /etc/exim_outgoing.conf"
[ -n "$QUEUE" ] && EXIM_OPTS="$EXIM_OPTS -q$QUEUE"
ویرایش
nano -w /opt/MailScanner/etc/MailScanner.conf
و اطالاع خود رو صحیح وارد کنید
%org-name% = yoursite
%org-long-name% = Your Organisation Name Here
%web-site% = www.your-organisation.com
جستجو کنید و تنظیم کنید
Run As User = mail
Run As Group = mail
Incoming Queue Dir = /var/spool/exim.in/input
Outgoing Queue Dir = /var/spool/exim/input
MTA = exim
Sendmail = /usr/sbin/exim -C /etc/exim.conf
Sendmail2 = /usr/sbin/exim -C /etc/exim_outgoing.conf
Virus Scanners = none
Use SpamAssassin = yes
Always Include SpamAssassin Report = yes
خوب الان برای اینکه میل سرور رو با انتی ویروس خود تنظیم کنید:
nano -w /opt/MailScanner/etc/MailScanner.conf
جستجو:
Virus Scanners = none
جایگذین با
Virus Scanners = avg
و همون کار تکراریه
killall -9 MailScanner
/opt/MailScanner/bin/check_mailscanner
ویرایش
nano -w /etc/crontab
افزودن
37 5 * * * /opt/MailScanner/bin/update_phishing_sites
07 * * * * /opt/MailScanner/bin/update_bad_phishing_sites
58 23 * * * /opt/MailScanner/bin/clean.quarantine
3,23,43 * * * * /opt/MailScanner/bin/check_mailscanner
# Remove # if you want MailScanner to update anti virus
#42 * * * * /opt/MailScanner/bin/update_virus_scanners
الان دیگه برید حالشو ببرید.
MODclamAV
nano -w /etc/httpd/conf/extra/httpd-includes.conf
and add this
# mod ClamAV
Include conf/extra/mod_clamav.conf
save then restart apache
/sbin/service httpd restart
Suhosin
nano -w /usr/local/lib/php.ini
and add this at then end
;************************************************* ***********************
; suhosin Parameters
; For a full list of parameters and their documentation go to:
; (http://www.hardened-php.net/suhosin/configuration.html)
;************************************************* ***********************
[suhosin]
extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/suhosin.so"
; Logging Configuration
# Use your link in place of web4host.net
suhosin.filter.action = [302,]http://www.web4host.net/index.php
suhosin.log.syslog.facility = 9
suhosin.log.syslog.priority = 1
suhosin.log.use-x-forwarded-for = Off
; Executor Options
suhosin.executor.max_depth = 0
suhosin.executor.include.max_traversal = 4
suhosin.executor.include.whitelist =
#suhosin.executor.include.blacklist = "php://, http://, ftp://, gzip://,https://, ftps://, compress.zlib://"
suhosin.executor.include.blacklist = "php://, http://, ftp://, gzip://,https://, ftps://"
suhosin.executor.func.whitelist =
suhosin.executor.func.blacklist = system, shell_exec, exec, passthru, php_uname, popen, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_uname, proc_close, proc_nice, proc_open, proc_terminate
#suhosin.executor.func.blacklist = dl, system, passthru, pclose, proc_nice, proc_terminate, posix_getpwuid, posix_uname, pfosckopen, leak, posix_setuid, escapeshellcmd, escapeshellarg, hypot, pg_host, pos, posix_access, posix_getcwd, posix_getgid, posix_getservbyname,myshellexec,getpid, posix_getsid, posix_isatty, posix_kill, posix_mkfifo, posix_mknod, posix_setgid, posix_setsid, posix_setuid, posix_times, posix_uname, ps_fill, posix_getpwuid, ini_restore, symlink, ini_get_all, zip_open, zip_read, rar_open, bzopen, bzread, bzwrite, shellcode, backtick, cmd, virtual, pcntl_exec, ini_alter, show_source, apache_get_modules, apache_get_version, apache_note, openlog, tmpfile, crack_check, crack_closedict, php_ini_scanned_files, inurl, apache_setenv, closelog, debugger_off, debugger_on, define_syslog_variables, syslog, ftp_exec, posix_setpgid, posix_setsid, posix_setuid, get_current_user, getmyuid, getmygid, listen, netscript, ini_restore, php.ini, id, popen, shell_exec, php_uname, getPath, dir_writeable, read_dir, execute_command, diskfreespace, disk_total_space, proc_open, switch, mkdir
suhosin.executor.eval.whitelist =
suhosin.executor.eval.blacklist =
suhosin.executor.allow_symlink = Off
suhosin.executor.disable_emodifier = Off
suhosin.executor.disable_eval = Off
; Misc Options
suhosin.apc_bug_workaround = Off
suhosin.sql.bailout_on_error = Off
suhosin.sql.comment = 0
suhosin.sql.multiselect = 0
suhosin.sql.opencomment = 0
suhosin.sql.union = 0
suhosin.sql.user_postfix =
suhosin.sql.user_prefix =
suhosin.multiheader = Off
suhosin.memory_limit = 128
suhosin.mail.protect = 1
; Transparent Encryption Options
suhosin.session.encrypt = On
suhosin.session.cryptkey =
suhosin.session.cryptua = On
suhosin.session.cryptdocroot = On
suhosin.session.cryptraddr = 0
suhosin.session.checkraddr = 0
suhosin.session.max_id_length = 128
suhosin.cookie.checkraddr = 0
suhosin.cookie.cryptdocroot = On
suhosin.cookie.cryptkey =
suhosin.cookie.cryptlist =
suhosin.cookie.cryptraddr = 0
suhosin.cookie.cryptua = On
suhosin.cookie.disallow_nul = 1
suhosin.cookie.disallow_ws = 0
suhosin.cookie.encrypt = On
suhosin.cookie.plainlist =
; Filtering Optionins
suhosin.cookie.max_array_depth = 100
suhosin.cookie.max_array_index_length = 64
suhosin.cookie.max_name_length = 64
suhosin.cookie.max_totalname_length = 256
suhosin.cookie.max_value_length = 10000
suhosin.cookie.max_vars = 2048
suhosin.get.disallow_nul = On
suhosin.get.disallow_ws = 0
suhosin.get.max_array_depth = 50
suhosin.get.max_array_index_length = 64
suhosin.get.max_name_length = 64
suhosin.get.max_totalname_length = 256
suhosin.get.max_value_length = 512
suhosin.get.max_vars = 2048
suhosin.perdir = 0
suhosin.coredump = Off
suhosin.post.disallow_nul = On
suhosin.post.disallow_ws = 0
suhosin.post.max_array_depth = 100
suhosin.post.max_array_index_length = 64
suhosin.post.max_name_length = 64
suhosin.post.max_totalname_length = 256
suhosin.post.max_value_length = 65000
suhosin.post.max_vars = 2048
suhosin.protectkey = On
suhosin.request.disallow_nul = On
suhosin.request.disallow_ws = 0
suhosin.request.max_array_depth = 100
suhosin.request.max_array_index_length = 64
suhosin.request.max_totalname_length = 256
suhosin.request.max_value_length = 65000
suhosin.request.max_varname_length = 64
suhosin.request.max_vars = 2048
suhosin.stealth = On
suhosin.upload.max_uploads = 25
suhosin.upload.disallow_elf = 1
suhosin.upload.disallow_binary = Off
suhosin.upload.remove_binary =
suhosin.upload.verification_script =
suhosin.session.max_id_length = 128
suhosin.simulation = Off
;************************************************* ***********************
; End suhosin Parameters
;************************************************* ***********************
save then restart apache
/sbin/service httpd restart
PHP Clamav
when done you see link look like
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
edit php.ini and add this at the end
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/clamav.so
[clamav]
clamav.dbpath=/var/lib/clamav
clamav.maxreclevel=0
clamav.maxfiles=0
clamav.archivememlim=0
clamav.maxfilesize=0
clamav.maxratio=0
save and restart apache
/sbin/service httpd restart
خداییش این آخر بنزین تموم کردم
شرمنده دیگه. امید وارم مفید بوده باشه. و شخصا از سازنده این اسکریپت + دوستای گلش که یکیشون دوست خود بنده هم هست قدر دانی میکنم.
اگرم کسی مشکلی داشت بگه . خودم اگه نتونستم بچه ها هست . بازم نشد از بچه های بالا میپرسیم میگیم
دوستان گل هم اگه لطف کنن در مورد برنامه های این سری اطلاعاتی دارن بگن. بدونیم به چه درد میخوره و معایب و محاسنش چیه.
بدرود
داشتم تو فروم directadmin چرخ میزدم چیز جالبی پیدا کردم کمه حتما به دردتون میخوره.
یه برنامه که در حقیقت میشه اینستالر معرفی کرد.
قابل اجرا روی :
RedHat Linux
RedHat Fedora
RedHat Enterprise
CentOS
Debian
باهاش میشه این برنامه ها رو نصب کرد : (فقط با یک خط دستور)
OpenSSL (You need to build ssh, apache, php, etc after upgrade)
Exim
OpenSSH
ProFTP
ProFTP with mod_clamav
phpMyAdmin
AVG
ClamAV
MODclamAV
MRTG
SquirrelMail
SquirrelMail full language pack
SpamAssassin
IMAP (You need to build php after upgrade)
MODsecurity 2.5.x (Apache 2.x Only)
MODsecurity 2.5.x Rules
MODsecurity 1.x (Apache 1.x Only)
MODsecurity 1.x Rules
MODevasive
KISS My Firewall
eAccelerator
Freetype
ImageMagick
GraphicsMagick
FFMPEG-php
PHP Clamav
Webmin control panel (You need to open one port 10000 in your firewall)
MailScanner
Suhosin
NoBody Check
خوب نحوه اجراشم راحته :
mkdir /usr/local/updatescript
cd /usr/local/updatescript
wget http://tools.web4host.net/update.script
chmod 755 update.script
خوب برای استفاده میتونید این رو وارد کنید ، یه متن کامل و قابل درک ظاهر میشه:
./update.script
برای بروز کردن اسکریپت هم از:
./update.script UPDATEME
و برای پاک کرد پوشه آپدیت : (حتما بعد از آپدیت خط زیر رو وارد کنید)
./update.script CLEAN
ورژن اسکریت هم با
./update.script DATE
یک سری کارها هم هست که بعد از نصب هر برنامه با این اسکریپت باید انجام بشه:
اگه ClamAV رو نصب کردید :
nano -w /etc/exim.conf
بعد از :
[QUOTE]
primary_hostname =
[/CODE]
خط زیر را اضافه کنید:
av_scanner = clamd:127.0.0.1 3310
بعد از :
check_message:
اضافه کنید:
deny message = This message contains malformed MIME ($demime_reason)
demime = *
condition = ${if >{$demime_errorlevel}{2}{1}{0}}
deny message = This message contains a virus or other harmful content ($malware_name)
demime = *
malware = *
deny message = This message contains an attachment of a type which we do not accept (.$found_extension)
demime = bat:com:pif:prf:scr:vbs
warn message = X-Antivirus-Scanner: Clean mail though you should still use an Antivirus
بعد save کنید و با دستور زیر exim را ری استارت کنید:
/sbin/service exim restart
ProFTP with mod_clamav
nano /etc/proftpd.conf
بعد خط زیر:
<IfModule mod_clamav.c>
ClamAV on
ClamServer 127.0.0.1
ClamPort 3310
</IfModule>
</Global> رو اضافه کنید و save و ری استارت:
/sbin/service proftpd restart
MODsecurity 2.x
nano -w /etc/httpd/conf/extra/httpd-includes.conf
اگه سیستم 32 بیتی هست ، کد زیر رو در قسمت آخر کپی کنید:
LoadFile /usr/lib/libxml2.so
LoadModule security2_module /usr/lib/apache/mod_security2.so
<IfModule mod_security2.c>
# ModSecurity2 ONLY
# Do not change anything in included files
#
Include /etc/modsecurity2/*.conf
</IfModule>
اگه سیستم 64 بیتی هست ، کد زیر رو در قسمت آخر کپی کنید:
# Use This
LoadFile /usr/lib64/libxml2.so
# If you dont have libxml2.so use
#LoadFile /usr/lib64/libxml2.so.2
LoadModule security2_module /usr/lib/apache/mod_security2.so
<IfModule mod_security2.c>
# ModSecurity2 ONLY
# Do not change anything in included files
#
Include /etc/modsecurity2/*.conf
</IfModule>
save and restart:
/sbin/service httpd restart
MODsecurity 1.x
nano -w /etc/httpd/conf/httpd.conf
کد زیر را اظافه کنید:
[/CODE]
<IfModule mod_security.c>
# Only inspect dynamic requests
# (YOU MUST TEST TO MAKE SURE IT WORKS AS EXPECTED)
#SecFilterEngine DynamicOnly
SecFilterEngine On
# Reject requests with status 500
SecFilterDefaultAction "deny,log,status:500"
# Some sane defaults
SecFilterScanPOST On
SecFilterCheckURLEncoding On
SecFilterCheckCookieFormat On
SecFilterCheckUnicodeEncoding Off
SecFilterNormalizeCookies On
# enable version 1 (RFC 2965) cookies
SecFilterCookieFormat 1
#SecServerResponseToken Off
#If you want to scan the output, uncomment these
#SecFilterScanOutput On
#SecFilterOutputMimeTypes "(null) text/html text/plain"
# Accept almost all byte values
SecFilterForceByteRange 1 255
# Server masking is optional
#fake server banner - NOYB used - no one needs to know what we are using
SecServerSignature "Power MOD by web4host.net"
#SecUploadDir /tmp
#SecUploadKeepFiles Off
# Only record the interesting stuff
SecAuditEngine RelevantOnly
#SecAuditLog logs/audit_log
# You normally won't need debug logging
#SecFilterDebugLevel 0
#SecFilterDebugLog logs/modsec_debug_log
# Mini Rules
Include /etc/modsecurity/mini.conf
</IfModule>
[/CODE]
و در آخر:
/sbin/service httpd restart
MODevasive
برای Apache 1
nano -w /etc/httpd/conf/httpd.conf
اضافه کنید:
<IfModule mod_evasive.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSWhitelist 127.0.0.1
DOSEmailNotify your-email@your-domain.tld
</IfModule>
و:
/sbin/service httpd restart
اما اگه جواب نداد :
/usr/local/directadmin/customapache/
httpd.conf رو ویرایش کنید :
nano -w /etc/httpd/conf/httpd.conf
و بعد از دستور :
LoadModule perl_module /usr/lib/apache/libperl.so
خط ریر رو اضافه کنید:
LoadModule evasive_module /usr/lib/apache/mod_evasive.so
بعد از:
<IfDefine HAVE_PYTHON>
AddModule mod_python.c
</IfDefine>
اضافه کنید:
AddModule mod_evasive.c
و در آخر:
/sbin/service httpd restart
برای Apache 2
nano -w /etc/httpd/conf/extra/httpd-includes.conf
خط زیر رو اضافه کنید:
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSWhitelist 127.0.0.1
DOSEmailNotify your-email@your-domain.tld
</IfModule>
و در آخر:
/sbin/service httpd restart
اگه خواستید امتحان کنید ، (DOSWhitelist) را از توی httpd.conf پاک کنید و بعد:
wget http://tools.web4host.net/modevasive/test.txt
mv test.txt test.pl
chmod 755 test.pl
./test.pl
KISS My Firewall
اینم فایروال فکر کنم جدید باشه، خودم تست نکردم اما تو اون پست نوشته بود که برای Direct Admin و Plesk وWebmin و cPanel کار میکنه .
قبل از اینکه راش بندازید حتما پرت SSH رو توی TCP_OUT و TCP_IN بزارید. اگه نذلرید تغریبا ... میشید
برای راه اندازی:
kiss start
برای متوقف کردن:
kiss stop
برای نمایش وضعیت
kiss status
اگه میخواید آی پی خاصی رو بلوک کنید ، برید اینجا /usr/bin/kiss و BLOCK_LIST رو ویرایش کنید و در آخر کار مثل همیشه :
kiss restart
خوب این فایر والم مثل بقیست باید برید پرتای حیاتی رو براش تعریف کنید و در آخر خودتون میدونید دیگه
یک نکته:
باید برید تو فایل گانفیگ این فایر وال محترم و بهش بگید از چه سیستم عاملی استفاده میکنید:
برای Pre Fedora Core 2 یا Red Hat کد زیر :
EXTN="o"
برای Fedore Core 2 و بالاتر از : (CentOS هم شامل این ردیف میشه قاط نزنید)
EXTN="ko"
eAccelerator
وقتی نصب شد یک لینک مثل لینک زیر بهتون میده:
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
بعد میدویی میری تو php.ini و اونجا بعد Windows Extensions همون dll های توش ، کد زیر رو میزاری: (البته با لینک که بهتون داده بعد نصب ، حتما چک کنید)
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
و در آخر همون کار تکراری
/sbin/service httpd restart
FFMPEG-php
بعد نصب یه لینک میده تهش مثل :
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/
که میری تو php.ini
extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so"
و همون کار تکراری معروف
/sbin/service httpd restart
Freetype
خوب اول از همه آپدیت:
cd /usr/local/directadmin/custombuild
./build clean
./build php n
حالا بریم سر آپاچی
cd /usr/local/directadmin/customapache/
Apache 1
nano -w configure.php
Apache 2
nano -w configure2.php
جایگزین کنید
--with-gd \
--with-gd-dir=/usr/local \
با
--with-gd \
--with-gd-dir=/usr/local/lib \
--with-freetype \
--with-freetype-dir=/usr/local/lib \
سیوش کنید و خط زیر رو اجرا کنید.
./build clean
./build gd
Apache 1
./build clean
./build gd
./build php n
service httpd restart
Apache 2
./build clean
./build gd
./build php_ap2 n
service httpd restart
ImageMagick
بعد نصب :
cd /usr/local/directadmin/custombuild
./build clean
اگه از php 5 استفاده میکنید ، configure.php5ویرایش کنید و اگه از ورژن دیگه استفاده میکنید ، فایل مربوط به ان رو ویرایش کنید
Apache 1
nano -w /usr/local/directadmin/custombuild/configure/ap1/configure.php5
Apache 2
nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5
اضافه کنید:
--with-imagick=/usr/local \
بعد از
--with-freetype-dir=/usr/local/lib \
و ذخیره و
./build php n
GraphicsMagick
cd /usr/local/directadmin/custombuild
./build clean
اگه از php 5 استفاده میکنید ، configure.php5ویرایش کنید و اگه از ورژن دیگه استفاده میکنید ، فایل مربوط به ان رو ویرایش کنید
Apache 1
nano -w /usr/local/directadmin/custombuild/configure/ap1/configure.php5
Apache 2
nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5
اضافه کنید
--with-gmagick=/usr/local \
بعد از
--with-freetype-dir=/usr/local/lib \
ذخره کنید و
./build php n
IMAP
Apache 1
nano -w configure.php
Apache 2
nano -w configure2.php
اضافه کنید
--with-imap=/usr/local/imap-2004c1 \
بعد از
--with-zip \
ذخیره و در آخر همون کار تکراری یعنی:
service httpd restart
AVG Anti-Virus
خوب با دستور زیر میتونید کل پوشه های داخل دایرکتوری home را اسکن کنید:
avgscan -clean -ext=* -rt -arc /home
و با این دستور کل دایرکتوری home بدون فایل های آرشیو:
avgscan -clean -ext=* -rt /home
و برای بروز رسانی:
avgupdate --path="/opt/avg/avg8/update/download"
Nobody Check Security Tool
The Nobody Check tool is a new and unique security tool that can detect malicious processes that are running on your Linux server and report them to you in real time or by email. The tool can be configured to run at selected times and doesn’t eat up resources or interfere with server operations.
اونجور که من فهمیدم یه اسکریپت جدید هستش که هاگه یکی از کاربراتتون اسکریپت که به cpu فشار میاره رو فعال کنه به شما اعلام میکنه. من که کار نکردم باهاش ولی بنظر بدک نمیاد.
MailScanner
ویرایش کنید:
nano -w /etc/exim.conf
پیدا کنید (Ctrl + W)
primary_hostname
اضافه کنید
spool_directory = /var/spool/exim.in
queue_only = true
queue_only_override = false
ویرایش
nano -w /etc/init.d/exim
جستجو
QUEUE=
[ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim
[ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -bd"
[ -n "$QUEUE" ] && EXIM_OPTS="$EXIM_OPTS -q$QUEUE"
جایگذین کنید با
QUEUE="15m"
[ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim
[ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -bd"
[ -f /etc/sysconfig/exim ] && . /etc/sysconfig/exim
[ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -C /etc/exim_outgoing.conf"
[ -n "$QUEUE" ] && EXIM_OPTS="$EXIM_OPTS -q$QUEUE"
ویرایش
nano -w /opt/MailScanner/etc/MailScanner.conf
و اطالاع خود رو صحیح وارد کنید
%org-name% = yoursite
%org-long-name% = Your Organisation Name Here
%web-site% = www.your-organisation.com
جستجو کنید و تنظیم کنید
Run As User = mail
Run As Group = mail
Incoming Queue Dir = /var/spool/exim.in/input
Outgoing Queue Dir = /var/spool/exim/input
MTA = exim
Sendmail = /usr/sbin/exim -C /etc/exim.conf
Sendmail2 = /usr/sbin/exim -C /etc/exim_outgoing.conf
Virus Scanners = none
Use SpamAssassin = yes
Always Include SpamAssassin Report = yes
خوب الان برای اینکه میل سرور رو با انتی ویروس خود تنظیم کنید:
nano -w /opt/MailScanner/etc/MailScanner.conf
جستجو:
Virus Scanners = none
جایگذین با
Virus Scanners = avg
و همون کار تکراریه
killall -9 MailScanner
/opt/MailScanner/bin/check_mailscanner
ویرایش
nano -w /etc/crontab
افزودن
37 5 * * * /opt/MailScanner/bin/update_phishing_sites
07 * * * * /opt/MailScanner/bin/update_bad_phishing_sites
58 23 * * * /opt/MailScanner/bin/clean.quarantine
3,23,43 * * * * /opt/MailScanner/bin/check_mailscanner
# Remove # if you want MailScanner to update anti virus
#42 * * * * /opt/MailScanner/bin/update_virus_scanners
الان دیگه برید حالشو ببرید.
MODclamAV
nano -w /etc/httpd/conf/extra/httpd-includes.conf
and add this
# mod ClamAV
Include conf/extra/mod_clamav.conf
save then restart apache
/sbin/service httpd restart
Suhosin
nano -w /usr/local/lib/php.ini
and add this at then end
;************************************************* ***********************
; suhosin Parameters
; For a full list of parameters and their documentation go to:
; (http://www.hardened-php.net/suhosin/configuration.html)
;************************************************* ***********************
[suhosin]
extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/suhosin.so"
; Logging Configuration
# Use your link in place of web4host.net
suhosin.filter.action = [302,]http://www.web4host.net/index.php
suhosin.log.syslog.facility = 9
suhosin.log.syslog.priority = 1
suhosin.log.use-x-forwarded-for = Off
; Executor Options
suhosin.executor.max_depth = 0
suhosin.executor.include.max_traversal = 4
suhosin.executor.include.whitelist =
#suhosin.executor.include.blacklist = "php://, http://, ftp://, gzip://,https://, ftps://, compress.zlib://"
suhosin.executor.include.blacklist = "php://, http://, ftp://, gzip://,https://, ftps://"
suhosin.executor.func.whitelist =
suhosin.executor.func.blacklist = system, shell_exec, exec, passthru, php_uname, popen, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_uname, proc_close, proc_nice, proc_open, proc_terminate
#suhosin.executor.func.blacklist = dl, system, passthru, pclose, proc_nice, proc_terminate, posix_getpwuid, posix_uname, pfosckopen, leak, posix_setuid, escapeshellcmd, escapeshellarg, hypot, pg_host, pos, posix_access, posix_getcwd, posix_getgid, posix_getservbyname,myshellexec,getpid, posix_getsid, posix_isatty, posix_kill, posix_mkfifo, posix_mknod, posix_setgid, posix_setsid, posix_setuid, posix_times, posix_uname, ps_fill, posix_getpwuid, ini_restore, symlink, ini_get_all, zip_open, zip_read, rar_open, bzopen, bzread, bzwrite, shellcode, backtick, cmd, virtual, pcntl_exec, ini_alter, show_source, apache_get_modules, apache_get_version, apache_note, openlog, tmpfile, crack_check, crack_closedict, php_ini_scanned_files, inurl, apache_setenv, closelog, debugger_off, debugger_on, define_syslog_variables, syslog, ftp_exec, posix_setpgid, posix_setsid, posix_setuid, get_current_user, getmyuid, getmygid, listen, netscript, ini_restore, php.ini, id, popen, shell_exec, php_uname, getPath, dir_writeable, read_dir, execute_command, diskfreespace, disk_total_space, proc_open, switch, mkdir
suhosin.executor.eval.whitelist =
suhosin.executor.eval.blacklist =
suhosin.executor.allow_symlink = Off
suhosin.executor.disable_emodifier = Off
suhosin.executor.disable_eval = Off
; Misc Options
suhosin.apc_bug_workaround = Off
suhosin.sql.bailout_on_error = Off
suhosin.sql.comment = 0
suhosin.sql.multiselect = 0
suhosin.sql.opencomment = 0
suhosin.sql.union = 0
suhosin.sql.user_postfix =
suhosin.sql.user_prefix =
suhosin.multiheader = Off
suhosin.memory_limit = 128
suhosin.mail.protect = 1
; Transparent Encryption Options
suhosin.session.encrypt = On
suhosin.session.cryptkey =
suhosin.session.cryptua = On
suhosin.session.cryptdocroot = On
suhosin.session.cryptraddr = 0
suhosin.session.checkraddr = 0
suhosin.session.max_id_length = 128
suhosin.cookie.checkraddr = 0
suhosin.cookie.cryptdocroot = On
suhosin.cookie.cryptkey =
suhosin.cookie.cryptlist =
suhosin.cookie.cryptraddr = 0
suhosin.cookie.cryptua = On
suhosin.cookie.disallow_nul = 1
suhosin.cookie.disallow_ws = 0
suhosin.cookie.encrypt = On
suhosin.cookie.plainlist =
; Filtering Optionins
suhosin.cookie.max_array_depth = 100
suhosin.cookie.max_array_index_length = 64
suhosin.cookie.max_name_length = 64
suhosin.cookie.max_totalname_length = 256
suhosin.cookie.max_value_length = 10000
suhosin.cookie.max_vars = 2048
suhosin.get.disallow_nul = On
suhosin.get.disallow_ws = 0
suhosin.get.max_array_depth = 50
suhosin.get.max_array_index_length = 64
suhosin.get.max_name_length = 64
suhosin.get.max_totalname_length = 256
suhosin.get.max_value_length = 512
suhosin.get.max_vars = 2048
suhosin.perdir = 0
suhosin.coredump = Off
suhosin.post.disallow_nul = On
suhosin.post.disallow_ws = 0
suhosin.post.max_array_depth = 100
suhosin.post.max_array_index_length = 64
suhosin.post.max_name_length = 64
suhosin.post.max_totalname_length = 256
suhosin.post.max_value_length = 65000
suhosin.post.max_vars = 2048
suhosin.protectkey = On
suhosin.request.disallow_nul = On
suhosin.request.disallow_ws = 0
suhosin.request.max_array_depth = 100
suhosin.request.max_array_index_length = 64
suhosin.request.max_totalname_length = 256
suhosin.request.max_value_length = 65000
suhosin.request.max_varname_length = 64
suhosin.request.max_vars = 2048
suhosin.stealth = On
suhosin.upload.max_uploads = 25
suhosin.upload.disallow_elf = 1
suhosin.upload.disallow_binary = Off
suhosin.upload.remove_binary =
suhosin.upload.verification_script =
suhosin.session.max_id_length = 128
suhosin.simulation = Off
;************************************************* ***********************
; End suhosin Parameters
;************************************************* ***********************
save then restart apache
/sbin/service httpd restart
PHP Clamav
when done you see link look like
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
edit php.ini and add this at the end
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/clamav.so
[clamav]
clamav.dbpath=/var/lib/clamav
clamav.maxreclevel=0
clamav.maxfiles=0
clamav.archivememlim=0
clamav.maxfilesize=0
clamav.maxratio=0
save and restart apache
/sbin/service httpd restart
خداییش این آخر بنزین تموم کردم
شرمنده دیگه. امید وارم مفید بوده باشه. و شخصا از سازنده این اسکریپت + دوستای گلش که یکیشون دوست خود بنده هم هست قدر دانی میکنم.
اگرم کسی مشکلی داشت بگه . خودم اگه نتونستم بچه ها هست . بازم نشد از بچه های بالا میپرسیم میگیم
دوستان گل هم اگه لطف کنن در مورد برنامه های این سری اطلاعاتی دارن بگن. بدونیم به چه درد میخوره و معایب و محاسنش چیه.
بدرود