{"id":2166,"date":"2015-11-11T22:53:56","date_gmt":"2015-11-11T18:53:56","guid":{"rendered":"http:\/\/sandalov.org\/blog\/?p=2166"},"modified":"2015-11-11T22:53:56","modified_gmt":"2015-11-11T18:53:56","slug":"split-ovpn-file-to-ca-cert-and-key-with-awk","status":"publish","type":"post","link":"https:\/\/sandalov.org\/blog\/2166\/","title":{"rendered":"Split .ovpn file to ca, cert and key with awk"},"content":{"rendered":"<div class=\"2d836d85a73757df15d0de19d7bef594\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-2287684400845931\";\r\n\/* valerymorozov *\/\r\ngoogle_ad_slot = \"5606708872\";\r\ngoogle_ad_width = 728;\r\ngoogle_ad_height = 90;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>With the following awk commands one can simply extract ca, cert and key files:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nawk '\/&lt;ca&gt;\/{flag=1;next}\/&lt;\\\/ca&gt;\/{flag=0}flag' client.ovpn &gt; server-ca.pem\r\nawk '\/&lt;cert&gt;\/{flag=1;next}\/&lt;\\\/cert&gt;\/{flag=0}flag' client.ovpn &gt; server.crt\r\nawk '\/&lt;key&gt;\/{flag=1;next}\/&lt;\\\/key&gt;\/{flag=0}flag' client.ovpn &gt; server.key\r\n<\/pre>\n<div class=\"2d836d85a73757df15d0de19d7bef594\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-2287684400845931\";\r\n\/* valerymorozov *\/\r\ngoogle_ad_slot = \"5606708872\";\r\ngoogle_ad_width = 728;\r\ngoogle_ad_height = 90;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>With the following awk commands one can simply extract ca, cert and key files: awk &#8216;\/&lt;ca&gt;\/{flag=1;next}\/&lt;\\\/ca&gt;\/{flag=0}flag&#8217; client.ovpn &gt; server-ca.pem awk &#8216;\/&lt;cert&gt;\/{flag=1;next}\/&lt;\\\/cert&gt;\/{flag=0}flag&#8217; client.ovpn &gt; server.crt awk &#8216;\/&lt;key&gt;\/{flag=1;next}\/&lt;\\\/key&gt;\/{flag=0}flag&#8217; client.ovpn &gt; server.key<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2166","post","type-post","status-publish","format-standard","hentry","category-unsorted"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/2166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/comments?post=2166"}],"version-history":[{"count":1,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/2166\/revisions"}],"predecessor-version":[{"id":2167,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/2166\/revisions\/2167"}],"wp:attachment":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/media?parent=2166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/categories?post=2166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/tags?post=2166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}