Convert ovpn file to inline format (all in one ovpn client config file)

Convert ovpn file to inline format (all in one ovpn client config file)

By devin, 22 October, 2015

Whenever I use openvpn I'm stuck carting around 5 files, sending them over Bluetooth and cluttering up my phone's downloads directory or confusing people I'm setting up with openvpn

I decided finally to figure out inline openvpn client config files. I made this sed script/command that will automate the process:

sed -i "${1}.ovpn" -e '

/ca ca.crt/ {

a\<ca>

r ca.crt

a\</ca>

d

}' -e "

/cert client.crt/ {

a\<cert>

r ${1}.crt

a\</cert>

d

}" -e "

/key client.key/ {

a\<key>

r ${1}.key

a\</key>

d

}" -e '

/tls-auth ta.key 1/ {

a\key-direction 1

a\<tls-auth>

r ta.key

a\</tls-auth>

d

}'

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.