Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
Changes in on-demand Firewall settings
Browse files Browse the repository at this point in the history
- Divide 'On-demand firewall' configuration on two options: activate on
connect, deactivate on disconnect
https://privatus.atlassian.net/browse/WC-1091

- Remove from settings "Deactivate IVPN Firewall on IVPN Client exit"
https://privatus.atlassian.net/browse/WC-1090
  • Loading branch information
stenya committed Dec 9, 2020
1 parent beb78ea commit 4522d7e
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ivpn-ui",
"version": "3.2.2",
"version": "3.2.3",
"description": "IVPN Client",
"author": "IVPN Limited",
"license": "GPL-3.0",
Expand Down
37 changes: 34 additions & 3 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,39 @@ if (gotTheLock) {
app.on("before-quit", async event => {
// if disconnected -> close application immediately
if (store.getters["vpnState/isDisconnected"]) {
if (store.state.settings.firewallOffOnExit) {
await daemonClient.EnableFirewall(false);
if (
store.state.vpnState.firewallState.IsPersistent == false &&
store.state.vpnState.firewallState.IsEnabled == true
) {
let actionNo = dialog.showMessageBoxSync({
type: "question",
message: "Deactivate Firewall?",
detail:
"The IVPN Firewall is active.\nDo you want to deactivate it before exiting the application?",
buttons: [
"Cancel",
"Keep Firewall activated & Quit",
"Deactivate Firewall & Quit"
]
});

switch (actionNo) {
case 0: // Cancel
// discard exiting
event.preventDefault();
// show app window back (if not minimizing to tray)
if (store.state.settings.minimizeToTray !== true)
setTimeout(menuOnShow, 0);
break;

case 1: // Keep Firewall activate & Quit
// do nothing here
break;

case 2: // Deactivate Firewall & Quit
await daemonClient.EnableFirewall(false);
break;
}
}
return;
}
Expand Down Expand Up @@ -240,7 +271,7 @@ if (gotTheLock) {
setTimeout(async () => {
try {
if (
store.state.settings.firewallOnOffOnConnect ||
store.state.settings.firewallDeactivateOnDisconnect ||
store.state.settings.disconnectOnQuit
)
await daemonClient.EnableFirewall(false);
Expand Down
30 changes: 15 additions & 15 deletions src/components/settings/settings-firewall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@
<div class="settingsBoldFont">
On-demand Firewall:
</div>

<div class="param">
<input
type="checkbox"
id="firewallOnOffOnConnect"
id="firewallActivateOnConnect"
:disabled="firewallPersistent === true"
v-model="firewallOnOffOnConnect"
v-model="firewallActivateOnConnect"
/>
<label class="defColor" for="firewallOnOffOnConnect"
>Activate on connect to VPN and deactivate on disconnect</label
<label class="defColor" for="firewallActivateOnConnect"
>Activate IVPN Firewall on connect to VPN</label
>
</div>
<div class="param">
<input
type="checkbox"
id="firewallOffOnExit"
id="firewallDeactivateOnDisconnect"
:disabled="firewallPersistent === true"
v-model="firewallOffOnExit"
v-model="firewallDeactivateOnDisconnect"
/>
<label class="defColor" for="firewallOffOnExit"
>Deactivate IVPN Firewall on IVPN Client exit (when VPN
disconnected)</label
<label class="defColor" for="firewallDeactivateOnDisconnect"
>Deactivate IVPN Firewall on disconnect from VPN</label
>
</div>

Expand Down Expand Up @@ -142,20 +142,20 @@ export default {
}
},
firewallOnOffOnConnect: {
firewallActivateOnConnect: {
get() {
return this.$store.state.settings.firewallOnOffOnConnect;
return this.$store.state.settings.firewallActivateOnConnect;
},
set(value) {
this.$store.dispatch("settings/firewallOnOffOnConnect", value);
this.$store.dispatch("settings/firewallActivateOnConnect", value);
}
},
firewallOffOnExit: {
firewallDeactivateOnDisconnect: {
get() {
return this.$store.state.settings.firewallOffOnExit;
return this.$store.state.settings.firewallDeactivateOnDisconnect;
},
set(value) {
this.$store.dispatch("settings/firewallOffOnExit", value);
this.$store.dispatch("settings/firewallDeactivateOnDisconnect", value);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/daemon-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ async function processResponse(response) {
case daemonResponses.DisconnectedResp:
store.dispatch("vpnState/pauseState", PauseStateEnum.Resumed);
store.commit(`vpnState/disconnected`, obj.ReasonDescription);
if (store.state.settings.firewallOnOffOnConnect === true) {
if (store.state.settings.firewallDeactivateOnDisconnect === true) {
await EnableFirewall(false);
}
requestGeoLookupAsync();
Expand Down Expand Up @@ -779,7 +779,7 @@ async function Connect(entryServer, exitServer) {
}
}

if (store.state.settings.firewallOnOffOnConnect === true) {
if (store.state.settings.firewallActivateOnConnect === true) {
await EnableFirewall(true);
}

Expand Down
20 changes: 10 additions & 10 deletions src/store/module-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const getDefaultState = () => {
ovpnProxyPass: "",

// firewall
firewallOnOffOnConnect: true,
firewallOffOnExit: true,
firewallActivateOnConnect: true,
firewallDeactivateOnDisconnect: true,

// antitracker
isAntitracker: false,
Expand Down Expand Up @@ -225,11 +225,11 @@ export default {
},

// firewall
firewallOnOffOnConnect(state, val) {
state.firewallOnOffOnConnect = val;
firewallActivateOnConnect(state, val) {
state.firewallActivateOnConnect = val;
},
firewallOffOnExit(state, val) {
state.firewallOffOnExit = val;
firewallDeactivateOnDisconnect(state, val) {
state.firewallDeactivateOnDisconnect = val;
},

// antitracker
Expand Down Expand Up @@ -393,11 +393,11 @@ export default {
},

// firewall
firewallOnOffOnConnect(context, val) {
context.commit("firewallOnOffOnConnect", val);
firewallActivateOnConnect(context, val) {
context.commit("firewallActivateOnConnect", val);
},
firewallOffOnExit(context, val) {
context.commit("firewallOffOnExit", val);
firewallDeactivateOnDisconnect(context, val) {
context.commit("firewallDeactivateOnDisconnect", val);
},

// antitracker
Expand Down

0 comments on commit 4522d7e

Please sign in to comment.