Der Perfekte Server – Fedora 15 x86_64 [ISPConfig 3]

15 Installation von Amavisd-new, SpamAssassin und ClamAV

Um amavisd-new, spamassassin und clamav zu installieren, führen Sie folgenden Befehl aus:

yum install amavisd-new spamassassin clamav
clamav-data clamav-server clamav-update unzip bzip2 perl-DBD-mysql

Bei der Installation von ClamAV wurde ein Cron Job mitinstalliert, welcher alle drei Stunden versucht die ClamAV Virusdatenbank zu
aktualisieren. Dies funktioniert jedoch nur, wenn man es in /etc/sysconfig/freshclam und /etc/freshclam.conf erlaubt:

vi /etc/sysconfig/freshclam

Kommentieren Sie die Zeile FRESHCLAM_DELAY am Ende des Dokumentes aus:

## When changing the periodicity of freshclam runs in the crontab,
## this value must be adjusted also. Its value is the timespan between
## two subsequent freshclam runs in minutes. E.g. for the default
##
## | 0 */3 * * * ...
##
## crontab line, the value is 180 (minutes).
# FRESHCLAM_MOD=

## A predefined value for the delay in seconds. By default, the value is
## calculated by the 'hostid' program. This predefined value guarantees
## constant timespans of 3 hours between two subsequent freshclam runs.
##
## This option accepts two special values:
## 'disabled-warn' ... disables the automatic freshclam update and
## gives out a warning
## 'disabled' ... disables the automatic freshclam silently
# FRESHCLAM_DELAY=

### !!!!! REMOVE ME !!!!!!
### REMOVE ME: By default, the freshclam update is disabled to avoid
### REMOVE ME: network access without prior activation
#FRESHCLAM_DELAY=disabled-warn # REMOVE ME

vi /etc/freshclam.conf

Kommentieren Sie die Zeile Example aus:

[...]
# Comment or remove the line below.
#Example
[...]

Starten Sie danach freshclam, amavisd, und clamd…

sa-update

chkconfig –levels 235 amavisd on

chkconfig –levels 235 clamd.amavisd on

/usr/bin/freshclam

/etc/init.d/amavisd start

/etc/init.d/clamd.amavisd start

Führen Sie dann folgende Befehle aus:

rm -f /var/spool/amavisd/clamd.sock

mkdir /var/run/clamav.amavisd /var/run/clamd.amavisd /var/run/amavisd

chown amavis /var/run/clamav.amavisd

chown amavis /var/run/clamd.amavisd

chown amavis /var/run/amavisd

ln -sf /var/spool/amavisd/clamd.sock /var/run/clamav.amavisd/clamd.sock

ln -sf /var/spool/amavisd/clamd.sock /var/run/clamd.amavisd/clamd.sock

/etc/init.d/clamd.amavisd restart

