Skip to content

Commit e575edd

Browse files
committed
Remove IP auth
1 parent db053f8 commit e575edd

13 files changed

Lines changed: 7 additions & 241 deletions

File tree

build/src/src/api/routes.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ export interface Routes {
4949
*/
5050
resetDevice: (kwargs: { id: string }) => Promise<void>;
5151

52-
/**
53-
* Gives/removes admin rights to the provided device id.
54-
* @param id Device id name
55-
*/
56-
toggleAdmin: (kwargs: { id: string }) => Promise<void>;
57-
5852
/**
5953
* Returns a list of the existing devices, with the admin property
6054
*/
@@ -69,7 +63,6 @@ export const routesData: { [P in keyof Routes]: {} } = {
6963
getStatus: {},
7064
removeDevice: {},
7165
resetDevice: {},
72-
toggleAdmin: {},
7366
listDevices: {}
7467
};
7568

build/src/src/calls/getMasterAdminCred.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { addDevice } from "./addDevice";
2-
import { toggleAdmin } from "./toggleAdmin";
32
import { MAIN_ADMIN_NAME } from "../params";
43
import { logs } from "../logs";
54
import { getDeviceCredentials } from "./getDeviceCredentials";
@@ -19,7 +18,6 @@ export async function getMasterAdminCred(): Promise<VpnDeviceCredentials> {
1918
logs.info(`User ${MAIN_ADMIN_NAME} already exists`);
2019
} else {
2120
await addDevice({ id: MAIN_ADMIN_NAME });
22-
await toggleAdmin({ id: MAIN_ADMIN_NAME });
2321
}
2422
} catch (e) {
2523
if (!e.message.includes("exist"))

build/src/src/calls/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ export * from "./getVersionData";
77
export * from "./listDevices";
88
export * from "./removeDevice";
99
export * from "./resetDevice";
10-
export * from "./toggleAdmin";

build/src/src/calls/listDevices.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
import { getUserList, getCCD } from "../openvpn";
2-
import { VpnDevice, OpenVpnCCDItem } from "../types";
1+
import { getUserList } from "../openvpn";
2+
import { VpnDevice } from "../types";
33

44
/**
55
* Returns a list of the existing devices, with the admin property
66
*/
77
export async function listDevices(): Promise<VpnDevice[]> {
88
const userList = await getUserList();
9-
const ccd = getCCD();
10-
11-
const ccdById = ccd.reduce(
12-
(byId, device) => {
13-
return { ...byId, [device.cn]: device };
14-
},
15-
{} as { [id: string]: OpenVpnCCDItem }
16-
);
179

1810
return userList.map(user => ({
19-
id: user,
20-
admin: Boolean(ccdById[user]),
21-
ip: (ccdById[user] || {}).ip || ""
11+
id: user
2212
}));
2313
}

build/src/src/calls/removeDevice.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getUserList, getCCD, removeClient } from "../openvpn";
1+
import { getUserList, removeClient } from "../openvpn";
22
import { MAIN_ADMIN_NAME } from "../params";
33

44
/**
@@ -7,10 +7,6 @@ import { MAIN_ADMIN_NAME } from "../params";
77
*/
88
export async function removeDevice({ id }: { id: string }): Promise<void> {
99
const deviceArray = await getUserList();
10-
const ccdArray = getCCD();
11-
12-
if (ccdArray.find(c => c.cn === id))
13-
throw Error("You cannot remove an admin user");
1410

1511
if (id === MAIN_ADMIN_NAME) {
1612
throw Error("Cannot remove the main admin user");

build/src/src/calls/toggleAdmin.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

build/src/src/openvpn/admin.ts

Lines changed: 0 additions & 46 deletions
This file was deleted.

build/src/src/openvpn/getCCD.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

build/src/src/openvpn/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
export * from "./admin";
21
export * from "./buildClient";
3-
export * from "./getCCD";
42
export * from "./getClient";
53
export * from "./getUserList";
64
export * from "./openvpnBinary";

build/src/src/params.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const dappmanagerApiUrlGlobalEnvs = `${dappmanagerApiUrl}/global-envs`;
66

77
// OpenVPN parameters
88
export const USER_LIMIT = 500;
9-
export const CCD_MASK = "255.255.252.0";
109
export const MAIN_ADMIN_NAME = "dappnode_admin";
1110
export const MASTER_ADMIN_IP = "172.33.10.1";
1211
export const ADMIN_IP_RANGE = ["172.33.10.2", "172.33.11.250"];
@@ -17,7 +16,6 @@ export const OPENVPN = "/etc/openvpn";
1716
export const OPENVPN_CCD_DIR = path.join(OPENVPN, "ccd");
1817
export const PKI_PATH = path.join(OPENVPN, "/pki/reqs");
1918
export const PROXY_ARP_PATH = "/proc/sys/net/ipv4/conf/eth0/proxy_arp";
20-
export const CCD_PATH = "/etc/openvpn/ccd";
2119
export const OPENVPN_CRED_DIR = "/usr/www/openvpn/cred";
2220

2321
// API params

0 commit comments

Comments
 (0)