Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Sv translation
languageen

Diese Anleitung erzeugt ein selbst signiertes Zertifikat für den haproxy DienstThis guide generates a self-signed certificate for the haproxy service.

OpenSSL

Konfiguration

Configuration


Edit the file Die Datei /etc/pki/tls/openssl.cnf bearbeiten und diverse Modifikationen machen (Kommentare genau lesen!). and make various modifications (read the comments carefully!)

Translations Ignore


Code Block
title/etc/pki/tls/openssl.cnf
#
# Insert at the end:
#
 
[ alternate_names ]
DNS.1        = acd-lb.domain.de
DNS.2        = acd-lb.domain.local
DNS.3        = acd-lb
 
#
# Insert in this section:
#
 
[ v3_ca ]
subjectAltName      = @alternate_names
 
#
# Insert or modify in this section:
#
 
[ v3_ca ]
keyUsage = digitalSignature, keyEncipherment
 
#
# Change or comment in this section:
#
 
[ CA_default ]
copy_extensions = copy




Generate Keys

Generieren

Zuerst, ein Verzeichnis für die Keys anlegen, und dann die Keys generieren.

First, create a directory for the keys, and then generate the keys.

ATTENTION: The following section also includes outputs from the systemACHTUNG: Folgender Abschnitt beinhaltet auch Ausgaben vom System.


Translations Ignore


Code Block
titleGenerate Keys
mkdir /etc/ssl/newkey
openssl genrsa -out /etc/ssl/newkey/cert.key 3072
openssl req -new -x509 -key /etc/ssl/newkey/cert.key -sha256 -out /etc/ssl/newkey/cert.pem -days 730
 
#
# Answer the questions as follows (for example):
#

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:DE
State or Province Name (full name) []:Bavaria
Locality Name (eg, city) [Default City]:Munich
Organization Name (eg, company) [Default Company Ltd]:jtel GmbH
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:acd-lb.domain.de
Email Address []:lewis.graham@jtel.de

Prüfen des generierten Zertifikats



Check the generated certificate

Check whether the alternative names have been enteredPrüfen ob die Alternative Namen eingetragen wurden:

Translations Ignore


Code Block
titleCheck
openssl x509 -in /etc/ssl/newkey/cert.pem -text -noout


# Check if all DNS names are listed with this entry:
# X509v3 Subject Alternative Name:
Kombinierte



Create and copy combined .pem

erzeugen und kopieren

Translations Ignore


Code Block
titleCombined PEM
cat /etc/ssl/newkey/cert.key > /etc/ssl/newkey/comb.pem
cat /etc/ssl/newkey/cert.pem >> /etc/ssl/newkey/comb.pem
cp /etc/ssl/newkey/comb.pem /etc/haproxy/haproxy.pem
chmod 400 /etc/haproxy/haproxy.pem
Zertifikat



enter certificate in haproxy.cfg

eintragen und Frontendkonfiguration auf umleitung anpassen

and adjust frontend configuration to redirect

Translations Ignore


Code Block
titleCombined PEM
#
# Frontend http redirects to https
#
frontend acdportal_http
        mode            http
        bind            :80
        redirect        scheme https if !{ ssl_fc }

#
# Frontend for https with certificate
#
frontend acdportal_https
        mode            http
        bind            :443 ssl crt /etc/haproxy/haproxy.pem  #verify optional
...





Sv translation
languagede

Diese Anleitung erzeugt ein selbst signiertes Zertifikat für den haproxy Dienst.

OpenSSL Konfiguration


Die Datei /etc/pki/tls/openssl.cnf bearbeiten und diverse Modifikationen machen (Kommentare genau lesen!).

Code Block
title/etc/pki/tls/openssl.cnf
#
# Am Ende einfügen:
#
 
[ alternate_names ]
DNS.1        = acd-lb.domain.de
DNS.2        = acd-lb.domain.local
DNS.3        = acd-lb
 
#
# In diesen Abschnitt einfügen:
#
 
[ v3_ca ]
subjectAltName      = @alternate_names
 
#
# In diesen Abschnitt einfügen bzw. verändern:
#
 
[ v3_ca ]
keyUsage = digitalSignature, keyEncipherment
 
#
# In diesen Abschnitt verändern bzw. einkommentieren:
#
 
[ CA_default ]
copy_extensions = copy


Keys Generieren

Zuerst, ein Verzeichnis für die Keys anlegen, und dann die Keys generieren.

ACHTUNG: Folgender Abschnitt beinhaltet auch Ausgaben vom System.


Code Block
titleKeys Generieren
mkdir /etc/ssl/newkey
openssl genrsa -out /etc/ssl/newkey/cert.key 3072
openssl req -new -x509 -key /etc/ssl/newkey/cert.key -sha256 -out /etc/ssl/newkey/cert.pem -days 730
 
#
# Die Fragen wie folgt (beispielsweise) beantworten:
#

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:DE
State or Province Name (full name) []:Bavaria
Locality Name (eg, city) [Default City]:Munich
Organization Name (eg, company) [Default Company Ltd]:jtel GmbH
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:acd-lb.domain.de
Email Address []:lewis.graham@jtel.de

Prüfen des generierten Zertifikats

Prüfen ob die Alternative Namen eingetragen wurden:

Code Block
titlePrüfen
openssl x509 -in /etc/ssl/newkey/cert.pem -text -noout


# Prüfen ob bei diesen Eintrag alle DNS Namen stehen:
# X509v3 Subject Alternative Name:

Kombinierte .pem erzeugen und kopieren

Code Block
titleKombinierte PEM
cat /etc/ssl/newkey/cert.key > /etc/ssl/newkey/comb.pem
cat /etc/ssl/newkey/cert.pem >> /etc/ssl/newkey/comb.pem
cp /etc/ssl/newkey/comb.pem /etc/haproxy/haproxy.pem
chmod 400 /etc/haproxy/haproxy.pem

Zertifikat in haproxy.cfg eintragen und Frontendkonfiguration auf umleitung anpassen

Code Block
titleKombinierte PEM
#
# Frontend http leitet auf https um
#
frontend acdportal_http
        mode            http
        bind            :80
        redirect        scheme https if !{ ssl_fc }

#
# Frontend für https mit Zertifikat
#
frontend acdportal_https
        mode            http
        bind            :443 ssl crt /etc/haproxy/haproxy.pem  #verify optional
...