Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:apc [08.01.2017 22:28. ] – [Installation] djangocentos:apc [22.07.2019 14:52. ] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 3: Zeile 3:
 {{:centos:apcupsd-logo.png?nolink&500|Bild: APC UPSD Logo}} {{:centos:apcupsd-logo.png?nolink&500|Bild: APC UPSD Logo}}
  
-Beim Betrieb eines Servers ist der Einsatz einer gesicherten Energieversorgung natürlich obligatorisch. Im RZ((Rechen Zentrum)) stehen dazu meist unterbrechungsfreie Stromversorgungen, Ersatznetze oder auch Notstromaggregate zur Verfügung. Kann man auf derartige Techniken nicht zurückgreifen, lohnt sich die Anschaffung einer eigenen USV. +Beim Betrieb eines Servers ist der Einsatz einer gesicherten Energieversorgung natürlich obligatorisch. Im **RZ**((**R**echen **Z**entrum)) stehen dazu meist unterbrechungsfreie Stromversorgungen, Ersatznetze oder auch Notstromaggregate zur Verfügung. Kann man auf derartige Techniken nicht zurückgreifen, lohnt sich die Anschaffung einer eigenen USV. 
  
 {{:centos:apc-smartusv-1400.jpg?direct&300 |Bild: Photo der APC Smart-UPS SU1400RMI 3HE}}So kommt z.B. bei nausch.org eine //**APC Smart-UPS SU1400RMI 3HE**// zum Einsatz.  Zur Überwachung, Verwaltung und Administration wird **[[http://www.apcupsd.org|APCUPSD]]** verwendet. In diesem Kapitel werden wir uns mit der Installation und Konfiguration des Daemon befassen.  {{:centos:apc-smartusv-1400.jpg?direct&300 |Bild: Photo der APC Smart-UPS SU1400RMI 3HE}}So kommt z.B. bei nausch.org eine //**APC Smart-UPS SU1400RMI 3HE**// zum Einsatz.  Zur Überwachung, Verwaltung und Administration wird **[[http://www.apcupsd.org|APCUPSD]]** verwendet. In diesem Kapitel werden wir uns mit der Installation und Konfiguration des Daemon befassen. 
Zeile 815: Zeile 815:
  
 ===== apcupsd-gui ===== ===== apcupsd-gui =====
-Hat man auf dem Server einen X-server am laufen, muss man sich nicht auf die textbasierten Informationen zurückgreifen. Hier kann man auch auf das **GUI**((**Graphical **U**ser **I**nterface)) für den APCUPS-Daemon zurückgreifen. Die Installation dieser GUI erfolgt wie **yum**.+Hat man auf dem Server einen X-server am laufen, muss man sich nicht auf die textbasierten Informationen zurückgreifen. Hier kann man auch auf das **GUI**((**G**raphical **U**ser **I**nterface)) für den APCUPS-Daemon zurückgreifen. Die Installation dieser GUI erfolgt wie **yum**.
    # yum install -y apcupsd-gui    # yum install -y apcupsd-gui
  
Zeile 853: Zeile 853:
  
  
-==== apcupsd-cgi ====+===== apcupsd-cgi ====
 +Eine weitere Möglichkeit zur Visualisierung der Stati unseres APCUPS-Daemon ist die Verwendung einer WEB-GUI, so dass von berechtigten Hosts, Netzen und/oder Nutzern eine Statusabfrage im Intra- oder auch Internet erfolgen kann. Die notwendigen Programmteile und Konfigurationsbeispiele sind in dem RPm-Paket **apcupsd-cgi** enthalten.
  
 +==== Installation ====
 +Dieses Paket installieren wir nun mit Unterstützung des Befehls **yum**.
    # yum install apcupsd-cgi    # yum install apcupsd-cgi
  
-<code> +Den Inhalt des Paketes und auch den Speicherort ermitteln wir wie gewohnt mittels **rpm** und der Option //-qil//. 
-Name        : apcupsd-cgi+   # rpm -qil apcupsd-cgi 
 + 
 +<code>Name        : apcupsd-cgi
 Version     : 3.14.12 Version     : 3.14.12
 Release     : 1.el7 Release     : 1.el7
Zeile 887: Zeile 892:
 /var/www/apcupsd/upsstats.cgi</code> /var/www/apcupsd/upsstats.cgi</code>
  
-===== old stuff ===== +==== Konfiguration ==== 
-<code>APC      : 001,051,1262 +Da wir die WEB-GUI über einen separaten Apache vHOST ansprechen wollen deaktivieren wir als erstes die mitgelieferte Apache Konfigurationsdatei //**/etc/httpd/conf.d/apcupsd.conf**// in dem wir alle Zeilen auskommentieren
-DATE     : 2012-07-28 16:28:45 +0200   +
-HOSTNAME : vml000020.dmz.nausch.org +
-VERSION  : 3.14.10 (13 September 2011) redhat +
-UPSNAME  : APC1400 +
-CABLE    : Custom Cable Smart +
-DRIVER   : APC Smart UPS (any) +
-UPSMODE  : Stand Alone +
-STARTTIME: 2012-07-28 16:28:33 +0200   +
-MODEL    : SMART-UPS 1400 RM +
-STATUS   : ONLINE  +
-LINEV    : 226.2 Volts +
-LOADPCT  :  33.2 Percent Load Capacity +
-BCHARGE  : 100.0 Percent +
-TIMELEFT :   9.0 Minutes +
-MBATTCHG : 5 Percent +
-MINTIMEL : 3 Minutes +
-MAXTIME  : 0 Seconds +
-MAXLINEV : 228.8 Volts +
-MINLINEV : 226.2 Volts +
-OUTPUTV  : 226.2 Volts +
-SENSE    : High +
-DWAKE    : 000 Seconds +
-DSHUTD   : 020 Seconds +
-DLOWBATT : 02 Minutes +
-LOTRANS  : 196.0 Volts +
-HITRANS  : 253.0 Volts +
-RETPCT   : 000.0 Percent +
-ITEMP    : 34.2 C Internal +
-ALARMDEL : 5 seconds +
-BATTV    : 27.6 Volts +
-LINEFREQ : 50.0 Hz +
-LASTXFER : Automatic or explicit self test +
-NUMXFERS : 0 +
-TONBATT  : 0 seconds +
-CUMONBATT: 0 seconds +
-XOFFBATT : N/+
-SELFTEST : NO +
-STESTI   : 336 +
-STATFLAG : 0x07000008 Status Flag +
-DIPSW    : 0x00 Dip Switch +
-REG1     : 0x00 Register 1 +
-REG2     : 0x00 Register 2 +
-REG3     : 0x00 Register 3 +
-MANDATE  : 09/23/11 +
-SERIALNO : GS9939006549 +
-BATTDATE : 09/23/11 +
-NOMOUTV  : 230 Volts +
-NOMBATTV :  24.0 Volts +
-EXTBATTS : 0 +
-FIRMWARE : 72.11.+
-END APC  : 2012-07-28 16:28:50 +0200 +
-</code>+
  
-   # vim /etc/httpd/conf.d/vhosts.conf+Die Installation und Konfiguration des **//[[centos:web_c7:apache_1|Apache httpd, "der" WEB-Server unter CentOS 7.x]]//** sowie die Konfiguration //**[[centos:web_c7:apache_2|SSL gesicherter Webserver mit mod_ssl für Apache httpd 2.4 unter CentOS 7.x]]**// werden entsprechend vorausgesetzt. 
 +   # vim /etc/httpd/conf.d/apcupsd.conf 
 +<file apache /etc/httpd/conf.d/apcupsd.conf>## 
 +## apcupsd configuration file for Apache Web server 
 +## 
 +
 +## files are off the documentroot of Web server 
 +#Alias /apcupsd /var/www/apcupsd 
 +#<Directory /var/www/apcupsd> 
 +# AddHandler cgi-script cgi pl 
 +# Options ExecCGI 
 +#</Directory> 
 +
 +## 
 +## Allow only local access at default 
 +## Change the ".example.com" to match your domain or modify 
 +## access rights to your needs to enable remote access also. 
 +## 
 +#<Directory "/var/www/apcupsd"> 
 +#    DirectoryIndex upsstats.cgi 
 +#    AllowOverride None 
 +#    Options ExecCGI Indexes 
 +#  <IfModule mod_authz_core.c> 
 +#    # Apache 2.4 
 +#    Require local 
 +#  </IfModule> 
 +#  <IfModule !mod_authz_core.c> 
 +#    # Apache 2.2 
 +#    Order deny,allow 
 +#    Deny from all 
 +#    Allow from 127.0.0.1 
 +#    Allow from ::1 
 +#  </IfModule> 
 +#</Directory></file>
  
