OpenVPN Zertifikate

T

tarcus

Jungspund
Hallo und einen schönen guten Tag miteinander.
Ich bin noch ein ziemlicher Linux-Neuling, und versuche für unsere Firma VPN über IPSec einzurichten.
Habe mich dann für openvpn entschieden, da es anscheinend total einfach einzurichten sein soll.
Leider stellen sich mir aber einige Probleme in den Weg, mit denen ich mich jetzt an euch alle wende, mit der Hoffnung dass mir irgendjemand weiterhelfen kann, da es für unseren Chef der sehr viel unterwegs ist, sehr wichtig ist von aussen an unsere Daten zu kommen.
Wir benutzen Suse Linux 10.1, ich weiss :), aber für Einsteiger soll es ja recht einfach sein, daher haben wir uns dafür entschieden. Ich habe bereits alles installiert (LZO, OpenSSL und natürlich openvpn selbst)
Mein Problem sind momentan die Zertifikate, mit denen ich nicht so ganz klar komme.
Ich verstehe auch nicht, warum ich zwingend Zertifikate benötige, vielleicht kann mich da ja jemand mal aufklären. Ich hätte es am liebsten, dass ich einfach nur Benutzername und Kennwort brauche.
Zum Netzwerk:
Wir haben eine statische IP und der Port 1194 ist frei.
Das war mein Tutorial KLICK (zwar für FreeBSD, aber ich dachte das geht schon)
Wie mir dann bewusst wurde, hat Suse ganz schön viel Eigensache gemacht was z.b. die Ordnerstruktur angeht.
Ich habe jetzt versucht den OpenVPN-Server zu starten, dabei kommt folgendes:
Code:
tarcus:~/private # openvpn --config /etc/openvpn/server.conf
Mon Sep  4 11:47:51 2006 OpenVPN 2.0.7 i686-suse-linux [SSL] [LZO] [EPOLL] built on Aug 30 2006
Mon Sep  4 11:47:51 2006 Cannot open dh1024.pem for DH parameters: error:02001002:system library:fopen:No such file or directory: error:2006D080:BIO routines:BIO_new_file:no such file
Mon Sep  4 11:47:51 2006 Exiting
tarcus:~/private #

Ich vermute mal, dass das Zertifikat nicht lokalisiert werden konnte, ich glaube momentan liegen die in private aber ich finde den als Ordner gar nicht, nur über die Konsole (erklärt den Ordnernamen).
Irgendwo werden ja die Pfade festgelegt, kann es sein, dass das in der openssl.conf steht? Wenn ja wo?
Hier mal eine openssl.conf

Code:
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#

# This definition stops the following lines choking if HOME isn't
# defined.
HOME			= .
RANDFILE		= $ENV::HOME/.rnd

# Extra OBJECT IDENTIFIER info:
#oid_file		= $ENV::HOME/.oid
oid_section		= new_oids

# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions		= 
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)

[ new_oids ]

# We can add new OIDs in here for use by 'ca' and 'req'.
# Add a simple OID like this:
# testoid1=1.2.3.4
# Or use config file substitution like this:
# testoid2=${testoid1}.5.6

####################################################################
[ ca ]
default_ca	= CA_default		# The default ca section

####################################################################
[ CA_default ]

dir		= $ENV::KEY_DIR		# Where everything is kept
certs		= $dir			# Where the issued certs are kept
crl_dir		= $dir			# Where the issued crl are kept
database	= $dir/index.txt	# database index file.
new_certs_dir	= $dir			# default place for new certs.

certificate	= $dir/ca.crt	 	# The CA certificate
serial		= $dir/serial 		# The current serial number
crl		= $dir/crl.pem 		# The current CRL
private_key	= $dir/ca.key	 	# The private key
RANDFILE	= $dir/.rand		# private random number file

x509_extensions	= usr_cert		# The extentions to add to the cert

# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crl_extensions	= crl_ext

default_days	= 3650			# how long to certify for
default_crl_days= 30			# how long before next CRL
default_md	= md5			# which md to use.
preserve	= no			# keep passed DN ordering

# A few difference way of specifying how similar the request should look
# For type CA, the listed attribut, aber woes must be the same, and the optional
# and supplied fields are just that :-)
policy		= policy_match

# For the CA policy
[ policy_match ]
countryName		= match
stateOrProvinceName	= match
organizationName	= match
organizationalUnitName	= optional
commonName		= supplied
emailAddress		= optional

# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName		= optional
stateOrProvinceName	= optional
localityName		= optional
organizationName	= optional
organizationalUnitName	= optional
commonName		= supplied
emailAddress		= optional

####################################################################
[ req ]
default_bits		= $ENV::KEY_SIZE
default_keyfile 	= privkey.pem
distinguished_name	= req_distinguished_name
attributes		= req_attributes
x509_extensions	= v3_ca	# The extentions to add to the self signed cert

# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret

# This sets a mask for permitted string types. There are several options. 
# default: PrintableString, T61String, BMPString.
# pkix	 : PrintableString, BMPString.
# utf8only: only UTF8Strings.
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
# so use this option with caution!
string_mask = nombstr

# req_extensions = v3_req # The extensions to add to a certificate request

[ req_distinguished_name ]
countryName			= Country Name (2 letter code)
countryName_default		= $ENV::KEY_COUNTRY
countryName_min			= 2
countryName_max			= 2

stateOrProvinceName		= State or Province Name (full name)
stateOrProvinceName_default	= $ENV::KEY_PROVINCE

localityName			= Locality Name (eg, city)
localityName_default		= $ENV::KEY_CITY

0.organizationName		= Organization Name (eg, company)
0.organizationName_default	= $ENV::KEY_ORG

# we can do this but it is not needed normally :-)
#1.organizationName		= Second Organization Name (eg, company)
#1.organizationName_default	= World Wide Web Pty Ltd

organizationalUnitName		= Organizational Unit Name (eg, section)
#organizationalUnitName_default	=

commonName			= Common Name (eg, your name or your server\'s hostname)
commonName_max			= 64

emailAddress			= Email Address
emailAddress_default		= $ENV::KEY_EMAIL
emailAddress_max		= 40

# SET-ex3			= SET extension number 3

[ req_attributes ]
challengePassword		= A challenge password
challengePassword_min		= 4
challengePassword_max		= 20

unstructuredName		= An optional company name

[ usr_cert ]

# These extensions are added when 'ca' signs a request.

# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.

basicConstraints=CA:FALSE

# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.

# This is OK for an SSL server.
# nsCertType			= server

# For an object signing certificate this would be used.
# nsCertType = objsign

# For normal client use this is typical
# nsCertType = client, email

# and for everything including object signing:
# nsCertType = client, email, objsign

# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment

# This will be displayed in Netscape's comment listbox.
nsComment			= "OpenSSL Generated Certificate"

# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always

# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy

# Copy subject details
# issuerAltName=issuer:copy

#nsCaRevocationUrl		= http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName

[ server ]

# JY ADDED -- Make a cert with nsCertType set to "server"
basicConstraints=CA:FALSE
nsCertType			= server
nsComment			= "OpenSSL Generated Server Certificate"
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always

[ v3_req ]

# Extensions to add to a certificate request

basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment

[ v3_ca ]


# Extensions for a typical CA


# PKIX recommendation.

subjectKeyIdentifier=hash

authorityKeyIdentifier=keyid:always,issuer:always

# This is what PKIX recommends but some broken software chokes on critical
# extensions.
#basicConstraints = critical,CA:true
# So we do this instead.
basicConstraints = CA:true

# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign

# Some might want this also
# nsCertType = sslCA, emailCA

# Include email address in subject alt name: another PKIX recommendation
# subjectAltName=email:copy
# Copy issuer details
# issuerAltName=issuer:copy

# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, DER:30:03:01:01:FF

[ crl_ext ]

# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.

# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always,issuer:always

So ich hoffe mir kann jemand helfen, ich verlier immer mehr die Übersicht über das ganze. Dankeschön schonmal im vorraus :hilfe2:
 
Habe ich gerade auch bemerkt, aber jetzt fehlt mir eine server.crt
So sieht das dann aus:

Code:
tarcus:~/private # openvpn --config /etc/openvpn/server.conf
Mon Sep  4 12:52:20 2006 OpenVPN 2.0.7 i686-suse-linux [SSL] [LZO] [EPOLL] built on Aug 30 2006
Mon Sep  4 12:52:20 2006 Diffie-Hellman initialized with 1024 bit key
Mon Sep  4 12:52:20 2006 Cannot load certificate file server.crt: error:02001002:system library:fopen:No such file or directory: error:20074002:BIO routines:FILE_CTRL:system lib: error:140AD002:SSL routines:SSL_CTX_use_certificate_file:system lib
Mon Sep  4 12:52:20 2006 Exiting
 
tue doch einfach mal den von mir geposteten link lesen....speziell den teil mit "Generate the master Certificate Authority (CA) certificate & key" :]

dort steht alles was du brauchst :oldman
 
my english is not so good, but i try to create a server.cert
But it would be better if you say it in german to me, for better explanation. Thanks in advance.

Nachtrag:

Tut mir echt Leid, aber ich komme absolut nicht weiter, ich bin jetzt echt am verzweifeln.
Beim ausführen dieses Befehls kommt das:
Code:
tarcus:/etc/openvpn/easy-rsa # ./clean-all
you must define KEY_DIR

Aber ich habe Key-DIR definiert. Das steht bei mir in der vars - Datei.
Code:
export KEY_DIR=/etc/openvpn/easy-rsa/Keys
Bitte hilft mir doch jemand, das ist echt sowas von dringend hier, mein Chef steht schon halb auf meinem Kopf.
 
Zuletzt bearbeitet:
du musst die datei vorher "sourcen", damit die Variablen auch in der aktuellen shell gesetzt sind.
steht aber auch alles im openvpn tut/faq/what ever auf der projektpage.

nur der vollstaendigkeit halber, es geht auch "nur" mit passwoertern, aber nimm lieber die zertifikate, sind i.A. nicht schwerer einzurichten, haben aber ein paar vorteile (revoke und co).
 
tarcus schrieb:
Wir benutzen Suse Linux 10.1, ich weiss :), aber für Einsteiger soll es ja recht einfach sein, daher haben wir uns dafür entschieden.
[/CODE]

Hmm das hört sich immer so an, als würden die Leute denken, Suse sei nur was für Einsteiger?! Finde diese Einstellung ziemlich merkwürdig, aber Suse scheint dieser Ruf wohl anzuhaften, bzw. viele Leute haben einfach keinen blassen Dunst wovon sie reden...:think:

Btw. ich meine jetzt nicht den Thread-Ersteller damit, wollte das nur mal generell anmerken.


Gruß
Philipp
 
Vielen Dank für die zahlreichen Antworten, leider bringt mich das nicht weiter. Was heisst das, Dateien sourcen? Sorry, ich kann auch in dem Tut dazu nichts finden. :think:

Kann mir niemand eine kleine Schritt-für-Schritt Anleitung dazu machen? Bisher habe ich alles mir selbst beigebracht, aber jetzt ist ein Punkt erreicht, wo das einfach nicht mehr möglich ist. Ich hoffe es kann mir jemand dabei helfen, bin wirklich ein totaler Einsteiger.

Danke schonmal (*vomChefeinenFusstrittbekomm*) *aua*
 
tarcus schrieb:
Vielen Dank für die zahlreichen Antworten, leider bringt mich das nicht weiter. Was heisst das, Dateien sourcen? Sorry, ich kann auch in dem Tut dazu nichts finden. :think:

Code:
Next, initialize the PKI. On Linux/BSD/Unix:
. ./vars
./clean-all
./build-ca

OpenVPn 2.0 How To
nichts finden? :D
 
Bin ich blöd oder stell ich mich bloss so an? Ich befinde mich im Verzeichnis /etc/openvpn/ und gebe den Befehl ../vars ein, -> No such file or directory ?(

OK, easy-rsa Verzeichnis *kopfschüttel* sorry für den übereiligen Post, ich versuch weiterzukommen, und melde mich bei Bedarf wieder! Danke


Nachtrag:

TADA! Der Server läuft nun endlich, jetzt würde ich nur gern wissen wie ich dem Client ne ovpn Datei zur Verfügung stelle, oder geht das anders? Bitte nicht RTFM :)
 
Zuletzt bearbeitet:

Ähnliche Themen

Nginx als Reverse Proxy für Nextcloud und Emby

Zugriff Ubuntu 16.04. auf Freigabe 18.04. LTS nicht möglich

Verständnisfrage zu RegExps

Senior System & Network Admin in Berlin

X startet nichtmehr

Zurück
Oben