From 73c62cb5be43b1e9a977bc503d52bc81d0ed390c Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Fri, 17 Oct 2014 15:54:21 +0100 Subject: [PATCH] Make sure the responses are at least non-empty, otherwise we're going to get into a broken vpn situation. --- src/bootstrap.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap.coffee b/src/bootstrap.coffee index 36051a77..accba75f 100644 --- a/src/bootstrap.coffee +++ b/src/bootstrap.coffee @@ -83,6 +83,10 @@ module.exports = -> throw body console.log('Configuring VPN..', JSON.stringify(body)) + + for prop in ['ca', 'cert', 'vpnhost', 'vpnport'] when _.isEmpty(body[prop]) + throw new Error("'#{prop}' is empty, cannot bootstrap") + vpnConf = fs.readFileAsync(__dirname + '/openvpn.conf.tmpl', 'utf8') .then (tmpl) -> fs.writeFileAsync('/data/client.conf', _.template(tmpl)(body))