Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rexxars/openvpn-config-splitter
Splits OpenVPN (.ovpn) files into separate files for private key and user+ca certificates
https://github.com/rexxars/openvpn-config-splitter
Last synced: 3 months ago
JSON representation
Splits OpenVPN (.ovpn) files into separate files for private key and user+ca certificates
- Host: GitHub
- URL: https://github.com/rexxars/openvpn-config-splitter
- Owner: rexxars
- License: mit
- Created: 2014-02-24T08:32:49.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-08-04T11:48:14.000Z (over 8 years ago)
- Last Synced: 2024-10-13T02:01:37.765Z (3 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 20
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - rexxars/openvpn-config-splitter - Splits OpenVPN (.ovpn) files into separate files for private key and user+ca certificates (others)
README
[![Build Status][1]][2] [![dependency status][3]][4]
openvpn-config-splitter
=======================Splits OpenVPN (.ovpn) files into separate files for private key, user+ca certificates and tls-auth key, for use with network-manager in debian/ubuntu.
## Installation
openvpn-config-splitter can be installed using [npm](https://npmjs.org/):```bash
# NPM:
npm install -g openvpn-config-splitter
```## Usage
### As a CLI-tool
```bash
# Install globally
$ npm install -g openvpn-config-splitter# Run it, specifying your unsplit OpenVPN configuration file
$ ovpnsplit path/to/some/config.ovpn# Config is now split into separate files, new configuration
# linking to the split files has been generated
$ ls path/to/some
ca.crt client.key client.ovpn client.split.ovpn ta.key user.crt
```### As a library
```javascript
var fs = require('fs'),
configPath = '/some/path/to',
splitter = require('openvpn-config-splitter');var paths = {
'caCert': configPath + '/openvpn-ca.crt',
'userCert': configPath + '/openvpn-user.crt',
'privateKey': configPath + '/openvpn-private.key',
'tlsAuth': configPath + '/openvpn-tls.key'
};fs.readFile(configPath + '/config.ovpn', function(err, originalConfig) {
if (err) {
console.error('Could not read file (' + err.path + ')');
process.exit(1);
}splitter.split(originalConfig, paths, function(err, parts, missing) {
if (err) {
console.error(err);
process.exit(1);
}/**
* `parts` now contain the matched parts of the config + new config
* (caCert, userCert, privateKey, tlsAuth, config)
*
* `missing` is an array containing the parts that were NOT found -
* use this if you want to warn the user or fall back if you require
* a specific part to be present
*/// Want to write the split files?
splitter.writeToFiles(parts, paths, function(err) {
if (err) {
console.log(err);
process.exit(1);
}console.log('Hooray, we split the files and wrote them to disk!');
});});
});
```[1]: https://travis-ci.org/rexxars/openvpn-config-splitter.png
[2]: https://travis-ci.org/rexxars/openvpn-config-splitter
[3]: https://david-dm.org/rexxars/openvpn-config-splitter.png
[4]: https://david-dm.org/rexxars/openvpn-config-splitter