Created
March 28, 2016 21:10
-
-
Save LS80/b5129fac18edb4fe8897 to your computer and use it in GitHub Desktop.
Create Network Manager OpenVPN certificates and keys from .ovpn file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE_NAMES = {'ca' => 'ca.crt', | |
'cert' => 'usr.crt', | |
'key' => 'usr.key', | |
'tls-auth' => 'tls.key', | |
} | |
config = File.read(ARGV[0]) | |
FILE_NAMES.each do |tag, filename| | |
config.match(/<#{tag}>(.*?)<\/#{tag}>/m) | |
File.open(filename, 'w') {|f| f.write($1)} if $1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment