CA erstellen inklusive 2 Server Zertifikate

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Arbeitsverzeichnis erstellen

  • mkdir ca
  • cd ca

CA

Private Key der CA erstellen

  • openssl genrsa -aes256 -out ca.key 4096
Generating RSA private key, 4096 bit long modulus (2 primes)
..............................................................................................................................................................................................................................................................................................++++
..............................................++++
e is 65537 (0x010001)
Enter passmkdir ca
root@fw1:~# openssl genrsa -aes256 -out ca.key 4096
Generating RSA private key, 4096 bit long modulus (2 primes)
..............................................................................................................................................................................................................................................................................................++++
..............................................++++
e is 65537 (0x010001)
Enter pass phrase for ca.key:
Verifying - Enter pass phrase for ca.key:
Passwort merken

CA selbstsignieren

  • openssl req -new -key ca.key -x509 -days 3650 -out ca.crt
  • Enter pass phrase for ca.key:
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) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:vpn-ca
Email Address []:.
root@fw1:~# 
 phrase for ca.key:
Verifying - Enter pass phrase for ca.key:
root@fw1:~# openssl req -new -key ca.key -x509 -days 3650 -out ca.crt
Enter pass phrase for ca.mkdir ca
root@fw1:~# openssl genrsa -aes256 -out ca.key 4096
Generating RSA private key, 4096 bit long modulus (2 primes)
..............................................................................................................................................................................................................................................................................................++++
..............................................++++
e is 65537 (0x010001)
Enter pass phrase for ca.key:
Verifying - Enter pass phrase for ca.key:
root@fw1:~# openssl req -new -key ca.key -x509 -days 3650 -out ca.crt
Enter pass phrase for ca.key:
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) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:vpn-ca
Email Address []:.
root@fw1:~# 
key:
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) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:vpn-ca
Email Address []:.

Server

fw1

  • COMMONNAME="fw1"

Private Key erstellen

  • openssl genrsa -out $COMMONNAME.key 4096

Generating RSA private key, 4096 bit long modulus (2 primes) ..++++ ...................................++++ e is 65537 (0x010001)

Zertifikatsrequest erstellen

  • openssl req -new -key $COMMONNAME.key -out $COMMONNAME.csr
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) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:fw1
Email Address []:.

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:   COMMONNAME="fw1"
root@fw1:~/ca# openssl genrsa -out $COMMONNAME.key 4096
Generating RSA private key, 4096 bit long modulus (2 primes)
..++++
...................................++++
e is 65537 (0x010001)
root@fw1:~/ca# openssl req -new -key $COMMONNAME.key -out $COMMONNAME.cs
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) [AU]:.
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:fw1
Email Address []:.

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:   
An optional company name []: