Schlagwort-Archive: CentOS Linux

CentOS (Community Enterprise Operating System) ist eine Linux-Distribution, die auf Red Hat Enterprise Linux (RHEL).

Let’s Encrypt Installation auf CentOS 7 mit Apache

Tutorial: Let’s Encrypt Certbot auf CentOS 7 für Apache 2.4

Let’s Encrypt ist eine Zertifizierungsstelle, die kostenlose X.509-Zertifikate für Transport Layer Security (TLS) anbietet. In diesem Tutorial wird gezeigt, wie man Let´s Encrypt SSL anhand des ACME Vorgang mit certbot durchführt, und Let’s Encrypt auf einem CentOS 7 Host mit Apache 2.4 Webserver implementiert.

  Vorausgesetzt wird hier, das der Apache-Webserver bereits installiert ist, die Domain als Apache VirtualHost konfiguriert ist, und die Domain im DNS auflösbar ist, mit einem A-Record in der Forward-Zone dieser Domain, oder für IPv6 ein Quad-A-Record für den Server eingetragen ist. Weiter muss für das ACME Challenge der Server über Port 80 erreichbar sein.

Zur installation auf dem CentOS host sind wir root.

$ su -
Password:
Last login: Tue Jan 15 06:25:52 CET 2019 on pts/0

Nach EPEL Repository hinzufügen wird Certbot für Apache installiert.

# yum -y install epel-release
# yum -y install mod_ssl python-certbot-apache

Nun den Apache-Webserver neu starten.

# systemctl restart httpd

Die Firewall für die Service Port 80 und 443 öffnen.

# firewall-cmd --add-service=http
# firewall-cmd --add-service=https
# firewall-cmd --runtime-to-permanent
# firewall-cmd --reload

Jetzt durch den certbot das SSL-Zertifikat generieren lassen.

# certbot --apache -d mydomain.com -d www.mydomain.com

  Die erste Domäne sollte die Basis Domain sein. In diesem Beispiel heißt sie mydomain.com, diese durch den tatsächlichen Domain-Name ersetzen.

Die Ausgabe des certbot sieht in etwa wie folgt aus.

# certbot --apache -d mydomain.com -d www.mydomain.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mydomain.com
Waiting for verification...
Cleaning up challenges
Resetting dropped connection: acme-v02.api.letsencrypt.org
Created an SSL vhost at /etc/httpd/conf.d/mydomain-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/mydomain-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/httpd/conf.d/mydomain.conf to ssl vhost in /etc/httpd/conf.d/mydomain-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://mydomain.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=mydomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mydomain.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mydomain.com/privkey.pem
   Your cert will expire on 2019-04-14. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Abschließend kann die URL getestet werden.

$ curl -k https://mydomain.com

Die URL im Browser abrufen und bei SSL Labs verifizieren.

https://www.ssllabs.com/ssltest/analyze.html?d=mydomain.com
Die URL im Browser abrufen und bei SSL Labs verifizieren.
SSL Labs SSL Analyzing Report

Das Let’s Encrypt Zertifikat ist 90 Tage gültig.

phpSysInfo Installation auf CentOS

Die Installation von phpSysInfo auf CentOS

phpSysInfo zeigt Status Informationen zu CentOS Linux übersichtlich in einer PHP-Webseite.

INSTALLATION

Die Installation von phpSysInfo geschieht mit  Copy Paste der folgenden Zeilen in einer Terminal Console:

cd /tmp
curl -L https://github.com/phpsysinfo/phpsysinfo/archive/v3.3.2.tar.gz | tar zxv
mv /tmp/phpsysinfo-3.3.2/phpsysinfo.ini.new /tmp/phpsysinfo-3.3.2/phpsysinfo.ini
sudo mv phpsysinfo-3.3.2 /var/www/html/phpsysinfo

Auf Github ist jeweils das letzte phpSysInfo Release verfügbar.

Ein Passwort vergeben um das System durch htaccess Autorisierung zu schützen:

$ sudo htpasswd -c /etc/httpd/conf.d/.htpasswd [username]

Die Apache Zusatzkonfiguration mit der Konfigurationsdatei in das Verzeichnis „/etc/httpd/conf.d“ erstellen:

sudo cat <<EOF > /etc/httpd/conf.d/phpsysinfo.conf
Alias /phpsysinfo /var/www/html/phpsysinfo
# Authorization use Apache 2.4+
<Directory /var/www/html/phpsysinfo>
    AuthType Basic
    AuthName "LOGIN"
    AuthBasicProvider file
    AuthUserFile "/etc/httpd/conf.d/.htpasswd"
    Require user [username]
    # Require ip [address]
</Directory>

<files phpsysinfo.ini>
# Deny all requests from Apache 2.4+
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
</files>
EOF

Zielen mit  Copy Paste in Terminal einfügen, um den Apache VirtualHost phpsysinfo zu erstellen.

Stelle sicher, dass in der php.ini der safe_mode auf off gesetzt ist.
Anstelle von [username] den zuvor erstellten Benutzername.
Bei Require ip [address] kann eine IP Adresse angegeben werden. von dieser die Benutzer Anmeldeaufforderung ausgeschlossen wird, dann das führende hash (#) Zeichen entfernen.

Fertig, jetzt muss nur noch die Änderung vom Apache Webserver eingelesen werden, damit die Änderungen wirksam werden:

$ sudo systemctl reload httpd.service

Aufrufen mit http://ip-oder-hostname/phpsysinfo

Abbildng: phpSysInfo

Benutzer und Passwort dieses zuvor mit htpasswd eingegeben wurde.

Wird die phpSysInfo Seite nicht geöffnet, kann der Apache Webserver Status, und die Konfiguration überprüft werden:

$ sudo systemctl status httpd.service
$ apachectl configtest

Quellen Link  phpsysinfo

ANFORDERUNGEN

PHP 5.1.3 oder höher mit der Erweiterung SimpleXML, PCRE, XML und DOM.

Empfohlene Extensions:
mbstring: Required for *nix non UTF-8 systems
com_dotnet: Required for Windows environments
xsl: Required for static mode
json: Required for bootstrap mode

AKTUELLE GEPRÜFTE PLATTFORMEN

Linux 2.6+
FreeBSD 7+
OpenBSD 2.8+
NetBSD
DragonFly
HP-UX
Darwin / Mac OS / OS X
Windows 2000 / XP / 2003 / Vista / 2008 / 7 / 2011 / 2012 / 8 / 8.1 / 10 / 2016 / 2019
Android

BEKANNTE PROBLEME

phpSysInfo ist nicht kompatibel mit SELinux.

SELinux auf disabled setzen, mit ausführen folgender Zeile wird /etc/selinux/config geändert und der Server anschließend rebootet.

$ sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config && cat /etc/selinux/config && reboot