Bad news, everyone! It's seems that there is an unfixed bug in Fedora 21: Wired connection with 802.1x PEAP/MSCHAPv2 not working. So while the answer below may work for other distros, Fedora 21 users are currently out of luck.
Never tried that myself, but this post seems to contain a pretty detailed walkthrough for setting up 802.1x between Linux client and Windows domain. Note the certificate request part: it should solve your problem of non exportable certificate. The software versions are pretty old (Ubuntu is 8.04 and Beyond Trust's Power Broker is still likewise), but the basic idea seems solid to me.
I've formatted abovementioned post to make it easier to read. Quoting makes code boxes to be gray on gray, so I dropped it out, sorry:
Disclaimer: This guide is written from the perspective of the Linux Ubuntu 8.04 distribution. To make this work with other Linux or Unix distributions, some changes may need to be made.
The two main things that are necessary for your Linux machine to authenticate over 802.1x is a client certificate and an account in the Windows domain. During the authentication process, the Linux client presents it's computer certificate to the switch, which in turn presents it to the RADIUS server who verifies the certificate, and verifies the computer account the certificate is assigned to in Active Directory. If the certificate and the computer account are valid, then the RADIUS server approves the authentication request sending it back to the switch, which in turn authenticates the port the Linux box is connected to.
The first thing that needs to be done is to join your Linux computer to the Windows domain. Since Linux cannot natively join a Windows domain, we must download the necessary software to allow us to do this. Likewise makes software to allow us to do just this. To install this on Ubuntu it is very simple, just follow these steps:
- sudo apt-get update
- sudo apt-get install likewise-open
- sudo domainjoin-cli join
enter the FQDN of your domain here
enter your admin account here, you may use the format
email@example.com. You should also be able to use the GUI version by going to
System → Administration → Likewise.
- sudo update-rc.d likewise-open defaults
- sudo /etc/init.d/likewise-open start
If you are not running Ubuntu, you may download the software here http://www.likewisesoftware.com/products/likewise_open .
You may now log out and log back in using your domain account. I believe that either format of
firstname.lastname@example.org and domain\user both work. I will test this later.
There are three files located on the Linux machine that must be configured correctly in order for this authentication to take place. These three files are:
First we will configure the software to allow our Linux machine to use a client certificate to authenticate to an 802.1x enabled network;
wpa_supplicant will be used for this.
Follow these steps to configure your wpa_supplicant.conf file:
sudo gedit /etc/wpa_supplicant.conf
Paste the following into the file and save it:
# Where is the control interface located? This is the default path:
# Who can use the WPA frontend? Replace "0" with a group name if you
# want other users besides root to control it.
# There should be no need to chance this value for a basic configuration:
# IEEE 802.1X works with EAPOL version 2, but the version is defaults
# to 1 because of compatibility problems with a number of wireless
# access points. So we explicitly set it to version 2:
# When configuring WPA-Supplicant for use on a wired network, we don't need to
# scan for wireless access points. See the wpa-supplicant documentation if you
# are authenticating through 802.1x on a wireless network:
ssid="<enter any name here, it doesn't matter>"
identity="<FQDN>/computers/<Linux computer name>"
client_cert="/etc/ssl/certs/<your authentication certificate name>.pem"
private_key="/etc/ssl/private/<your private key name>.pem"
Now we must edit your interfaces file. Follow these steps to configure your interfaces file:
sudo gedit /etc/network/interfaces
Paste the following into the file under the
eth0 interface and save it:
# Configure the system to authenticate with WPA-Supplicant on interface eth0
# In this case we have a wired network:
# Tell the system we want to use WPA-Supplicant with our configuration file:
The next step is to generate and install your certificates. We will have to generate a self-signed certificate, then generate a certificate request based on the self-signed certificate we created, then install the certificates.
Note: When creating your certificates, whenever it asks for your name, you must provide the name of the computer which will be authenticating. To be safe, I recommend making the name match the way it is assigned to the computer, including being case sensitive. If you are unsure how it is assigned to your computer, open a terminal and type hostname.
Follow these steps:
sudo openssl req -x509 -nodes -days
enter in days how long you want the cert valid for -newkey rsa:1024 -keyout
enter a name for your private key/certificate here.pem -out
enter a name for your private key/certificate here.pem
Example: sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout privcert.pem -out privcert.pem
openssl req -new -newkey rsa:1024 -nodes -keyout
enter a name for your private key here.pem - out
enter a name for your certificate request here.pem
Example: sudo openssl req -new -newkey rsa:1024 -nodes -keyout privkey.pem -out certreq.pem
All of the certificates created are placed in your home directory (
/home/<username>). The next part is to request a certificate from your CA using the certificate request that was created in the previous step. This will need to be done on a Windows machine, since for some reason Linux and Windows don't get along too well when requesting and downloading certificates; I just found it easier to email the certificate request to myself and perform it on a Windows machine.
Follow these steps to complete the certificate request:
- Go to your home directory on the Linux machine and find your
certificate request file
- Either email the file to yourself or open the file with a text editor (such as gedit) and copy and paste the request into an email and send that to yourself.
- On a Windows client, open a webpage using IE to your CA's website (such as
- Select Request a Certificate
- Advanced Certificate Request
- Now open your email and get the certificate request that you emailed yourself.
- If you emailed yourself the file, open it with notepad and copy and paste the contents into the Base-64 encoded certificate request box. If you emailed yourself the contents of the certificate request file rather than the file itself, then just copy and paste the request from there into the Base-64 encoded certificate request box.
- Click Submit and download the certificate in Base-64 form, not DER.
- Save the certificate to your desktop and name it
your Linux machine name.pem. The system will automatically append the
.cer to the end of it, so just delete that off. Linux uses .pem for certificate extensions.
- Take this file and email it back to yourself.
- Now, on your Linux machine, get your certificate and save it somewhere (preferably your home folder to keep things organized and together).
- Now, we need to copy your certificate that you just received to your
/etc/ssl/certs folder, and we need to copy your private key/certificate and private key created earlier in your
/etc/ssl/private folder. Now, only root has permission to do this, so you can either do this by command line by typing
sudo cp /home/<username>/<certificate>.pem /etc/ssl/private or
/etc/ssl/certs. This can also be done from the GUI by copying and pasting by using the command gksudo and typing in nautilus. Nautilus is the GUI file browser that Ubuntu uses and it will run this as root allowing you to copy and paste to directories that only root has access to.
Now that our certificates are in place, we need to tell openssl how we want to use the certificates. To do this, we must edit the openssl.cnf file and tell it to authenticate our Linux machine as a client rather than a user.
To do this follow these steps:
- sudo gedit /etc/ssl/openssl.cnf
- Scroll down about half way and you should see a section called
[usr_cert]. In this section we need the where the
nsCertType is defined as "For normal client use this is typical", and it should have
nsCertType = client, email and it will be commented out. Uncomment this line and delete the email so that it shows
nsCertType = client. Now save the file.
Now you should have everything you need configured properly to have a Linux machine running in a Windows domain environment and authenticating using 802.1x.
All that is left now is to restart your networking service so that Linux will use the
wpa_supplicant.conf file that is now tied to your
eth0 interface and authenticate. So just run
sudo service networking restart. If you don't get an IP address after your interface comes back up, you can manually request an IP from your DHCP server by typing