OpenVPN inline *.ovpn file

In the VPN article I posted previously I instructed you to create and use separate files for the client.ovpn config and all the keys. Because the router I used in that article puts these multiple files in a tidy folder I never bothered to combine them down to one file. Other routers can be used but I’m finding many of them want a single ovpn config file with the keys in that file. It took a little trial and error to get that set up right for my purposes but this template will get you running. Just replace the keys as noted and put your server address in the file.

# This file compatible with topology SUBNET
# Intended for OpenWRT, windows, or iphone/android
# Edit remote server URL and port as appropriate for hosted server. 
# Edit this file name to keep things organized, and retain on server in folder: C:\Program Files\OpenVPN\easy-rsa\client-configs

# VPN type
client

# Connection setup
proto tcp4-client
remote example.com 1194
nobind

# Encryption 
cipher AES-256-GCM
tls-client
remote-cert-eku "TLS Web Server Authentication"

# Network setup
dev tun

# Logging level
verb 3

<ca>
-----BEGIN CERTIFICATE-----
MIIDOTCCAiGgAwIBAgIUKgoITzxu4MZxPOBMC8QU13vLHdgwDQYJKoZIhvcNAQEL
BQAwEDEOMAwGA1UEAwwFd2NpMDEwHhcNMjEwNzE5MTkzNzM2WhcNNDEwNzE0MTkz
NzM2WjAQMQ4wDAYDVQQDDAV3Y2kwMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
#
#
#
Insert the contents of your ca.crt file here replacing everything between beginning and end lines
#
#
#
Xr8YJjNZjjyuZxNk4liajUFbeXogMQqKmy/DbpEG7Icgo8CtIApL44/BkDmtMUcl
EROcO8we5qekXpafG+DrkI1/0DPkn0gMQCDouRYoE01krOEPsLi/kq2wsW/+dRpm
YGh6JBg5CYRU3UKWKg==
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
MIIDTjCCAjagAwIBAgIQEkhs+4EmLw+sAiyhRKqKvTANBgkqhkiG9w0BAQsFADAQ
MQ4wDAYDVQQDDAV3Y2kwMTAeFw0yMTA4MjUxMzQ5MzNaFw00MTA4MjAxMzQ5MzNa
MBcxFTATBgNVBAMMDHNjb3R0amFsYmVydDCCASIwDQYJKoZIhvcNAQEBBQADggEP
#
#
#
Insert the contents of your clientname.crt file here replacing everything between beginning and end lines
You only need the bottom portion between the beginning/end certificate
#
#
#
nfRqNiC340rlE4DdmSwmVAUkNKbuvqKyeCkKeCMKxCXUW6MD14SxJJtc+c2oBj7v
R/CbQZ88SRcs1Cl9VrS8DTEu+jCB119QdgRuScefAlMc6CuYbMoJ5tsAO4Gsp2He
HVuaryoLyfgVaQ5J17e2vzfUqQgTMDzWWgdfbNbo+lMMxg==
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCl6KlGjTNwdWR
cfYERmjx+CRNAZ8RdooJdQWEn14QZCF4ZRodMmCDlBBV0pxbUwUje9QY0GlkAWXD
oc3G16D1rbow+kCt3KYGBpbiTrth1OFwAk6uJrPZEbJJx9PzWkD2GjyoDNNBxwXf
CmiE1aulR0zKvDGttc15rxpYavNdd4xG/zHgBwOSZTr8Jdf0BF64rF4AG3tjI3VL
#
#
#
Insert the contents of your clientname.key file here replacing everything between beginning and end lines
#
#
#
iqoM+k2YDLa8IdS7JBTWRLEc1mc4yyxEEBnix4XQZck4KN/MYpAMg7SaAQ6MEjb/
Tki6Q3stX/QH+ly+emLPi6BTkQZRVqfULom6T5LaMQKBgEhJRBhI72IlYFy6ToBV
0wVZ58w9/XqhNO+4dYn6xCxnlpHPrJxM0nyOD+BVq2jTL27Tc+St1gOhKghnl/Ut
F0gxqaipihPwb3kZPAem6hd/+AiYImjkhK16/twP17fMdkHW1pD1Z/zinp5QR1Xf
OOYi+8TOWBy3oaDWmMBWfcmr
-----END PRIVATE KEY-----
</key>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
6d2bb20b9a472cc9f9ccc28480546fe6
a7e9044b830ba359f4dfa67d6c3abba9
8b774cd34e932d3424c5f5875e38f368
9716a491dada2e2d573777a9d573f18d
#
#
#
Insert the contents of your ta.key file here replacing everything between beginning and end lines
#
#
#
2690bb42a57c53f6636f2e1d8e58cb91
a0adc04c6b6a5afe037f759d39645633
aadab0a4a00b2c241ad9235452963cdb
fee148dd45b5894a01cb51f468363273
-----END OpenVPN Static key V1-----
</tls-auth>