debian:proxy-server-debian:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
debian:proxy-server-debian:start [2017/04/06 20:04] michaeldebian:proxy-server-debian:start [2017/09/19 15:27] – [Aktivieren der dummy.conf] michael
Line 4: Line 4:
 **Was ist ein Reverse Proxy?** //Grundsätzlich handelt es sich bei einem Proxy um eine Kommunikationsschnittstelle im Netzwerk, die Anfragen entgegennimmt und stellvertretend an einen Zielrechner weiterleitet. Ein Reverse Proxy wird nun aber meistens als zusätzliche Sicherheitskomponente vor einen oder mehrere Webserver geschaltet, um Anfragen aus dem Internet stellvertretend entgegen-zunehmen und an einen Backend-Server im Hintergrund weiterzuleiten. **Was ist ein Reverse Proxy?** //Grundsätzlich handelt es sich bei einem Proxy um eine Kommunikationsschnittstelle im Netzwerk, die Anfragen entgegennimmt und stellvertretend an einen Zielrechner weiterleitet. Ein Reverse Proxy wird nun aber meistens als zusätzliche Sicherheitskomponente vor einen oder mehrere Webserver geschaltet, um Anfragen aus dem Internet stellvertretend entgegen-zunehmen und an einen Backend-Server im Hintergrund weiterzuleiten.
 // //
 +
  
  
 <WRAP center round tip 70%> <WRAP center round tip 70%>
-Eine ausführlichere Beschreibung hier: [[knowhow:reverse-proxy|Reverse-Proxy – Kernkomponente in Sicherheitsarchitekturen]]+''**Eine ausführlichere Beschreibung hier: [[knowhow:reverse-proxy|Reverse-Proxy – Kernkomponente in Sicherheitsarchitekturen]]**''
 </WRAP> </WRAP>
  
-**[[http://www.fit-pc.com/web/products/ipc3/|Interessante Hardware für standalone Proxies]]**+**[[http://www.fit-pc.com/web/products/ipc3/|Weitere interessante Hardware für standalone Proxies (Falls kein Odroid gebraucht wird)]]**
  
 ---- ----
Line 21: Line 22:
 </code> </code>
  
-<WRAP center round box 100%> +<sxh bash; first-line: 1>
-<file bash interfaces>+
 # This file describes the network interfaces available on your system # This file describes the network interfaces available on your system
 # and how to activate them. For more information, see interfaces(5). # and how to activate them. For more information, see interfaces(5).
Line 38: Line 38:
 dns-nameservers 192.168.1.1 dns-nameservers 192.168.1.1
  
-</file> +</sxh>
-</WRAP>+
  
 Nach erfolgreicher Speicherung, wird das System neugestartet. Nach erfolgreicher Speicherung, wird das System neugestartet.
Line 49: Line 48:
  
 ===== Installation der Grundkomponenten ===== ===== Installation der Grundkomponenten =====
-Zu Beginn werden erst einmal alle Grundpakete, welche zum einrichten unseres Proxys gebraut werden installiert.+Zu Beginn werden erst einmal alle Grundpakete, welche zum einrichten unseres Proxys gebraut werden installiert. <wrap em>ACHTUNG: Das Paket "''<wrap em>libapache2-mod-proxy-html</wrap>''" ist bei ''<wrap em>Ubuntu 16.04</wrap>'' schon in der Base Installation enthalten!</wrap>
  
 <code> <code>
 +UBUNTU 14.04:
 # apt-get install apache2 libapache2-mod-proxy-html libxml2-dev # apt-get install apache2 libapache2-mod-proxy-html libxml2-dev
 +
 +UBUNTU 16.04:
 +# apt-get install apache2 libxml2-dev
 </code>  </code> 
  
 Aktivierung der Proxy Komponenten aus dem Apache2 Paket. Aktivierung der Proxy Komponenten aus dem Apache2 Paket.
 <code> <code>
-# a2enmod proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html xml2enc vhost_alias ssl+# a2enmod proxy proxy_ajp proxy_http proxy_wstunnel rewrite deflate headers proxy_balancer proxy_connect proxy_html xml2enc vhost_alias ssl
 </code>  </code> 
  
Line 92: Line 95:
 <wrap em>//Stand letzte Sicherung der files vom 17.März 2017//</wrap> <wrap em>//Stand letzte Sicherung der files vom 17.März 2017//</wrap>
  
-<file nsis blackgate.org.conf> 
  
 +=== blackgate.org.conf ===
 +
 +<code>
 +# vim /etc/apache2/sites-available/blackgate.org.conf
 +</code>
 +
 +<sxh bash; first-line: 1>
 <VirtualHost *:80> <VirtualHost *:80>
 # ServerName blackgate.org # ServerName blackgate.org
Line 99: Line 108:
  #  #
    ServerAdmin michael.r467@gmail.com    ServerAdmin michael.r467@gmail.com
-   DocumentRoot /var/www/piwik+   DocumentRoot /var/www/html
  #  #
 </VirtualHost> </VirtualHost>
 +</sxh>
  
-</file> +=== proxy_http.conf ===
  
 +<code>
 +# vim /etc/apache2/sites-available/proxy_http.conf
 +</code>
  
-<file nsis proxy_http.conf>+<sxh bash; first-line: 1>
 #------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
 #                             REDIRECTION FOR NON EXISTENT SUBDOMAINS #                             REDIRECTION FOR NON EXISTENT SUBDOMAINS
Line 143: Line 155:
      ServerAlias request.blackgate.org      ServerAlias request.blackgate.org
  
-     ServerAlias cloud.blackgate.org +     ServerAlias cloud.blackgate.org   
-     ServerAlias office.blackgate.org     +
      ServerAlias ucloud.blackgate.org      ServerAlias ucloud.blackgate.org
  
Line 196: Line 207:
 </VirtualHost> </VirtualHost>
  
-</file>+</sxh>
  
  
  
-<file nsis proxy_https_blackgate.conf>+=== proxy_https_blackgate.conf === 
 + 
 +<code> 
 +# vim /etc/apache2/sites-available/proxy_https_blackgate.conf 
 +</code> 
 + 
 +<sxh bash; first-line: 1>
 <IfModule mod_ssl.c> <IfModule mod_ssl.c>
  
Line 619: Line 636:
 # vim: syntax=apache ts=4 sw=4 sts=4 sr noet # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  
-</file>+</sxh> 
 + 
 + 
 + 
 +=== proxy_https_plexdash.conf === 
 + 
 +<code> 
 +# vim proxy_https_plexdash.conf 
 +</code>
  
-<file nsis proxy_https_plexdash.conf>+<sxh bash; first-line: 1>
  
 #------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
Line 735: Line 760:
 </VirtualHost> </VirtualHost>
  
-</file>+</sxh> 
 + 
 + 
 + 
 + 
 +=== letsencript_dummy.conf === 
 + 
 +<code> 
 +# vim /etc/apache2/sites-available/letsencript_dummy.conf 
 +</code>
  
-<file nsis letsencript_dummy.conf>+<sxh bash; first-line: 1>
  
 <VirtualHost *:80> <VirtualHost *:80>
Line 768: Line 802:
 </VirtualHost> </VirtualHost>
  
-</file>+</sxh>
  
 ---- ----
Line 775: Line 809:
  
 <WRAP center round important 100%> <WRAP center round important 100%>
-Für den nächsten Schritt, müssen wir die **letsencript_dummy.conf** aktivieren. **Alle anderen sites bleiben deaktiviert.**+''Für den nächsten Schritt, müssen wir die **letsencript_dummy.conf** aktivieren. **Alle anderen sites bleiben deaktiviert.**''
  
 <code> <code>
 # a2ensite letsencript_dummy.conf # a2ensite letsencript_dummy.conf
 +# service apache2 reload
 </code> </code>
 </WRAP> </WRAP>
Line 791: Line 826:
  
 <code> <code>
-# ./letsencrypt-auto certonly --rsa-key-size 4096 -d blackgate.org -d xxx.blackgate.org -d cloud.blackgate.org -d su-login.blackgate.org -d plexpy.blackgate.org -d wiki.blackgate.org -d serv.blackgate.org -d www.blackgate.org -d stream.blackgate.org -d emby.blackgate.org -d request.blackgate.org -d index.blackgate.org -d ucloud.blackgate.org -d ilo3.blackgate.org -d plexdash.blackgate.org -d test.blackgate.org+# ./letsencrypt-auto certonly --rsa-key-size 4096 -d blackgate.org -d xxx.blackgate.org -d cloud.blackgate.org -d su-login.blackgate.org -d plexpy.blackgate.org -d wiki.blackgate.org -d serv.blackgate.org -d www.blackgate.org -d stream.blackgate.org -d emby.blackgate.org -d request.blackgate.org -d index.blackgate.org -d ucloud.blackgate.org -d piwik.blackgate.org -d plexdash.blackgate.org -d test.blackgate.org 
 </code> </code>
  
Line 798: Line 834:
  
 ==== Automatisiertes Key Update ==== ==== Automatisiertes Key Update ====
-Da das Letsencript Zertifikat nur eine Gültigkeit von drei Wochen hat, wird hier eine automatische Aktualisierung des Zertifikates empfohlen. Dies wird über einen neuen Crontab Eintrag erreicht.+Da das Letsencript Zertifikat nur eine Gültigkeit von drei Wochen hat, wird hier eine automatische Aktualisierung des Zertifikates empfohlen. Dies wird bei mir über einen crontab Eintrag erreicht.
  
 <code> <code>
Line 804: Line 840:
 </code> </code>
  
-<WRAP center round box 100%> +<sxh bash; first-line: 1>
-<code>+
 # /etc/crontab: system-wide crontab # /etc/crontab: system-wide crontab
 # Unlike any other crontab you don't have to run the `crontab' # Unlike any other crontab you don't have to run the `crontab'
Line 820: Line 855:
 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
 +
 0  12   * * 6   root    /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log 0  12   * * 6   root    /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log
 # #
  
-</code> +</sxh>
-</WRAP>+
  
  
Line 843: Line 878:
 <code> <code>
 # service apache2 reload # service apache2 reload
 +# rm /etc/apache2/sites-available/letsencript_dummy.conf
 </code> </code>
  
Line 853: Line 889:
 Alle hier gemachten Konfigurationsänderungen, haben keinen direkten Einfluss auf die Proxy Funktion. Sie dienen legindlich der Sicherheit und der personalisierung. Alle hier gemachten Konfigurationsänderungen, haben keinen direkten Einfluss auf die Proxy Funktion. Sie dienen legindlich der Sicherheit und der personalisierung.
  
 +<WRAP center round box 100%>
 ==== Härten des Apache-Proxys  ==== ==== Härten des Apache-Proxys  ====
 Zum härten des Apache2 Webservers werden wir nun die security.conf Konfigurationsdatei folgendermassen anpassen: Zum härten des Apache2 Webservers werden wir nun die security.conf Konfigurationsdatei folgendermassen anpassen:
Line 860: Line 897:
 </code> </code>
  
-<file nsis security.conf>+<sxh bash; first-line: 1>
 # ServerTokens # ServerTokens
 ServerTokens Prod ServerTokens Prod
Line 875: Line 912:
 Header set X-Frame-Options: "sameorigin" Header set X-Frame-Options: "sameorigin"
  
-</file>+</sxh>
  
 <code> <code>
Line 881: Line 918:
 </code> </code>
  
 +</WRAP>
 +
 +----
 +
 +<WRAP center round box 100%>
 ==== Eigene ErrorPages definieren ==== ==== Eigene ErrorPages definieren ====
-Um eigene ErrorPages unter einem Apache Reverse Proxy einzubinden muss **folgendes snipped** in der Hauptkonfigurationsdatei von Apache2 //nach dem **letzten** </Directory> Eintrag// eingetragen werden:+Um eigene ErrorPages unter einem Apache Reverse Proxy einzubinden muss **folgendes snipped** in der Hauptkonfigurationsdatei von Apache2 //nach dem letzten </Directory> Eintrag// eingetragen werden:
  
 <file ini snippet> <file ini snippet>
Line 899: Line 941:
 </code> </code>
  
-Nach dem speichern, werden anschliessend die besagten ErrorDocs //(Gleiche Namensgebung wie oben; z.B: **BadRequest.html**)// **nach /var/www/error_pages kopiert**.+Nach dem speichern, werden anschliessend die besagten ErrorDocs //(Gleiche Namensgebung wie oben; z.B: BadRequest.html)// **nach /var/www/error_pages kopiert**.
  
 <WRAP center round download 60%> <WRAP center round download 60%>
Line 915: Line 957:
 # service apache2 reload # service apache2 reload
 </code> </code>
 +</WRAP>
 +
  
 ---- ----
  
 +<WRAP center round box 100%>
 ==== Zusätzliche Sub-Domains hinzufügen ==== ==== Zusätzliche Sub-Domains hinzufügen ====
-Sollen weitere Sub-Domain zu den bestehenden hinzugefügt werden wird folgendermassen vorgegangen:+Sollen weitere sub-Domains zu den bestehenden hinzugefügt werden, so wird folgendermassen vorgegangen:
  
   - Anpassen der proxy-sites und neuer Sub-Domain Namen erfassen. <code>   - Anpassen der proxy-sites und neuer Sub-Domain Namen erfassen. <code>
Line 925: Line 970:
 # vim /etc/apache2/sites-available/proxy_https.conf  # vim /etc/apache2/sites-available/proxy_https.conf 
 </code> </code>
-  - Zum letsencript Binary wechseln und den letzten certonly Befehl //(Suchen mit CTRL + R)// mit der am Schluss neu angehängter Domain z.B. "**-d NEU-DOM.DOMAIN.COM**" ausführen. <code>+  - Zum letsencript Binary wechseln und den letzten certonly Befehl //(Suchen mit CTRL + R)// mit der am Schluss neu angehängter Domain z.B. "**-d NEU-SUBDOM.DOMAIN.COM**" ausführen. <code>
 # cd /opt/letsencrypt/ # cd /opt/letsencrypt/
 # ./letsencrypt-auto certonly --rsa-key-size 4096 -d blackgate.org -d xxx.blackgate.org -d cloud.blackgate.org -d su-login.blackgate.org -d plexpy.blackgate.org -d wiki.blackgate.org -d serv.blackgate.org -d www.blackgate.org -d stream.blackgate.org -d emby.blackgate.org -d request.blackgate.org -d index.blackgate.org -d ucloud.blackgate.org -d proxy.blackgate.org -d plexdash.blackgate.org -d test.blackgate.org -d piwik.blackgate.org # ./letsencrypt-auto certonly --rsa-key-size 4096 -d blackgate.org -d xxx.blackgate.org -d cloud.blackgate.org -d su-login.blackgate.org -d plexpy.blackgate.org -d wiki.blackgate.org -d serv.blackgate.org -d www.blackgate.org -d stream.blackgate.org -d emby.blackgate.org -d request.blackgate.org -d index.blackgate.org -d ucloud.blackgate.org -d proxy.blackgate.org -d plexdash.blackgate.org -d test.blackgate.org -d piwik.blackgate.org
Line 933: Line 978:
 </code> </code>
  
 +</WRAP>
 +
 +----
 +
 +<WRAP center round box 100%>
 +==== Setzen der korrekten Timezone  ====
 +  - Die aktuelle Konfiguration kann mit **''timedatectl''** eingesehen werden. <code>
 +# timedatectl
 +</code> <sxh plain; gutter: flase;>
 +      Local time: Sun 2017-04-23 07:56:23 UTC
 +  Universal time: Sun 2017-04-23 07:56:23 UTC
 +        RTC time: Sun 2017-04-23 07:56:25
 +       Time zone: Etc/UTC (UTC, +0000)
 + Network time on: yes
 +NTP synchronized: yes
 + RTC in local TZ: no
 +</sxh>
 +  - Auflisten aller verfügbaren Timezones.. <code>
 +# timedatectl list-timezones
 +</code> <sxh plain; gutter: flase;>
 +Africa/Abidjan
 +Africa/Accra
 +Africa/Addis_Ababa
 +Africa/Algiers
 +Africa/Asmara
 +Africa/Bamako
 +Africa/Bangui
 +Africa/Banjul
 +...
 +</sxh>
 +  - **Setzen der neuen,** <wrap em>korrekten Timezone:</wrap> in meinem Fall: **//Zürich Schweiz//** <code>
 +# timedatectl set-timezone Europe/Zurich
 +</code> <sxh plain; gutter: flase;>
 + Local time: Sun 2017-04-23 09:57:37 CEST
 +  Universal time: Sun 2017-04-23 07:57:37 UTC
 +        RTC time: Sun 2017-04-23 07:57:39
 +       Time zone: Europe/Zurich (CEST, +0200)
 + Network time on: yes
 +NTP synchronized: yes
 + RTC in local TZ: no
 +</sxh>
 +
 +</WRAP>
 +
 +
 +----
 +
 +==== WakeOnLAN über Proxy automatisieren ====
 +
 +<code>
 +# apt-get update
 +# apt-get install etherwake
 +</code>
 +
 +Anschliessend, müssen nuch noch die Etherwake einträge in der crontab mit der korrekten MAC-Adresse des Ziel Servers erfasst werden.
 +
 +<code>
 +# vim /etc/crontab
 +</code>
 +
 +<sxh bash; first-line: 1>
 +# /etc/crontab: system-wide crontab
 +# Unlike any other crontab you don't have to run the `crontab'
 +# command to install the new version when you edit this file
 +# and files in /etc/cron.d. These files also have username fields,
 +# that none of the other crontabs do.
 +
 +SHELL=/bin/sh
 +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 +
 +# m h dom mon dow user  command
 +17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
 +25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
 +47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
 +52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
 +#
 +0  12   * * 6   root    /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log
 +
 +0  7    * * 1-5   root    etherwake -i eth0 28:92:4a:39:e3:62 && date >> /var/log/wakeOnLAN.log
 +0  9    * * 6-7   root    etherwake -i eth0 28:92:4a:39:e3:62 && date >> /var/log/wakeOnLAN.log
 +
 +#0  3    * * *   root    reboot
 +#
  
 +</sxh>
  • debian/proxy-server-debian/start.txt
  • Last modified: 2017/09/19 15:58
  • by michael