Advertisement
Guest User

Web / Mail Server Aufsatz

a guest
Feb 21st, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.94 KB | None | 0 0
  1. dpkg-reconfigure dash # don't like dash, use bash
  2.  
  3. aptitude install bash-completion mc htop rsync locate nload ntp ntpdate postfix postfix-mysql postfix-doc mysql-client mysql-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve sudo amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils bind9 build-essential autoconf automake1.9 libtool flex bison debhelper binutils-gold dnsutils libexpat1 fail2ban ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-ruby libapache2-mod-python pure-ftpd-common pure-ftpd-mysql quota quotatool php5-curl php5-intl php5-memcache php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache libapache2-mod-fastcgi php5-fpm memcached vlogger webalizer awstats geoip-database libclass-dbi-mysql-perl
  4.  
  5. med /etc/mysql/my.cnf # einkommentieren der bind-adress
  6.  
  7. ~~
  8. # bind-address           = 127.0.0.1
  9. ~~
  10.  
  11. service mysql restart
  12. med /etc/postfix/master.cf
  13.  
  14. ~~
  15. submission inet n       -       -       -       -       smtpd
  16.   -o syslog_name=postfix/submission
  17.   -o smtpd_tls_security_level=encrypt
  18.   -o smtpd_sasl_auth_enable=yes
  19.   -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  20. #  -o milter_macro_daemon_name=ORIGINATING
  21. smtps     inet  n       -       -       -       -       smtpd
  22.   -o syslog_name=postfix/smtps
  23.   -o smtpd_tls_wrappermode=yes
  24.   -o smtpd_sasl_auth_enable=yes
  25.   -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  26. #  -o milter_macro_daemon_name=ORIGINATING
  27. ~~
  28.  
  29. service postfix restart # postfix mit neuer Konfiguration neu starten
  30.  
  31. service spamassassin stop # falls er laufen sollte
  32.  
  33. update-rc.d -f spamassassin remove # verhindern das bei einem Neustart mit startet
  34.  
  35. a2enmod suexec rewrite ssl actions include dav_fs dav auth_digest actions fastcgi alias
  36.  
  37. med /etc/apache2/mods-available/suphp.conf # kann komplett ersetzt werden
  38.  
  39. ~~
  40. <IfModule mod_suphp.c>
  41.     #<FilesMatch "\.ph(p3?|tml)$">
  42.     #    SetHandler application/x-httpd-suphp
  43.     #</FilesMatch>
  44.         AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
  45.         suPHP_AddHandler application/x-httpd-suphp
  46.  
  47.     <Directory />
  48.         suPHP_Engine on
  49.     </Directory>
  50.  
  51.     # By default, disable suPHP for debian packaged web applications as files
  52.     # are owned by root and cannot be executed by suPHP because of min_uid.
  53.     <Directory /usr/share>
  54.         suPHP_Engine off
  55.     </Directory>
  56.  
  57. # # Use a specific php config file (a dir which contains a php.ini file)
  58. #       suPHP_ConfigPath /etc/php5/cgi/suphp/
  59. # # Tells mod_suphp NOT to handle requests with the type <mime-type>.
  60. #       suPHP_RemoveHandler <mime-type>
  61. </IfModule>
  62. ~~
  63.  
  64. service apache2 restart
  65.  
  66. med /etc/default/pure-ftpd-common # VIRTUALCHROOT=true (default = false)
  67.  
  68. ~~
  69. VIRTUALCHROOT=true
  70. ~~
  71.  
  72. echo 1 > /etc/pure-ftpd/conf/TLS
  73.  
  74. mkdir -p /etc/ssl/private/
  75.  
  76. openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
  77.  
  78. ~~
  79. Country Name (2 letter code) [AU]:DE
  80. State or Province Name (full name) [Some-State]:Bundesland
  81. Locality Name (eg, city) []:Stadt
  82. Organization Name (eg, company) [Internet Widgits Pty Ltd]:Institution
  83. Organizational Unit Name (eg, section) []:Abteilung
  84. Common Name (e.g. server FQDN or YOUR name) []:your.domain.de
  85. Email Address []:postmaster@your.domain.de
  86. ~~
  87.  
  88. chmod 600 /etc/ssl/private/pure-ftpd.pem
  89.  
  90. service pure-ftpd-mysql restart
  91.  
  92. med /etc/fstab # qutoa aktivieren
  93.  
  94. ~~
  95. # /etc/fstab: static file system information.
  96. #
  97. # <file system> <mount point>   <type>  <options>       <dump>  <pass>
  98. proc            /proc           proc    defaults        0       0
  99. devpts          /dev/pts        devpts  rw,noexec,nosuid,gid=5,mode=620 0  0
  100. /dev/xvda1 none swap sw 0 0
  101. #/dev/xvda2 / ext4 errors=remount-ro 0 1
  102. /dev/xvda2 / ext4  errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0  1
  103. ~~
  104.  
  105. mount -o remount /
  106.  
  107. quotacheck -avugm
  108.  
  109. quotaon -avug
  110.  
  111. med /etc/cron.d/awstats # awstats cron und mails abschalten
  112.  
  113. ~~
  114. #MAILTO=root
  115.  
  116. #*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh
  117.  
  118. # Generate static reports:
  119. #10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh
  120. ~~
  121.  
  122. cd /tmp # jailkit nachinstallieren
  123.  
  124. wget http://olivier.sessink.nl/jailkit/jailkit-2.15.tar.gz
  125.  
  126. tar xvfz jailkit-2.15.tar.gz
  127.  
  128. cd jailkit-2.15
  129.  
  130. ./debian/rules binary
  131.  
  132. cd ..
  133.  
  134. dpkg -i jailkit_2.15-1_*.deb
  135.  
  136. rm -rf jailkit-2.15*
  137.  
  138. med /etc/fail2ban/jail.local
  139.  
  140. ~~
  141. [pureftpd]
  142. enabled  = true
  143. port     = ftp
  144. filter   = pureftpd
  145. logpath  = /var/log/syslog
  146. maxretry = 3
  147.  
  148. [dovecot-pop3imap]
  149. enabled = true
  150. filter = dovecot-pop3imap
  151. action = iptables-multiport[name=dovecot-pop3imap, port="pop3,pop3s,imap,imaps", protocol=tcp]
  152. logpath = /var/log/mail.log
  153. maxretry = 5
  154.  
  155. [sasl]
  156. enabled  = true
  157. port     = smtp
  158. filter   = sasl
  159. logpath  = /var/log/mail.log
  160. maxretry = 3
  161. ~~
  162.  
  163. med /etc/fail2ban/filter.d/pureftpd.conf
  164.  
  165. ~~
  166. [Definition]
  167. failregex = .*pure-ftpd: \(.*@<HOST>\) \[WARNING\] Authentication failed for user.*
  168. ignoreregex =
  169. ~~
  170.  
  171. med /etc/fail2ban/filter.d/dovecot-pop3imap.conf
  172.  
  173. ~~
  174. [Definition]
  175. failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed|Aborted login \(\d+ authentication attempts).*rip=(?P<host>\S*),.*
  176. ignoreregex =
  177. ~~
  178.  
  179. service fail2ban restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement