This page will cover the basics of setting up EAP-TLS certificate-based-authentication on Ubuntu to a Wi-Fi or wired ethernet network setup for RADIUS with our EZRADIUS Cloud RADIUS solution. These set of instructions should be the same with any other Linux distribution that runs GNOME with NetworkManager.
We have instructions on how to do it manually, and also how to use bash scripts to automatically setup the network with a client SCEP certificate.
In order to set up EAP-TLS on your Ubuntu machine, you will need to make sure to have the policy setup and the following setup:
Here is a tutorial on how to setup Cloud RADIUS for your Meraki Network.
The fist step in authenticating to a network with EAP-TLS is to install the RADIUS Sever CA certificate enabling the client to trust the certificate.
openssl rsa -aes256 -in $FILE_WITH_PRIVATE_KEY -out $FILE_NAME_FOR_ENCRYPTED_PRIVATE_KEY
NOTE: Make sure that the private key and the certificate file are separate. This is a limitation with NetworkManager.
CA_PATH
and EZCA_SERVER_CA_STATIC_SCEP_URL
empty. Set the
EZCA_SERVER_CA_STATIC_SCEP_URL
if the server certificate CA is a SCEP EZCA
certificate, else, manually download the CA certificate and put the
absolute path to the CA file in CA_PATH
SSID
#!/bin/bash
# User-set values
# CA_PATH= # Set to the absolute path of the server certificate CA
# EZCA_SERVER_CA_STATIC_SCEP_URL=
# SSID= # SSID of the wireless network
# NOTE: if the server certificate is set to be auto-generated, leave the CA_PATH empty and
# the script will install the autogenerated CA. If you are using a server certificate
# generated from EZCA, the script will also install it automatically if you put down your
# EZCA server certificate CA static scep URL
## ---------- ## ---------- ## ---------- ## ---------- ## ---------- ##
# Check all required executables exist
req_execs=("base64" "cat" "curl" "cut" "grep" "head" "mkdir" "nmcli" "sed")
for exe in "${req_execs[@]}"; do
if [ ! $(command -v "$exe") ]; then
echo "Required executable $exe not found"
exit 1
fi
done
SSID=${SSID:-'DEFAULT_SSID'}
CONNECTION_NAME=${CONNECTION_NAME:-'keytos-ezradius-eap-tls'}
SCEP_CER_DIR=${SCEP_CER_DIR:-"$HOME/.local/share/keytos/scep_certs"}
KEY_PWD_PATH=$SCEP_CER_DIR/key.pwd
ENCRYPTED_KEY_PATH=$SCEP_CER_DIR/key.encrypted.pem
CER_PATH=$SCEP_CER_DIR/certificate.pem
WIFI_NIC=$(nmcli -t -f DEVICE,TYPE device | grep wifi$ | head -n 1 | cut -d: -f1)
if [ -z "$WIFI_NIC" ]; then
exit 1
fi
nmcli -f GENERAL.STATE con show "$CONNECTION_NAME" > /dev/null
if [ $? -eq 0 ]; then
exit 0
fi
# Get CA for the auto-generated certificate, if server certificate is custom it must
# be manually installed and passed above
if [ ! -f $CA_PATH ]; then
INSTALL_DIR=${INSTALL_DIR:-"$HOME/.local/share/keytos/ezradius"}
mkdir -p $INSTALL_DIR
CA_PATH=$INSTALL_DIR/server_ca_certificate.pem
EZCA_SERVER_CA_STATIC_SCEP_URL=${EZCA_SERVER_CA_STATIC_SCEP_URL:-'https://portal.ezca.io/api/SCE
curl ${EZCA_SERVER_CA_STATIC_SCEP_URL}?operation=GetCACert \
| base64 \
| sed '1i -----BEGIN CERTIFICATE-----' \
| sed '$a -----END CERTIFICATE-----' \
> $CA_PATH
fi
# Check files exist
if [ ! -f $CA_PATH ] || [ ! -f $CER_PATH ] || [ ! -f $ENCRYPTED_KEY_PATH ] || [ ! -f $KEY_PWD_PATH ]; then
exit 1
fi
nmcli c add type wifi ifname "$WIFI_NIC" con-name "$CONNECTION_NAME" \
802-11-wireless.ssid "$SSID" \
802-11-wireless-security.key-mgmt wpa-eap \
802-1x.eap tls \
802-1x.identity 'anonymous' \
802-1x.ca-cert "$CA_PATH" \
802-1x.client-cert "$CER_PATH" \
802-1x.private-key "$ENCRYPTED_KEY_PATH" \
802-1x.private-key-password "$(cat $KEY_PWD_PATH)"