PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : مقاله ای برای امن کردن اپاچی



mehrserver
July 5th, 2009, 19:20
سلام.
از امروز قصد دارم که هرچی مقاله و فیلم های امنیتی که حتی برای پریوات تیمم بوده پابلیک کنم
فیلم ها همش درباره هم سرور هست که اگر مدیران اجازه دهند به بعضی از کاربران بدم!
این مقاله هم که میخوهم بدم برای امن کردن اپاچی هست که به بیشتر نکات توجه کرده
که توسط یکی از دوستانم در فروم شب گر د وجود داشته
دانلود مقاله با حجم حدود 60 کیلوبایت

Download (http://parsih.persiangig.com/document/secure-apache.pdf)

Dont Forget Thanks...

HugeServer
October 7th, 2009, 17:59
http://www.persiangig.com/pages/download/?dl=http://parsih.persiangig.com/document/secure-apache.pdf

Sajad
October 7th, 2009, 18:02
salam
linke maghalaton moshkel dare age mishe dorstesh bezaeid mamnon mishamagar maghale darmorde apache dar linux darid baraie man mail konid manon misham
nhadadzadeh@yahoo.com



سلام. ورودتون رو خوش آمد ميگم
لطفا فينگليش تايپ نكنيد دوست عزيز.

Desperados
October 12th, 2009, 12:56
خوب من مقاله به زبان انگلیسی رو پیدا کردم توضیحات بیشتری راجع به هر قسمت داده
میشه دوستان یک توضیحی درباره نحوه اجرای این دستورات بدهند ؟ مثلا


ServerSignature Off
ServerTokens Prod

رو باید در فایل کانفیگ وارد کنیم ؟ کجا وارد کنیم ؟ :106:
کلاً ممنون میشم یک توضیحی درباره نحوه انجام این دستورات بدین



First, make sure you've installed latest security patches
There is no sense in putting locks on the windows, if your door is wide open. As such, if you're not patched up there isn't really much point in continuing any longer on this list. Go ahead and bookmark this page so you can come back later, and patch your server.

Hide the Apache Version number, and other sensitive information.
By default many Apache installations tell the world what version of Apache you're running, what operating system/version you're running, and even what Apache Modules are installed on the server. Attackers can use this information to their advantage when performing an attack. It also sends the message that you have left most defaults alone.

There are two directives that you need to add, or edit in your httpd.conf file:

ServerSignature Off
ServerTokens Prod

The ServerSignature appears on the bottom of pages generated by apache such as 404 pages, directory listings, etc.

The ServerTokens directive is used to determine what Apache will put in the Server HTTP response header. By setting it to Prod it sets the HTTP response header as follows:

Server: ApacheIf you're super paranoid you could change this to something other than "Apache" by editing the source code, or by using mod_security (see below).

Make sure apache is running under its own user account and group
Several apache installations have it run as the user nobody. So suppose both Apache, and your mail server were running as nobody an attack through Apache may allow the mail server to also be compromised, and vise versa.

User apache
Group apache
Ensure that files outside the web root are not served
We don't want apache to be able to access any files out side of its web root. So assuming all your web sites are placed under one directory (we will call this /web), you would set it up as follows:

<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /web>
Order Allow,Deny
Allow from all
</Directory>
«Note that because we set Options None and AllowOverride None this will turn off all options and overrides for the server. You now have to add them explicitly for each directory that requires an Option or Override.»
Turn off directory browsing
You can do this with an Options directive inside a Directory tag. Set Options to either None or -Indexes

Options -IndexesTurn off server side includes
This is also done with the Options directive inside a Directory tag. Set Options to either None or -Includes

Options -IncludesTurn off CGI execution
If you're not using CGI turn it off with the Options directive inside a Directory tag. Set Options to either None or -ExecCGI

Options -ExecCGIDon't allow apache to follow symbolic links
This can again can be done using the Options directive inside a Directory tag. Set Options to either None or -FollowSymLinks

Options -FollowSymLinksTurning off multiple Options
If you want to turn off all Options simply use:

Options NoneIf you only want to turn off some separate each option with a space in your Options directive:

Options -ExecCGI -FollowSymLinks -IndexesTurn off support for .htaccess files
This is done in a Directory tag but with the AllowOverride directive. Set it to None.

AllowOverride NoneIf you require Overrides ensure that they cannot be downloaded, and/or change the name to something other than .htaccess. For example we could change it to .httpdoverride, and block all files that start with .ht from being downloaded as follows:

AccessFileName .httpdoverride
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
Run mod_security
mod_security is a super handy Apache module written by Ivan Ristic, the author of Apache Security from O'Reilly press.

You can do the following with mod_security:

•Simple filtering
•Regular Expression based filtering
•URL Encoding Validation
•Unicode Encoding Validation
•Auditing
•Null byte attack prevention
•Upload memory limits
•Server identity masking
•Built in Chroot support
•And more
Disable any unnecessary modules
Apache typically comes with several modules installed. Go through the apache module documentation and learn what each module you have enabled actually does. Many times you will find that you don't need to have the said module enabled.

Look for lines in your httpd.conf that contain LoadModule. To disable the module you can typically just add a # at the beginning of the line. To search for modules run:

grep LoadModule httpd.confHere are some modules that are typically enabled but often not needed: mod_imap, mod_include, mod_info, mod_userdir, mod_status, mod_cgi, mod_autoindex.

Make sure only root has read access to apache's config and binaries
This can be done assuming your apache installation is located at /usr/local/apache as follows:

chown -R root:root /usr/local/apache
chmod -R o-rwx /usr/local/apache
Lower the Timeout value
By default the Timeout directive is set to 300 seconds. You can decrease help mitigate the potential effects of a denial of service attack.

Timeout 45Limiting large requests
Apache has several directives that allow you to limit the size of a request, this can also be useful for mitigating the effects of a denial of service attack.

A good place to start is the LimitRequestBody directive. This directive is set to unlimited by default. If you are allowing file uploads of no larger than 1MB, you could set this setting to something like:

LimitRequestBody 1048576If you're not allowing file uploads you can set it even smaller.

Some other directives to look at are LimitRequestFields, LimitRequestFieldSize and LimitRequestLine. These directives are set to a reasonable defaults for most servers, but you may want to tweak them to best fit your needs. See the documentation for more info.

Limiting the size of an XML Body
If you're running mod_dav (typically used with subversion) then you may want to limit the max size of an XML request body. The LimitXMLRequestBody directive is only available on Apache 2, and its default value is 1 million bytes (approx 1mb). Many tutorials will have you set this value to 0 which means files of any size may be uploaded, which may be necessary if you're using WebDAV to upload large files, but if you're simply using it for source control, you can probably get away with setting an upper bound, such as 10mb:

LimitXMLRequestBody 10485760Limiting Concurrency
Apache has several configuration settings that can be used to adjust handling of concurrent requests. The MaxClients is the maximum number of child processes that will be created to serve requests. This may be set too high if your server doesn't have enough memory to handle a large number of concurrent requests.

Other directives such as MaxSpareServers, MaxRequestsPerChild, and on Apache2 ThreadsPerChild, ServerLimit, and MaxSpareThreads are important to adjust to match your operating system, and hardware.

Restricting Access by IP
If you have a resource that should only by accessed by a certain network, or IP address you can enforce this in your apache configuration. For instance if you want to restrict access to your intranet to allow only the 176.16 network:


Order Deny,Allow
Deny from all
Allow from 176.16.0.0/16

Or by IP:

Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Adjusting KeepAlive settings
According to the Apache documentation using HTTP Keep Alive's can improve client performance by as much as 50%, so be careful before changing these settings, you will be trading performance for a slight denial of service mitigation.

KeepAlive's are turned on by default and you should leave them on, but you may consider changing the MaxKeepAliveRequests which defaults to 100, and the KeepAliveTimeout which defaults to 15. Analyze your log files to determine the appropriate values.

Run Apache in a Chroot environment
chroot allows you to run a program in its own isolated jail. This prevents a break in on one service from being able to effect anything else on the server.

It can be fairly tricky to set this up using chroot due to library dependencies. I mentioned above that the mod_security module has built in chroot support. It makes the process as simple as adding a mod_security directive to your configuration:

SecChrootDir /chroot/apache

HugeServer
October 12th, 2009, 13:08
There are two directives that you need to add, or edit in your httpd.conf file:

ServerSignature Off
ServerTokens Prod





همان طور كه اینجا گفته در فایل httpd.conf باید اینرو ست کنی .

KamranOnline
October 12th, 2009, 14:03
ممنون، متود های خوبی بود ولی چند تا نکته
1 - AllowOverRide ها خیلی وقت ها نمی شه None گذاشت ! مثلا برای Mod_Rewrite , ...
2 - Options ها روی سیستم suPHP غیر قابل اجرا هستند !
3 - User , Group ها الزاما نباید توسط Apache اجرا شوند و در سیستم های su دار فرق می کنه
و ...

tinavps
June 23rd, 2011, 11:05
برای
ServerSignature Off
ServerTokens Prod
باید mod_head نصب باشه وگر نه سایت ها می خوابند
اگر overrite none کنی مشتری نمی تونه .htaccess بسازه شاکی میشه

مواردی ذکر شد سکیوری نیست جنبه های مخفی سازی اطلاعات وب سرور در هدر هست

abolfazlgoodarzi
January 1st, 2012, 23:38
There are two directives that you need to add, or edit in your httpd.conf file:

ServerSignature Off
ServerTokens Prod





همان طور كه اینجا گفته در فایل httpd.conf باید اینرو ست کنی .




سلام. این خیلی توی بحث امنیت ربطی نداره و بیشتر مشکل سازه تا تامین امنیت!

hamidjooni
January 1st, 2012, 23:47
متشکر!

tinavps
January 1st, 2012, 23:56
تاموقعی که مشکلات بعد از ست کردنش رو ذکر نکنی تحت عنوان موارد امنیتی باقی می مونه.
یکی دیگر از موارد امنیتی حذف آپاچی و استفاده از nginx هست. تسلیت به تمام استفاده کنندگان آپاچی.
بنده .net رو سفارش می کنم اما اگر مشتری کم هزینه طراحی و ... رو داد با جوملا php. حالا بماند.

---------- Post added at 11:56 PM ---------- Previous post was at 11:48 PM ----------

آقای حمیدجونی امروز شما همه جا کامنت گذاشتی
اما باور کن بخش انجمن قسمت فروش سرور و هاستینگ آش پخش نمی کنند مشتری دنبال هاستینگ خفن + امنیت+پشتیبانی 25 ساعت در روز میگرده با ماهانه هزار تومان میگی نه ؟ 100 تا اسپم که رسیدی برو ببین ماچی دیدیم...

ArtexGroup
January 2nd, 2012, 00:23
سومین سالگرد تاپیک بهتون تبریک میگم !
یه نگاهی به استارت تاپیک بندازید بد نیستا !

tinavps
January 2nd, 2012, 00:25
رومئو و ژولیت در سال 1 میلادی نوشته شد اما هستند کسانی که در 2012 هم علاقه ای به خواندنش داشته باشند...