-<file apache /etc/httpd/conf.d/vhosts.conf>...+Die Konfiguration unseres Apache vHOST erledigen wir mit Hilfe einer eigenen Konfigurationsdatei //**/etc/httpd/conf.d/3rd_apcupsd.conf**//.
  
-#+<file bash /etc/httpd/conf.d/3rd_apcupsd.conf>#
 # power.nausch.org # power.nausch.org
 # #
Zeile 952: Zeile 938:
         ServerAdmin webmaster@nausch.org         ServerAdmin webmaster@nausch.org
         ServerName power.nausch.org         ServerName power.nausch.org
-        ServerAlias www.power.nausch.org 
         ServerPath /         ServerPath /
         DocumentRoot "/var/www/apcupsd"         DocumentRoot "/var/www/apcupsd"
         AddHandler cgi-script .cgi         AddHandler cgi-script .cgi
-        <Directory "/var/www/apcupsd"+ DirectoryIndex multimon.cgi 
-                Options FollowSymLinks + 
-                AllowOverride all + <Directory /var/www/apcupsd> 
-                Order Allow,Deny +         Require all granted 
-                Allow from all +         AddHandler cgi-script cgi pl 
-                Options ExecCGI +         Options ExecCGI 
-        </Directory>+ </Directory> 
         AddType application/x-httpd-php .php         AddType application/x-httpd-php .php
-        DirectoryIndex multimon.cgi 
         ErrorLog logs/power_error.log         ErrorLog logs/power_error.log
         CustomLog logs/power_access.log combined         CustomLog logs/power_access.log combined
 </VirtualHost> </VirtualHost>
 +</file>
 +
 +Den Zugriff werden wir natürlich entsprechend beschneiden und den Transportweg absichern. Auf unserem HTTP-Proxy-Host legen wir hierzu eine passende vHOST-Konfigurationsdatei an.
 +   # vim /etc/httpd/conf.d/3rd_power.conf
 +<file apache /etc/httpd/conf.d/3rd_power.conf>#
 +# Django : 2015-10-29
 +#          vHost power
 +#
  
