IKEv2, RHEL 7 VPN Server, WIN 7 VPN Client and Public Keys
I have project where employees and customers will need to login remotely to the company network. Most will be using windows 7/8 systems.
I decided to use VPN/IKEv2. The end users will login to the company network which consist of a RHEL 7 Firewall/Authentication Server, a RHEL 7 File Server, and 30 windows 7
workstations.
The problem I'm having is that my test windows 7 workstations keep issuing an error code 13806 (windows cannot find a valid certificate)
However after reviewing the windows network trace log, what happens after the ISAKMP "hand-shake" between the rhel 7 server and the win7 client. is that windows
starts searching it's certificate stores for a certificate with the appropriate "private" key. It never finds one. That's because I used certutil to generate a self-signed CA cert.
I then generated a client cert for the win7 system and a server cert for the rhel7 server. Now I exported the client cert and associated CA cert with ONLY the public key.
My understanding about SSL , certificates, and asymmetric keys is that the public key is issued to "The World" i.e. to my win7 client, while the rhel7 server "holds" the private key.
So my question is: MUST I export an certificate to the win7 system that has a private key?? Does IKE actually exchange public & private keys??
Best Regards
Guy
Responses
Hello
You should not copy, move, or export private keys (EDIT: and no, IKE does not exchange private keys).
The client needs a certificate signed by the CA.
Was the client certificate made be generating a key on the client, sending it to the server that functions as your CA, signing it with the CA's key used for client certs and then sending the certificate to the client?
I have not done this on the platform you mention, but I have been working on SSH keys using ssh-keygen. The process should be similar, and is as follows:
1) Generate host CA key on server that functions as your CA
2) Sign CA host key
3) Publish CA public key (or manually copy it to other hosts (servers and clients)
On other hosts that users need to log into:
1) Download CA public key
2) Setup cert-authority in known_hosts file
3) Generate and upload host key to CA, have it signed and download back to host
4) Add pub key /etc/ssh/ssh_known_hosts file using the cert-authority directive (maybe Set up ~/.ssh/authorized_keys per user?)
On users client machines:
1) Download CA public key
2) Setup cert-authority in known_hosts
3) Generate and upload user public key to CA, have it signed and download
back to user machine
4) Set up ssh_config (IdentityFile, ssh-agent, etc. )
HTH
BTW I found this How do I configure an IPSec tunnel from RHEL to Windows 2003 SP2?.
It has some tips at the end for debugging.
Note that Windows is extremely picky with its certificates and Extended Key Usage (EKU)
Note that you should use "Machine Certificates" and not EAP. This will authenticate the Windows machines based on only their X.509 certificate.
Your gateway certificate must have extendedKeyUsage = serverAuth (sometimes called "TLS Web server authentication")
You should also set the "IP Security IKE Intermediate" EKU with OID 1.3.6.1.5.5.8.2.2.
In openssl.cnf terms, you can set both by using:
extendedKeyUsage = serverAuth, 1.3.6.1.5.5.8.2.2
Next, you SHOULD put the VPN server DNS name in the Common Name (CN=vpn.example.com) and MUST put it in the SubjectAltName (SAN)
in openssl.cnf that is:
subjectAltName = DNS:vpn.example.com
For client certificates, be sure to set the clientAuth EKU. If doing this on a Windows Mobile phone, ensure that a SIM card is present when importing and using the VPN. When removing the SIM, the certificate will become unavailable (but importing it won't give an error!)
When adding a certificate to a Win7+ machine, use the MMC and add the Certificate snap-in. You MUST change the type to "Computer Account". Go to Certificates (Local Computer) -> Personal -> Certificates folder and select Import. Import the PKCS#12 (.p12 file) into the personal certificate store. Then move the Root CA that came with the PKCS#12 file into "Trusted Root Certification Authorities -> Certificates. Never use double clicking of a .p12 file to import the certificate, as it will end up in the wrong place.
See also : Microsoft KB926182
I meant to say the server certificates need their DNS name in their certificate. A client certificate can have an email address based ID. If you do not use PKCS12 with private key, then how does the private key of your user's certificates get onto the Windows machines?
You should have a unique private key + certificate and the CAcert together in the PKCS#12 bundle
Speaking generally, one purpose of certificates is to avoid having to copy all clients public keys to the server host. The certificates are signed by the CA, and the server should have the CA's public key in order to authenticate a certificate presented by a client.
What you have suggested in your last paragraph would be public key, a.k.a asymmetric, authentication, which is not what you are trying to achieve it seems.
Both the server needs to authenticate the client, and the client needs to authenticate the server. So both have an identity that is signed by the CA. So both need their own private keys and their own certificate to cryptographically prove their identity.
During IKE(v2), both server and client send their certificate across to each other, along with a signed proof that they are the legitimate owner of that certificate identity - so they sign it with their private key.
Each certificate has its own private key. When creating a PKCS#12 file, this file contains a bundle of public certificate, private key, CA certificate. Each node installs their own bundle. During IKE, no private keys are exchanged, only certificates and signatures made by the respective private keys.
All hosts involved, client or server, have their public and private key pairs (hence the term asymmetric).
It is a hosts public key that is signed by the CA's private key. A certificate is essentially a public key, generated on the client, sent to the CA, combined with some identity details and signed by the CA, then given back to the host.
Certificates do not have to be signed by the same CA although in your application that may be the case. Provided the hosts have the certificate of the CA, they can authenticate a certificate signed by the CA. Think of a browser which has certificates, signed public keys, for many CA's.
It seems to me that in your case the device that is self-signing your CA certificate is your CA, and it should sign the public keys of all hosts involved, and all the hosts need a copy of the CA's certificate.
The private and public key are generated simultaneously on the system and you should only ever give out or copy the public key.
The PKCS #12 file can store the private key, which implies to me that you need to create it on the system where it is wanted and where the private key is.
Searching for articles on how to create the PKCS #12 file on your client's OS version, together with Paul's tips above, should help.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
