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 
Am
at 
Ende
the 
einfügen
end:
#
 
[ alternate_names ]
DNS.1        = acd-lb.domain.de
DNS.2        = acd-lb.domain.local
DNS.3        = acd-lb
 
#
# 
In
Insert 
diesen
in 
Abschnitt
this 
einfügen
section:
#
 
[ v3_ca ]
subjectAltName      = @alternate_names
 
#
# 
In
Insert 
diesen
or 
Abschnitt
modify 
einfügen
in 
bzw.
this 
verändern
section:
#
 
[ v3_ca ]
keyUsage = digitalSignature, keyEncipherment
 
#
# 
In
Change 
diesen
or 
Abschnitt
comment 
verändern
in 
bzw.
this 
einkommentieren
section:
#
 
[ CA_default ]
copy_extensions = copy

 




Generate Keys

Generieren

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

ACHTUNG: Folgender Abschnitt beinhaltet auch Ausgaben vom System.

 

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

ATTENTION: The following section also includes outputs from the system.


Generieren
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 
Die
the 
Fragen
questions 
wie
as 
folgt
follows (
beispielsweise
for example)
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:



Check the generated certificate

Check whether the alternative names have been entered:

Prüfen
Translations Ignore


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


# Check 
Prüfen
if 
ob
all 
bei
DNS 
diesen
names 
Eintrag
are 
alle
listed 
DNS
with 
Namen
this 
stehen
entry:
# X509v3 Subject Alternative Name:
Kombinierte



Create and copy combined .pem

erzeugen und kopieren

Kombinierte
Translations Ignore


Code Block
title
Combined 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

Kombinierte
Translations Ignore


Code Block
title
Combined PEM
#
# Frontend http 
leitet
redirects 
auf
to https
um

#
frontend acdportal_http
        mode            http
        bind            :80
        redirect        scheme https if !{ ssl_fc }

#
# Frontend 
für
for https 
mit
with 
Zertifikat
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
...


Sv translation
languagefr

Ce guide génère un certificat auto-signé pour le service haproxy.

Configuration d'OpenSSL


Editez le fichier /etc/pki/tls/openssl.cnf et apportez diverses modifications (lisez attentivement les commentaires !)

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




Générer des clés

D'abord, créez un répertoire pour les clés, puis générez les clés.

ATTENTION: La section suivante comprend également les résultats du système.


Translations Ignore


Code Block
titleGénérer des clés
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   # # Répondez aux questions comme suit (par exemple) : # Vous êtes sur le point d'être invité à saisir des informations qui seront intégrées à votre demande de certificat. Ce que vous êtes sur le point d'entrer est ce qu'on appelle un nom distinctif ou un DN. Il y a de nombreux champs, mais vous pouvez en laisser certains vides. Pour certains champs, il y aura une valeur par défaut, si vous entrez ". ----- Nom du pays (code de 2 lettres) [XX]:DE Nom de l'État ou de la province (nom complet) []:Bavaria Nom de la localité (par exemple, ville) [Ville par défaut]:Munich Nom de l'organisation (par exemple, société) [Default Company Ltd]:jtel GmbH Nom de l'unité organisationnelle (par exemple, section) []:IT Nom commun (par exemple, votre nom ou le nom d'hôte de votre serveur) []:acd-lb.domain.de email []:lewis.graham@jtel.de



Vérifier le certificat généré

Vérifiez si les noms alternatifs ont été saisis :

Translations Ignore


Code Block
titleVérifiez
openssl x509 -in /etc/ssl/newkey/cert.pem -text -noout # Check if all DNS names are listed with this entry: # X509v3 Subject Alternative Name:



Créer et copier .pem combinés

Translations Ignore


Code Block
titlePEM combinés
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



entrez le certificat dans haproxy.cfg et ajustez la configuration du frontal pour rediriger

Translations Ignore


Code Block
titlePEM combinés
# # 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 ...