-... +# Variablen der Hostvariablen 
-</file>+Define vhost power 
 +Define errors_log logs/${vhost}_error.log 
 +Define access_log logs/${vhost}_access.log 
 +Define ssl_log logs/${vhost}_ssl_request.log 
 + 
 +<VirtualHost 10.0.0.97:80> 
 +    ServerAdmin webmaster@nausch.org 
 +    ServerName ${vhost}.nausch.org 
 + 
 +    RewriteEngine on 
 +    RewriteCond %{HTTPS} off 
 +    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
 + 
 +    # Welche Logdateien sollen beschrieben werden 
 +    SetEnvIf Remote_Addr "10\.0\.0\.20" dontlog 
 +    ErrorLog  ${errors_log} 
 +    CustomLog ${access_log} combined env=!dontlog 
 +</VirtualHost> 
 +<VirtualHost 10.0.0.97:443> 
 +    ServerAdmin webmaster@nausch.org 
 +    ServerName ${vhost}.nausch.org 
 +    ServerPath / 
 + 
 +    # Wer soll Zugriff auf die Webseite(n) bekommen? 
 +    <Proxy *> 
 +        Options +FollowSymLinks +Multiviews -Indexes 
 +        AllowOverride None 
 +        AuthType Basic 
 +        AuthName "Fuer den Zugriff auf den Webserver bitte Anmeldedaten eingeben!" 
 +        AuthBasicProvider ldap 
 +        AuthLDAPUrl ldaps://openldap.dmz.nausch.org:636/ou=People,dc=nausch,dc=org?uid 
 +        AuthLDAPBindDN cn=TechnischerUser,dc=nausch,dc=org 
 +        AuthLDAPBindPassword "MwDWrcdRnw95zMt7A5bS/dPnEHuuO7h0" 
 +        AuthLDAPBindAuthoritative on 
 +        Require ldap-user django 
 +    </Proxy> 
 + 
 +   # Welcher Inhalt soll angezeigt bzw. auf welchen Server sollen die HTTP-Requests weitergeleitet werden? 
 +    ProxyRequests Off 
 +    ProxyPreserveHost On 
 +    ProxyPass / http://10.0.0.127/ 
 +    ProxyPassReverse / http://10.0.0.127/ 
 + 
 +    # Welche Logdateien sollen beschrieben werden 
 +    SetEnvIf Remote_Addr "10\.0\.0\.20" dontlog 
 +    ErrorLog  ${errors_log} 
 +    CustomLog ${access_log} combined env=!dontlog 
 +    CustomLog ${ssl_log} "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" 
 + 
 +    # Absicherung der Übertragung mit Hilfe von TLS 
 +    # Django : 2015-10-04 - TLS-Verschlüsselung mit Hilfe von mod_ssl 
 +    SSLEngine on 
 +    # Definition der anzubietenden Protokolle 
 +    SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 
 +    # Definition der Cipher 
 +    SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384 
 +    # Schlüsseldatei, mit der der CSR erstellt wurde 
 +    SSLCertificateKeyFile /etc/pki/tls/private/power.nausch.org.serverkey.pem 
 +    # Zertifikatsdatei, die von der CA signiert wurde 
 +    SSLCertificateFile /etc/pki/tls/certs/power.nausch.org.certificate_161118.pem 
 +    # Zertifikatsdatei des bzw. der Intermediate-Zertifikate(s) 
 +    SSLCertificateChainFile /etc/pki/tls/certs/AlphaSSL_Intermediate.certificate.pem 
 +    # Änderung der Cipherorder der Clients verneinen  
 +    SSLHonorCipherOrder on 
 +    # TLS 1.0 Kompremmierung deaktivieren (CRIME attacks) 
 +    SSLCompression off 
 +    # Online Certificate Status Protocol stapling zum Prüfen des Gültigkeitsstatus des Serverzertifikats. 
 +    SSLUseStapling on 
 +    SSLStaplingResponderTimeout 5 
 +    SSLStaplingReturnResponderErrors off 
 + 
 +    # HTTP Strict Transport Security (HSTS), bei dem der Server dem Client im HTTP-Header mitteilt, 
 +    # dass dieser nur noch verschlüsselt mit dem Server kommunizieren soll. 
 +    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" 
 + 
 +    # This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. 
 +    # It's usually enabled by default anyway, so the role of this header is to re-enable the filter for 
 +    # this particular website if it was disabled by the user. 
 +    # https://www.owasp.org/index.php/List_of_useful_HTTP_headers 
 +    #Header set X-XSS-Protection "1; mode=block" 
 +    Header always set X-Xss-Protection "1; mode=block" 
 + 
 +    # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, 
 +    # to disable content-type sniffing on some browsers. 
 +    # https://www.owasp.org/index.php/List_of_useful_HTTP_headers 
 +    # currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx 
 +    # http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx 
 +    # 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020 
 +    # Sofern die Datei auch den entsprechenden MIME-Typ "text/css" entspricht, soll der Browser  
 +    # CSS-Dateien nur als CSS interprätieren. 
 +    Header always set X-Content-Type-Options nosniff 
 + 
 +    # config to don't allow the browser to render the page inside an frame or iframe 
 +    # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking 
 +    # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri 
 +    # https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options 
 +    ###header set X-Frame-Options SAMEORIGIN 
 +    header always set X-Frame-Options DENY 
 + 
 +    # hide server header (apache and php version) 
 +    Header always unset Server 
 + 
 +    # Only allow JavaScript from the same domain to be run. 
 +    # don't allow inline JavaScript to run. 
 +    Header always set X-Content-Security-Policy "allow 'self';" 
 + 
 +    # Add Secure and HTTP only attributes to cookies 
 +    Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure 
 + 
 +    # prevent Clickjacking Attack 
 +    #Header always append X-Frame-Options SAMEORIGIN 
 +    Header always set X-Frame-Options "SAMEORIGIN" 
 + 
 +    # hkpk-stuff 
 +    Header always set Public-Key-Pins "pin-sha256=\"nMiOpb6vUnjCoWCkPkDaG4ND8SNWzFTsQf2ZfruLno0=\"; pin-sha256=\"INhxSQ38nCS6ijaAAyo4xAhAZj9xeL3Xaak+GGiM2fo=\"; max-age=2592000; report-uri=\"https://nausch.report-uri.io/r/default/hpkp/enforce\"" 
 +</VirtualHost></file> 
 + 
 +Bevor wir zur Aktivierung unserer Konfigurationsänderungen den bzw. die HTTP-Daemon einmal durchstarten überprüfen wir unsere Apache-Konfigurationsdateien auf syntaktische Fehler. 
 +   # apachectl -t 
 + 
 +  Syntax OK 
 + 
 +Ist alles O.K. starten wir den/die Daemon nun einmal neu. 
 +   # systemctl restart httpd.service 
 + 
 +<html><pre class="code"> 
 +<font style="color: rgb(0, 255, 0)"><b>● </b></font><font style="color: rgb(0, 0, 0)">httpd.service - The Apache HTTP Server 
 +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) 
 +   Active: <font style="color: rgb(0, 255, 0)"><b>active (running) </b></font><font style="color: rgb(0, 0, 0)"> since Mon 2017-01-09 11:03:23 CET; 48s ago 
 +     Docs: man:httpd(8) 
 +           man:apachectl(8) 
 +  Process: 11642 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) 
 + Main PID: 11647 (httpd) 
 +   Status: "Total requests: 2; Current requests/sec: 0.1; Current traffic: 307 B/sec" 
 +   CGroup: /system.slice/httpd.service 
 +           ├─11647 /usr/sbin/httpd -DFOREGROUND 
 +           ├─11648 /usr/sbin/httpd -DFOREGROUND 
 +           ├─11649 /usr/sbin/httpd -DFOREGROUND 
 +           ├─11650 /usr/sbin/httpd -DFOREGROUND 
 +           ├─11651 /usr/sbin/httpd -DFOREGROUND 
 +           ├─11652 /usr/sbin/httpd -DFOREGROUND 
 +           └─11699 /usr/sbin/httpd -DFOREGROUND 
 + 
 +Jan 09 11:03:23 vml000127.dmz.nausch.org systemd[1]: Starting The Apache HTTP Server... 
 +Jan 09 11:03:23 vml000127.dmz.nausch.org systemd[1]: Started The Apache HTTP Server.</font> 
 +</pre></html> 
 + 
 +Nun starten wir einen Browser und öffnen die zugehörige URL. 
 +   $ konqueror http://power.nausch.org 
 + 
 +Im ersten Bild sehen wir die Startseite der WEB-GUI. 
 + 
 +{{ :centos:apcupsd-cgi-01.png?direct&800 |BILD: WEB GUI des APCUPS-Daemon}} 
 + 
 +Das zweite Bild zeigt die Übersicht zu den aktuellen Stati unserer USV. 
 + 
 +{{ :centos:apcupsd-cgi-02.png?direct&800 |BILD: WEB GUI des APCUPS-Daemon}} 
 + 
 +Eine Ansicht aller Detailangaben zeigt das dritte Bild.
  
-{{ :centos:apcupsd.png?direct&500 |BildschirmhardcopyAPC UPS Daemon}}+{{ :centos:apcupsd-cgi-03.png?direct&800 |BILDWEB GUI des APCUPS-Daemon}}
  
 +====== Links ======
 +  * **[[wiki:start| ⇐ Zurück zu Projekte und Themenkapitel]]**
 +  * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**
  
  
  
  
  • centos/apc.1483914523.txt.gz
  • Zuletzt geändert: 08.01.2017 22:28.
  • von django