Skip to content

Commit

Permalink
v2.1.2 Fix issue with ca/server keys/certificates when "Directory to …
Browse files Browse the repository at this point in the history
…put generated user certificates and keys" option is specified
  • Loading branch information
Yingchun Li committed Aug 25, 2019
1 parent 2ecde9a commit f313989
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ and this project (kind of) adheres to [Semantic Versioning](http://semver.org/sp

## [Unreleased]

## [2.1.2] - 2019-08-25
### Fixed
- Fixed issue with "file not found" when "Directory to put generated user certificates and keys" option is specified

## [1.2.0] - 2019-03-05
### Changed
- Automatically add openvpn firewall rule for edgeRouter (no checking for existing rule yet)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "OpenVPNConfiguratorForDDWRTAndEdgeRouter",
"description": "A small Utility to assist with OpenVPN configurations on DD-WRT and EdgeRouter",
"author": "Yingchun Li<[email protected]>",
"version": "2.1.1",
"version": "2.1.2",
"private": true,
"license": "MIT",
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions src/ConfiguratorOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const ConfiguratorOutput = (
await autoConfigViaSSH(configuratorOutput, vpnParameters);
onConfiguratorStatusChange('sshAutoConfigureOutput', `Auto configure done successfully`);
} catch (e) {
console.error(e);
onConfiguratorStatusChange('sshAutoConfigureOutput', `Auto configure failed : ${e.message}. Please do the configuration manually`);
} finally {
}
Expand Down Expand Up @@ -209,6 +210,7 @@ const ConfiguratorOutput = (
try {
await generateConfigurations();
} catch (e) {
console.error(e);
onConfiguratorError(`Auto configure failed : ${e.message}. Please do the configuration manually`);
}
};
Expand Down
12 changes: 9 additions & 3 deletions src/StepperApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import VPNParameters from './VPNParameters';
import CertificateOptions from './CertificateOptions';
import ConfiguratorOutput from './ConfiguratorOutput';

import {executableDir, isDev, publicAddress, internalNetwork, routerInternalIP} from './environment';
import {executableDir, changeKeyfilesPath, isDev, publicAddress, internalNetwork, routerInternalIP} from './environment';
import {VPN_OPTION_CA_GENERATE_NEW, VPN_OPTION_CA_USE_EXISTING_ROUTE} from "./vpn-utils";

const INITIAL_STATE = {
Expand Down Expand Up @@ -150,6 +150,12 @@ class StepperApp extends Component {
});
};

resetConfiguration = (event) => {
event.preventDefault();
changeKeyfilesPath(executableDir);
this.setState({...INITIAL_STATE, stepIndex: 0, finished: false});
};

render() {
const {vpnParameters, serverOptions, clientOptions, showServerOptions, configuratorOutput, configuratorStatus, finished, stepIndex} = this.state;
const contentStyle = {margin: '0 16px'};
Expand Down Expand Up @@ -221,8 +227,7 @@ class StepperApp extends Component {
<a
href="#reset"
onClick={(event) => {
event.preventDefault();
this.setState({...INITIAL_STATE, stepIndex: 0, finished: false});
this.resetConfiguration(event);
}}
>
Click here
Expand Down Expand Up @@ -258,6 +263,7 @@ class StepperApp extends Component {
);

}

}

StepperApp.propTypes = {};
Expand Down
6 changes: 6 additions & 0 deletions src/VPNParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {renderTableRow, renderTextFieldTableRow, renderRadioButtonGroup} from '.
import {ADDRESS_BEING_CHECKED, ADDRESS_IS_REACHABLE, ADDRESS_NOT_REACHABLE} from "./utils";

import {dialog, fs, ping} from './environment';
import {changeKeyfilesPath} from './environment';
import {isEdgeRouterMode} from "./vpn-utils";
import {VPN_OPTION_CA_USE_EXISTING_LOCAL, VPN_OPTION_CA_GENERATE_NEW, VPN_OPTION_CA_USE_EXISTING_ROUTE} from "./vpn-utils";

Expand Down Expand Up @@ -97,6 +98,11 @@ class VPNParameters extends Component {
if (field === 'commonName') {
newVPNParameters.commonNameHasBeenSet = true;
}

if (field === 'userKeysDir') {
changeKeyfilesPath(value);
}

this.props.onChange && this.props.onChange(newVPNParameters);
};

Expand Down
14 changes: 10 additions & 4 deletions src/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ export const executableDir = process.env.PORTABLE_EXECUTABLE_DIR || './output';
export const isDev = !!electron_start_url; // we are in dev mode env ELECTRON_START_URL is set

// ca files
export const caCertFile = `${executableDir}/ca.crt`;
export const serverCertFile = `${executableDir}/server.crt`;
export const serverPrivateKeyFile = `${executableDir}/server.key`;
export const dhPemFile = `${executableDir}/dh.pem`;
export let caCertFile = `${executableDir}/ca.crt`;
export let serverCertFile = `${executableDir}/server.crt`;
export let serverPrivateKeyFile = `${executableDir}/server.key`;
export let dhPemFile = `${executableDir}/dh.pem`;
export const changeKeyfilesPath = (keyFilesDir) => {
caCertFile = `${keyFilesDir}/ca.crt`;
serverCertFile = `${keyFilesDir}/server.crt`;
serverPrivateKeyFile = `${keyFilesDir}/server.key`;
dhPemFile = `${keyFilesDir}/dh.pem`;
};

// network address
const interfaces = os.networkInterfaces();
Expand Down

0 comments on commit f313989

Please sign in to comment.