Login to the server using Root account.
Create a new account:
groupadd apache useradd -g apache -d /dev/null -s /bin/false apache passwd apache passwd -l apacheMount Solaris 10 DVD, and move to the packages folder:
cd /cdrom/sol_10_1008_x86/Solaris_10/ProductRun the command bellow to install Apache2 packages:
pkgadd -d . SUNWapch2r SUNWapch2uRemove Default Content
rm -r /var/apache2/htdocs/ rm -r /var/apache2/cgi-bin/ rm -r /var/apache2/icons/Updating Ownership and Permissions on Apache2 folders:
chown -R root:root /usr/apache2 chmod -R 770 /usr/apache2/bin chown -R root:root /etc/apache2 chmod -R go-r /etc/apache2 chmod -R 770 /etc/apache2 chown -R root:root /var/apache2/logs chmod -R 700 /var/apache2/logsCreate folder for the web content:
mkdir -p /wwwUpdating Ownership and Permissions on the web content folder:
chown -R root /www chmod -R 775 /wwwCopy the configuration file in-order to edit it:
cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.confEdit using VI the file /etc/apache2/httpd.conf and change the following strings: From:
# LockFile /var/apache2/logs/accept.lockTo:LockFile /var/apache2/logs/accept.lockFrom:
User webservdTo:User apacheFrom:Group webservdTo:Group apacheFrom:PidFile /var/run/apache2/httpd.pidTo:PidFile /var/apache2/logs/httpd.pidFrom:DocumentRoot "/var/apache2/htdocs"To:DocumentRoot "/www"From:
ServerSignature OnTo:ServerSignature Off HostnameLookups OffFrom:
# ServerTokensTo:ServerTokens ProdFrom:
ServerAdmin you@yourhost.comTo:_ServerAdmin_ [_webmaster@yourcompany.com_](mailto:webmaster@yourcompany.com)From:
ServerName 127.0.0.1To:_ServerName Server_FQDN_From:Timeout 300To:Timeout 60From:
LogLevel warnTo:LogLevel noticeFrom:
IndexOptions FancyIndexing VersionSortTo:# IndexOptions FancyIndexing VersionSortFrom:
ReadmeName README.htmlTo:# ReadmeName README.htmlFrom:
HeaderName HEADER.htmlTo:# HeaderName HEADER.htmlFrom:
AddIconTo:# AddIconFrom:
DefaultIcon /icons/unknown.gifTo:# DefaultIcon /icons/unknown.gifFrom:
Alias /icons/ "/var/apache2/icons/"To:# Alias /icons/ "/var/apache2/icons/"From:
AliasMatchTo:# AliasMatchFrom:
ScriptAliasTo:# ScriptAliasFrom:
LoadModule proxy_ftp_module libexec/mod_proxy_ftp.soTo:# LoadModule proxy_ftp_module libexec/mod_proxy_ftp.soFrom
LoadModule imap_module libexec/mod_imap.soTo:# LoadModule imap_module libexec/mod_imap.soFrom:
LoadModule cgi_module libexec/mod_cgi.soTo:# LoadModule cgi_module libexec/mod_cgi.soFrom:
LoadModule suexec_module libexec/mod_suexec.soTo:# LoadModule suexec_module libexec/mod_suexec.soFrom:
LoadModule autoindex_module libexec/mod_autoindex.soTo:# LoadModule autoindex_module libexec/mod_autoindex.soFrom:
LoadModule info_module libexec/mod_info.soTo:# LoadModule info_module libexec/mod_info.soFrom:
LoadModule status_module libexec/mod_status.soTo:# LoadModule status_module libexec/mod_status.soFrom:
LoadModule status_module libexec/mod_status.soTo:# LoadModule status_module libexec/mod_status.soFrom:
LoadModule userdir_module libexec/mod_userdir.soTo:# LoadModule userdir_module libexec/mod_userdir.soFrom:
LoadModule cern_meta_module modules/mod_cern_meta.soTo:# LoadModule cern_meta_module modules/mod_cern_meta.soFrom:
LoadModule dav_module modules/mod_dav.soTo:# LoadModule dav_module modules/mod_dav.soFrom:
<Directory /> Options FollowSymLinks AllowOverride None </Directory>To:<Directory /> Options None AllowOverride None Order deny,allow deny from all </Directory>From:
<Directory "/var/apache2/htdocs">To:<Directory "/www"> <Limitexcept GET POST> deny from all </Limitexcept>From:
Options Indexes FollowSymLinksTo:Options -FollowSymLinks -Includes -Indexes -MultiViewsAdd the following sections to the end of the httpd.conf file:
LimitRequestBody 10000 LimitRequestFields 40 LimitRequestFieldSize 100 LimitRequestLine 500Remove the sections bellow from the file httpd.conf
<Directory "/usr/apache2/manual"> <Directory "/var/apache2/cgi-bin">Edit using VI the file /usr/apache2/include/ap_release.h and change the following strings: From:
#define AP_SERVER_BASEVENDOR "Apache Software Foundation"To:#define AP_SERVER_BASEVENDOR "Restricted server"From:#define AP_SERVER_BASEPRODUCT "Apache"To:#define AP_SERVER_BASEPRODUCT "Secure Web Server"Starting Apache from command line:
/usr/apache2/bin/apachectl startRun the command bellow to start the Apache service at server start-up:
svcadm enable apache2
Hardening guide for Apache 2.0 on Solaris 10 platform
·463 words·3 mins