Fedora 15 hat ein /run Verzeichnis, um Laufzeitdaten zu speichern. /run ist derzeit ein tmpfs, und /var/run und /var/lock sind derzeit von tmpfs an /run und /run/lock bind mounted, und werden deshalb beim Systemneustart geleert (sehen Sie sich für mehr Details https://docs.fedoraproject.org/en-US/Fedora/15/html/Release_Notes/sect-Release_Notes-Changes_for_SysAdmin.html an).

Das bedeutet, dass die Verzeichnisse /var/run/clamav.amavisd, /var/run/clamd.amavisd und /var/run/amavisd welche wir gerade erstellt haben, nach dem Systemneustart verloren gehen werden und clamd und amavisd deshalb nicht starten werden können. Aus diesem Grund erstellen wir nun die Datei /etc/tmpfiles.d/amavisd.conf welche die Verzeichnisse beim Systemstart erstellt (sehen Sie für mehr Details auf http://0pointer.de/public/systemd-man/tmpfiles.d.html nach):

vi /etc/tmpfiles.d/amavisd.conf

D /var/run/clamav.amavisd 0755 amavis root -
D /var/run/clamd.amavisd 0755 amavis root -
D /var/run/amavisd 0755 amavis root -

16 Installation von mod_php, mod_fcgi/PHP5 und suPHP

ISPConfig 3 erlaubt es Ihnen mod_php, mod_fcgi/PHP5, cgi/PHP5 und suPHP auf einer pro-Website-Basis zu benutzen.

Sie können Apache2 mit mod_php5, mod_fcgid und PHP5 folgendermaßen installieren:

yum install php php-devel php-gd php-imap php-ldap
php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt
php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl
ImageMagick libxml2 libxml2-devel mod_fcgid php-cli httpd-devel

Als nächstes öffnen Sie /etc/php.ini

vi /etc/php.ini

… ändern das Fehleranzeigeverhalten (sodass Meldungen nicht mehr angezeigt werden)  und entkommentieren cgi.fix_pathinfo=1:

[...]
;error_reporting = E_ALL & ~E_DEPRECATED
error_reporting = E_ALL & ~E_NOTICE
[...]
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo
cgi.fix_pathinfo=1
[...]

Als nächstes installieren Sie suPHP:

cd /tmp

wget http://www.suphp.org/download/suphp-0.7.1.tar.gz

tar xvfz suphp-0.7.1.tar.gz

cd suphp-0.7.1/

./configure –prefix=/usr –sysconfdir=/etc
–with-apr=/usr/bin/apr-1-config –with-apxs=/usr/sbin/apxs
–with-apache-user=apache –with-setid-mode=owner
–with-php=/usr/bin/php-cgi –with-logfile=/var/log/httpd/suphp_log
–enable-SUPHP_USE_USERGROUP=yes

make

make install

Dann fügen Sie das suPHP Modul Ihrer Apache Konfiguration hinzu…

vi /etc/httpd/conf.d/suphp.conf

LoadModule suphp_module modules/mod_suphp.so

… und erstellen die Datei /etc/suphp.conf wie folgt:

vi /etc/suphp.conf

[global]
;Path to logfile
logfile=/var/log/httpd/suphp.log

;Loglevel
loglevel=info

;User Apache is running as
webserver_user=apache

;Path all scripts have to be in
docroot=/

;Path to chroot() to before executing script
;chroot=/mychroot

; Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true

;Send minor error messages to browser
errors_to_browser=false

;PATH environment variable
env_path=/bin:/usr/bin

;Umask to set, specify in octal notation
umask=0077

; Minimum UID
min_uid=100

; Minimum GID
min_gid=100

[handlers]
;Handler for php-scripts
x-httpd-suphp="php:/usr/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

Schließlich starten Sie Apache neu:

/etc/init.d/httpd restart

16.1 Ruby

Ab Version 3.0.3 hat ISPConfig 3 eingebaute Unterstützung für Ruby. Statt CGI/FastCGI zu benutzen, ist ISPConfig davon abhängig dass mod_ruby im Apache des Servers verfügbar ist.

Für Fedora 15 ist kein mod_ruby Paket verfügbar, deshalb müssen Sie es selbst kompilieren.  Installieren Sie dazu zunächst alle benötigten Pakete:

yum install ruby ruby-devel

Als nächstes laden Sie mod_ruby herunter und installieren es folgendermaßen:

cd /tmp

wget http://modruby.net/archive/mod_ruby-1.3.0.tar.gz

tar zxvf mod_ruby-1.3.0.tar.gz

cd mod_ruby-1.3.0/

./configure.rb –with-apr-includes=/usr/include/apr-1

make

make install

Als letztes integrieren Sie mod_ruby in Ihre Apache Konfiguration, deshalb erstellen Sie die Datei /etc/httpd/conf.d/ruby.conf

vi /etc/httpd/conf.d/ruby.conf

LoadModule ruby_module modules/mod_ruby.so
RubyAddPath /1.8

… und starten Apache neu:

/etc/init.d/httpd restart

(Sollten Sie den Pfad RubyAddPath /1.8 weglassen, werden Sie Fehler wie den folgenden im Apache Errorlog sehen, wenn Sie Rubydateien aufrufen.

[Thu May 26 02:05:05 2011] [error] mod_ruby:
ruby:0:in `require‘: no such file to load — apache/ruby-run (LoadError)

[Thu May 26 02:05:05 2011] [error] mod_ruby: failed to require
apache/ruby-run

[Thu May 26 02:05:05 2011] [error] mod_ruby: error in ruby

)

16.2 WebDAV

WebDAV sollte bereits aktiviert sein, aber um es zu überprüfen, öffnen Sie /etc/httpd/conf/httpd.conf und stellen Sie sicher, dass die folgenden drei Module aktiv sind:

vi /etc/httpd/conf/httpd.conf

[...]
LoadModule auth_digest_module modules/mod_auth_digest.so
[...]
LoadModule dav_module modules/mod_dav.so
[...]
LoadModule dav_fs_module modules/mod_dav_fs.so
[...]

Sollten Sie /etc/httpd/conf/httpd.conf editieren müssen, vergessen Sie danach nicht Apache neu zu starten:

/etc/init.d/httpd restart

17 Installation PureFTPd

PureFTPd kann mit dem folgenden Befehl installiert werden:

yum install pure-ftpd

Dann erstellen wir die Systemstartlinks für PureFTPd und starten es:

chkconfig –levels 235 pure-ftpd on

/etc/init.d/pure-ftpd start

Nun konfigurieren Sie PureFTPd so, dass es FTP und TLS Sizungen erlaubt. FTP ist ein sehr unsicheres Protokoll, da alle Passwörter und
andere Daten in reinem Text übertragen werden. Durch Benutzung von TLS kann die gesamte Kommunikation verschlüsselt werden, was FTP sehr viel sicherer macht.

OpenSSL wird von TLS gebraucht; um OpenSSL zu installieren, benutzen Sie folgenden Befehl:

yum install openssl

Öffnen Sie /etc/pure-ftpd/pure-ftpd.conf

vi /etc/pure-ftpd/pure-ftpd.conf

Wollen Sie FTP und TLS Sitzungen erlauben, setzen Sie TLS auf 1:

[...]
# This option can accept three values :
# 0 : disable SSL/TLS encryption layer (default).
# 1 : accept both traditional and encrypted sessions.
# 2 : refuse connections that don't use SSL/TLS security mechanisms,
# including anonymous sessions.
# Do _not_ uncomment this blindly. Be sure that :
# 1) Your server has been compiled with SSL/TLS support (--with-tls),
# 2) A valid certificate is in place,
# 3) Only compatible clients will log in.

TLS 1
[...]

Um TLS benutzen zu können, müssen Sie ein SSL Zertifikat erstellen. Ich tue dies in /etc/ssl/private/, deshalb muss ich das Verzeichnis zuerst erstellen:

mkdir -p /etc/ssl/private/

Hiernach lässt sich das SSL Zertifikat wie folgt generieren:

openssl req -x509 -nodes -days 7300 -newkey rsa:2048
-keyout /etc/ssl/private/pure-ftpd.pem -out
/etc/ssl/private/pure-ftpd.pem

Country Name (2 letter code) [XX]: <– Geben Sie den Namen Ihres Landes ein (z.B. „DE“).

State or Province Name (full name) []: <– Geben Sie den Namen Ihres Bundesstaates oder Ihrer Provinz ein.

Locality Name (eg, city) [Default City]: <– Geben Sie Ihre Stadt ein.

Organization Name (eg, company) [Default Company Ltd]: <– Geben Sie den Namen Ihrer Organisation ein (z.B. den Namen Ihrer Firma).

Organizational Unit Name (eg, section) []: <– Geben Sie Ihre Organisationsabteilung ein (z.B. „IT Department“).

Common Name (eg, your name or your server’s hostname) []: <– Geben Sie den vollen Domainnamen Ihres Systems ein (z.B. „server1.example.com“).

Email Address []: <– Geben Sie Ihre Email Adresse ein.

Ändern Sie die Zugriffsrechte auf das SSL Zertifikat:

chmod 600 /etc/ssl/private/pure-ftpd.pem

Starten Sie dann PureFTPd neu:

/etc/init.d/pure-ftpd restart

Das war es. Sie können nun versuchen, über Ihren FTP Client eine Verbindung herzustellen; Sie sollten Ihn jedoch dazu konfigurieren TLS zu benutzen.

18 Installation von BIND

Installieren Sie BIND wie folgt:

yum install bind bind-utils

Öffnen Sie als nächstes /etc/sysconfig/named

vi /etc/sysconfig/named

… und kommentieren Sie die Zeile ROOTDIR=/var/named/chroot aus:

# BIND named process options
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
# Currently, you can use the following options:
#
# ROOTDIR="/var/named/chroot" -- will run named in a chroot environment.
# you must set up the chroot environment
# (install the bind-chroot package) before
# doing this.
# NOTE:
# Those directories are automatically mounted to chroot if they are
# empty in the ROOTDIR directory. It will simplify maintenance of your
# chroot environment.
# - /var/named
# - /etc/pki/dnssec-keys
# - /etc/named
# - /usr/lib64/bind or /usr/lib/bind (architecture dependent)
#
# Those files are mounted as well if target file doesn't exist in
# chroot.
# - /etc/named.conf
# - /etc/rndc.conf
# - /etc/rndc.key
# - /etc/named.rfc1912.zones
# - /etc/named.dnssec.keys
# - /etc/named.iscdlv.key
#
# Don't forget to add "$AddUnixListenSocket /var/named/chroot/dev/log"
# line to your /etc/rsyslog.conf file. Otherwise your logging becomes
# broken when rsyslogd daemon is restarted (due update, for example).
#
# OPTIONS="whatever" -- These additional options will be passed to named
# at startup. Don't add -t here, use ROOTDIR instead.
#
# KEYTAB_FILE="/dir/file" -- Specify named service keytab file (for GSS-TSIG)
#
# DISABLE_ZONE_CHECKING -- By default, initscript calls named-checkzone
# utility for every zone to ensure all zones are
# valid before named starts. If you set this option
# to 'yes' then initscript doesn't perform those
# checks.
#ROOTDIR=/var/named/chroot

Erstellen Sie dann die Systemstartlinks:

chkconfig –levels 235 named on

Starten Sie BIND noch nicht, es muss erst noch konfiguriert werden – dies wird später automatisch bei der Installation von ISPConfig 3
geschehen.

19 Installation von Vlogger, Webalizer und AWStats

Vlogger, webalizer und AWStats können folgendermaßen installiert werden:

yum install webalizer awstats
perl-DateTime-Format-HTTP perl-DateTime-Format-Builder

cd /tmp

wget http://n0rp.chemlab.org/vlogger/vlogger-1.3.tar.gz

tar xvfz vlogger-1.3.tar.gz

mv vlogger-1.3/vlogger /usr/sbin/

rm -rf vlogger*

Das könnte dich auch interessieren …