summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-11-03 00:19:05 +0100
committerOskar Nyberg <oskar@mullvad.net>2022-03-14 13:58:44 +0100
commitb43833503ba221d775e2f6196ad6e0dec0929756 (patch)
treede0c68c2b049a0ea3f659aa73f10869ebd7e8230 /gui/src/main
parent6459ae7beefcc5f13eb54254dfe402dd807c62fe (diff)
downloadmullvadvpn-b43833503ba221d775e2f6196ad6e0dec0929756.tar.xz
mullvadvpn-b43833503ba221d775e2f6196ad6e0dec0929756.zip
Remove everything related to WireGuard key handling
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/daemon-rpc.ts47
-rw-r--r--gui/src/main/index.ts83
2 files changed, 0 insertions, 130 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 6638799e2f..6f11a36100 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -36,8 +36,6 @@ import {
TunnelType,
IProxyEndpoint,
ProxyType,
- KeygenEvent,
- IWireguardPublicKey,
ISettings,
ConnectionConfig,
DaemonEvent,
@@ -438,19 +436,6 @@ export class DaemonRpc {
return response.getValue();
}
- public async generateWireguardKey(): Promise<KeygenEvent> {
- const response = await this.callEmpty<grpcTypes.KeygenEvent>(this.client.generateWireguardKey);
- return convertFromKeygenEvent(response);
- }
-
- public async getWireguardKey(): Promise<IWireguardPublicKey> {
- const response = await this.callEmpty<grpcTypes.PublicKey>(this.client.getWireguardKey);
- return {
- created: response.getCreated()!.toDate().toISOString(),
- key: convertFromWireguardKey(response.getKey()),
- };
- }
-
public async setDnsOptions(dns: IDnsOptions): Promise<void> {
const dnsOptions = new grpcTypes.DnsOptions();
@@ -473,11 +458,6 @@ export class DaemonRpc {
await this.call<grpcTypes.DnsOptions, Empty>(this.client.setDnsOptions, dnsOptions);
}
- public async verifyWireguardKey(): Promise<boolean> {
- const response = await this.callEmpty<BoolValue>(this.client.verifyWireguardKey);
- return response.getValue();
- }
-
public async getVersionInfo(): Promise<IAppVersionInfo> {
const response = await this.callEmpty<grpcTypes.AppVersionInfo>(this.client.getVersionInfo);
return response.toObject();
@@ -1123,38 +1103,11 @@ function convertFromDaemonEvent(data: grpcTypes.DaemonEvent): DaemonEvent {
};
}
- const keygenEvent = data.getKeyEvent();
- if (keygenEvent !== undefined) {
- return {
- wireguardKey: convertFromKeygenEvent(keygenEvent),
- };
- }
-
return {
appVersionInfo: data.getVersionInfo()!.toObject(),
};
}
-function convertFromKeygenEvent(data: grpcTypes.KeygenEvent): KeygenEvent {
- switch (data.getEvent()) {
- case grpcTypes.KeygenEvent.KeygenEvent.TOO_MANY_KEYS:
- return 'too_many_keys';
- case grpcTypes.KeygenEvent.KeygenEvent.NEW_KEY: {
- const newKey = data.getNewKey();
- return newKey
- ? {
- newKey: {
- created: newKey.getCreated()!.toDate().toISOString(),
- key: convertFromWireguardKey(newKey.getKey()),
- },
- }
- : 'generation_failure';
- }
- case grpcTypes.KeygenEvent.KeygenEvent.GENERATION_FAILURE:
- return 'generation_failure';
- }
-}
-
function convertFromOpenVpnConstraints(
constraints: grpcTypes.OpenvpnConstraints,
): IOpenVpnConstraints {
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 8cebf9511b..782e6d3982 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -30,8 +30,6 @@ import {
IDnsOptions,
IRelayList,
ISettings,
- IWireguardPublicKey,
- KeygenEvent,
liftConstraint,
RelaySettings,
RelaySettingsUpdate,
@@ -88,8 +86,6 @@ const windowsSplitTunneling = process.platform === 'win32' && require('./windows
const DAEMON_RPC_PATH =
process.platform === 'win32' ? 'unix:////./pipe/Mullvad VPN' : 'unix:///var/run/mullvad-vpn';
-const AUTO_CONNECT_FALLBACK_DELAY = 6000;
-
const GUI_VERSION = app.getVersion().replace('.0', '');
/// Mirrors the beta check regex in the daemon. Matches only well formed beta versions
const IS_BETA = /^(\d{4})\.(\d+)-beta(\d+)$/;
@@ -221,8 +217,6 @@ class ApplicationMain {
// The UI locale which is set once from onReady handler
private locale = 'en';
- private wireguardPublicKey?: IWireguardPublicKey;
-
private accountExpiryNotificationScheduler = new Scheduler();
private accountDataCache = new AccountDataCache(
@@ -240,9 +234,6 @@ class ApplicationMain {
},
);
- private autoConnectOnWireguardKeyEvent = false;
- private autoConnectFallbackScheduler = new Scheduler();
-
private blurNavigationResetScheduler = new Scheduler();
private backgroundThrottleScheduler = new Scheduler();
@@ -722,7 +713,6 @@ class ApplicationMain {
this.daemonEventListener = undefined;
this.tunnelStateFallback = undefined;
- this.autoConnectFallbackScheduler.cancel();
if (wasConnected) {
this.connectedToDaemon = false;
@@ -775,8 +765,6 @@ class ApplicationMain {
this.settings.relaySettings,
this.settings.bridgeState,
);
- } else if ('wireguardKey' in daemonEvent) {
- this.handleWireguardKeygenEvent(daemonEvent.wireguardKey);
} else if ('appVersionInfo' in daemonEvent) {
this.setLatestVersion(daemonEvent.appVersionInfo);
}
@@ -825,37 +813,6 @@ class ApplicationMain {
}
}
- private setWireguardKey(wireguardKey?: IWireguardPublicKey) {
- this.wireguardPublicKey = wireguardKey;
- if (this.windowController) {
- IpcMainEventChannel.wireguardKeys.notifyPublicKey(
- this.windowController.webContents,
- wireguardKey,
- );
- }
-
- if (wireguardKey) {
- this.wireguardKeygenEventAutoConnect();
- }
- }
-
- private handleWireguardKeygenEvent(event: KeygenEvent) {
- switch (event) {
- case 'too_many_keys':
- case 'generation_failure':
- this.wireguardPublicKey = undefined;
- break;
- default:
- this.wireguardPublicKey = event.newKey;
- }
-
- if (this.windowController) {
- IpcMainEventChannel.wireguardKeys.notifyKeygenEvent(this.windowController.webContents, event);
- }
-
- this.wireguardKeygenEventAutoConnect();
- }
-
// This function sets a new tunnel state as an assumed next state and saves the current state as
// fallback. The fallback is used if the assumed next state isn't reached.
private setOptimisticTunnelState(state: 'connecting' | 'disconnecting') {
@@ -929,7 +886,6 @@ class ApplicationMain {
if (oldSettings.accountToken !== newSettings.accountToken) {
void this.updateAccountHistory();
- void this.fetchWireguardKey();
}
if (oldSettings.showBetaReleases !== newSettings.showBetaReleases) {
@@ -1223,7 +1179,6 @@ class ApplicationMain {
currentVersion: this.currentVersion,
upgradeVersion: this.upgradeVersion,
guiSettings: this.guiSettings.state,
- wireguardPublicKey: this.wireguardPublicKey,
translations: this.translations,
windowsSplitTunnelingApplications: this.windowsSplitTunnelingApplications,
macOsScrollbarVisibility: this.macOsScrollbarVisibility,
@@ -1322,15 +1277,6 @@ class ApplicationMain {
void this.updateAccountHistory();
});
- IpcMainEventChannel.wireguardKeys.handleGenerateKey(async () => {
- try {
- return await this.daemonRpc.generateWireguardKey();
- } catch {
- return 'generation_failure';
- }
- });
- IpcMainEventChannel.wireguardKeys.handleVerifyKey(() => this.daemonRpc.verifyWireguardKey());
-
IpcMainEventChannel.linuxSplitTunneling.handleGetApplications(() => {
if (linuxSplitTunneling) {
return linuxSplitTunneling.getApplications(this.locale);
@@ -1490,22 +1436,11 @@ class ApplicationMain {
log.warn(`Failed to get account data, logging in anyway: ${verification.error.message}`);
}
- this.autoConnectOnWireguardKeyEvent = this.guiSettings.autoConnect;
await this.daemonRpc.setAccount(accountToken);
-
- // Fallback if daemon doesn't send event.
- if (this.autoConnectOnWireguardKeyEvent) {
- this.autoConnectFallbackScheduler.schedule(
- () => this.wireguardKeygenEventAutoConnect(),
- AUTO_CONNECT_FALLBACK_DELAY,
- );
- }
} catch (e) {
const error = e as Error;
log.error(`Failed to login: ${error.message}`);
- this.autoConnectOnWireguardKeyEvent = false;
-
if (error instanceof InvalidAccountError) {
throw Error(messages.gettext('Invalid account number'));
} else {
@@ -1514,14 +1449,6 @@ class ApplicationMain {
}
}
- private wireguardKeygenEventAutoConnect() {
- if (this.autoConnectOnWireguardKeyEvent) {
- this.autoConnectOnWireguardKeyEvent = false;
- this.autoConnectFallbackScheduler.cancel();
- void this.autoConnect();
- }
- }
-
private async autoConnect() {
if (process.env.NODE_ENV === 'development') {
log.info('Skip autoconnect in development');
@@ -1550,7 +1477,6 @@ class ApplicationMain {
try {
await this.daemonRpc.setAccount();
- this.autoConnectFallbackScheduler.cancel();
this.accountExpiryNotificationScheduler.cancel();
} catch (e) {
const error = e as Error;
@@ -1641,15 +1567,6 @@ class ApplicationMain {
}
}
- private async fetchWireguardKey(): Promise<void> {
- try {
- this.setWireguardKey(await this.daemonRpc.getWireguardKey());
- } catch (e) {
- const error = e as Error;
- log.error(`Failed to fetch wireguard key: ${error.message}`);
- }
- }
-
private updateDaemonsAutoConnect() {
const daemonAutoConnect = this.guiSettings.autoConnect && getOpenAtLogin();
if (daemonAutoConnect !== this.settings.autoConnect) {