#
##::[[--- Linux OpenSSL Config ---]]::##
#====================================================================
##----- Notes -----##
#====================================================================
All commands required can be found beginning on line 430
Windows users, either:
# Change file paths from "/" to "\\"
# Download the Windows openssl.cnf: https://github.com/JW0914/Wikis/blob/master/Scripts+Configs/OpenSSL/openssl.cnf
Sophos users:
# If not using SANs, prior to generating user certs, ensure 'x509_extensions = usr_cert_not_dn'
# This results with 'RFC822 Name = user@email.com' in the SubjectAlternativeName of the certificate.
# Without this, it will be impossible to authenticate to VPNs on Sophos.
# Intermediate CAs & Intermediate CA client certs CANNOT be utilized on Sophos UTM due to how Sophos authenticates.
# Only exception is the WebAdmin certificate, which can be signed by a Public ICA authority for a FQDN.
# For chain of trust to be maintained, CA & ICA must be installed on devices accessing the WebAdmin/User Portal.
#====================================================================
##----- Establish Build Variables -----##
#====================================================================
dir = /etc/ssl
cnf = /etc/ssl/openssl.cnf
CNF = $dir/openssl.cnf
#====================================================================
##----- Establish CA Profile and Policy -----##
#====================================================================
[ default ]
UTM = "Sophos UTM CA"
WRT = "Router 2 ICA"
VPN = "Router 2 VPN ICA"
[ ca ]
default_ca = CA_default
#====================================================================
[ CA_default ]
certs = $dir
new_certs_dir = $dir
database = $dir/index
RANDFILE = $dir/rand
serial = $dir/serial
crldir = $dir/crl
crlnumber = $crldir/crlnumber
crl = $crldir/ca.crl.pem
default_crl_days = 3650
certificate = "$dir/ca/$UTM.crt.pem"
private_key = "$dir/ca/$UTM.key.pem"
default_days = 3650
preserve = no
default_md = sha512
x509_extensions = usr_cert_not_dn
copy_extensions = copy
unique_subject = yes
policy = policy_match
name_opt = esc_2253,esc_ctrl,esc_msb,sep_comma_plus_space,ignore_type
cert_opt = ca_default
#====================================================================
[ policy_match ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = match
commonName = supplied
emailAddress = optional
[ policy_supply ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = match
commonName = optional
emailAddress = optional
#====================================================================
##----- Establish Certificate Options -----#
#--------------------------------------------------------------------
# x64 machines always process SHA512 faster than SHA256.
# 'encrypt_key = yes' is not currently commented out.
# When creating a key for a server, add '-nodes' to the Request command.
[ req ]
default_bits = 2048
default_keyfile = private.key.pem
preserve = no
default_md = sha512
string_mask = utf8only
utf8 = yes
distinguished_name = req_distinguished_name
attributes = req_attributes
req_extensions = v3_req
x509_extensions = v3_ca
copy_extensions = copy
encrypt_key = yes
[ req_attributes ]
challengePassword =
challengePassword_min = 12
challengePassword_max = 40
#====================================================================
[ req_distinguished_name ]
countryName = Country
countryName_max = 2
stateOrProvinceName = State
localityName = Locality
0.organizationName = Organization
organizationalUnitName = Organizational Unit
commonName = Common Name
commonName_max = 64
emailAddres = Email
emailAddress_max = 64
countryName_default = xx
stateOrProvinceName_default = State
localityName_default = Locality
0.organizationName_default = Sophos UTM
organizationalUnitName_default = LAN
#====================================================================
##----- Establish SubjectAltName (SAN) Profiles -----##
#====================================================================
All server certs with WebUIs should have their loopback IP specified in their SAN profile.
# This prevents certificate errors if connecting to the device, router, or server via an SSH tunnel.
# Certain OS CA certs must have the loopback IP specified in SAN profile (i.e. Sophos UTM's CA).
Provided SAN profiles are utilized, Common Names can be whatever one wishes (i.e. not the DNS or IP)
# SANs can be: 'email' (email address), 'URI' (Uniform Resource Indicator), 'DNS' (DNS domain name),
# 'RID' (Registered ID: OBJECT IDENTIFIER), 'IP' (IP address), 'dirName' (Distinguished Name), and 'otherName'.
#--------------------------------------------------------------------
##----- Certificate Authorities -----##
#--------------------------------------------------------------------
Main
[ alt_ca_main ]
DNS.1 = Router.1
IP.1 = 127.0.0.1
Router 2
[ alt_ica_router2 ]
DNS.1 = Router.2
IP.1 = 127.0.0.1
Code Signing
[ alt_signing_ica ]
DNS.1 = Code-Signing
#--------------------------------------------------------------------
##----- Certificate Authority Clients -----##
#--------------------------------------------------------------------
Main
Servers
[ alt_sophos ]
IP.1 = 192.168.2.1
IP.2 = 127.0.0.1
DNS.1 = UTM.WRT
DNS.2 = your.ddns.com
[ alt_truenas ]
IP.1 = 192.168.2.13
IP.2 = 192.168.2.130
IP.3 = 127.0.0.1
DNS.1 = TrueNAS.WRT
DNS.2 = your-fqdn.com
[ alt_vpn_server1 ]
IP.1 = 10.0.0.1
DNS.1 = your.ddns.com
Clients
[ alt_vpn1_user1 ]
email.1 = user@email.com
DNS.1 = VPN1-Client1-Device1
DNS.2 = VPN1-Client1-Device2
#--------------------------------------------------------------------
##----- Intermediate Certificate Authority Clients -----##
#--------------------------------------------------------------------
Router 2
Servers
[ alt_openwrt ]
IP.1 = 192.168.2.2
IP.2 = 127.0.0.1
DNS.1 = LAN.WRT
[ alt_vpn_server2 ]
IP.1 = 10.0.1.1
DNS.1 = your.ddns.com
Clients
[ alt_vpn2_user1 ]
DNS.1 = VPN2-Client1-Device1
email.1 = user@email.com
[ alt_vpn2_user2 ]
DNS.1 = VPN2-Client2-Device1
DNS.2 = VPN2-Client2-Device2
email.1 = user@email.com
Code Signing
Cert1
[ alt_codesign ]
email.1 = user@email.com
#====================================================================
##----- Establish Certificate Authority V3 Profiles -----##
#--------------------------------------------------------------------
These V3 CA profiles must not be modified to contain any more, or any less, KUs.
These have been configured specifically for security & its imperative no other keyUsages are set
# For an ICA to be capable of signing CAs/ICAs, 'pathlen' number must mirror number of CAs/ICAs it can sign
By default, all ICAs 'pathlen' values are set to 0, meaning they can sign certs, but not other CAs/ICAs.
# If 'pathlen' is not specified, CA/ICA can sign an infinite number of other CAs/ICAs.
[ v3_ca ]
basicConstraints = critical, CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
subjectAltName = @alt_ca_main
keyUsage = critical, cRLSign, digitalSignature, keyCertSign
[ v3_ica_router2 ]
basicConstraints = critical, CA:TRUE, pathlen:0
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
subjectAltName = @alt_ica_router2
keyUsage = critical, cRLSign, digitalSignature, keyCertSign
[ v3_signing_ica ]
basicConstraints = critical, CA:TRUE, pathlen:0
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, cRLSign, digitalSignature, keyCertSign
subjectAltName = @alt_signing_ica
[ crl_ext ]
issuerAltName = issuer:copy
authorityKeyIdentifier = keyid:always, issuer:always
#====================================================================
##----- Establish Generalized V3 Certificate Profiles -----##
#--------------------------------------------------------------------
[ v3_req ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
[ usr_cert_dn ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = critical, clientAuth, emailProtection
[ usr_cert_not_dn ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
subjectAltName = email:copy
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = critical, clientAuth, emailProtection
#====================================================================
##----- Establish Client Certificate V3 Profiles -----##
#--------------------------------------------------------------------
These V3 profiles should not be modified to contain less than what they are currently configured with.
# These have been specifically configured with security in mind.
All servers capable of TLS should contain all keyUsages, except for 'dataEncipherment'
# VPN and file servers should not have less than: 'digitalSignature, keyEncipherment, keyAgreement'
All servers must contain EKU 'serverAuth'
# All server [VPN] clients must contain EKU 'clientAuth'
#--------------------------------------------------------------------
##----- Certificate Authority Clients -----##
#--------------------------------------------------------------------
Main
Servers
[ v3_sophos ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment, keyAgreement
extendedKeyUsage = critical, serverAuth
subjectAltName = @alt_sophos
[ v3_truenas ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment, keyAgreement
extendedKeyUsage = critical, serverAuth
subjectAltName = @alt_truenas
[ v3_vpn_server1 ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment, keyAgreement
extendedKeyUsage = critical, serverAuth
subjectAltName = @alt_vpn_server1
Clients
[ v3_vpn1_user1 ]
basicConstraints = critical,CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment
extendedKeyUsage = critical, clientAuth
subjectAltName = @alt_vpn1_user1
#--------------------------------------------------------------------
##----- Intermediate Certificate Authority Clients -----##
#--------------------------------------------------------------------
Router 2
Servers
[ v3_openwrt ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment, keyAgreement
extendedKeyUsage = critical, serverAuth
subjectAltName = @alt_openwrt
[ v3_vpn_server2 ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment, keyAgreement
extendedKeyUsage = critical, serverAuth
subjectAltName = @alt_vpn_server2
Clients
[ v3_vpn2_user1 ]
basicConstraints = critical,CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment
extendedKeyUsage = critical, clientAuth
subjectAltName = @alt_vpn2_user1
[ v3_vpn2_user2 ]
basicConstraints = critical,CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, digitalSignature, keyEncipherment
extendedKeyUsage = critical, clientAuth
subjectAltName = @alt_vpn2_user2
Code Signing
Certificates
[ v3_codesign ]
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always, issuer:always
keyUsage = critical, nonRepudiation, digitalSignature
extendedKeyUsage = critical, codeSigning, msCodeInd, msCodeCom, msCTLSign, timeStamping
subjectAltName = @alt_codesign