Browse Source
Feat: map client to interface (#1886)
map client to interface
pull/1911/head
Bernd Storath
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with
19 additions and
7 deletions
-
CHANGELOG.md
-
docs/content/advanced/migrate/from-14-to-15.md
-
docs/content/examples/tutorials/basic-installation.md
-
docs/content/getting-started.md
-
src/server/database/repositories/client/schema.ts
-
src/server/database/repositories/client/service.ts
-
src/server/database/repositories/client/types.ts
|
|
@ -27,7 +27,7 @@ As the whole setup has changed, we recommend to start from scratch. And import y |
|
|
|
- SQLite Database |
|
|
|
- Deprecated Dockerless Installations |
|
|
|
- Added Docker Volume Mount (`/lib/modules`) |
|
|
|
- Removed ARMv6 and ARMv7 support |
|
|
|
- Removed ARMv6 support |
|
|
|
- Connections over HTTP require setting the `INSECURE` env var |
|
|
|
- Changed license from CC BY-NC-SA 4.0 to AGPL-3.0-only |
|
|
|
- Added 2FA using TOTP |
|
|
|
|
|
@ -7,7 +7,7 @@ This guide will help you migrate from `v14` to version `v15` of `wg-easy`. |
|
|
|
## Changes |
|
|
|
|
|
|
|
- This is a complete rewrite of the `wg-easy` project. Therefore the configuration files and the way you interact with the project have changed. |
|
|
|
- If you use armv6 or armv7, you can't migrate to `v15` yet. We are working on it. |
|
|
|
- If you use armv6, you unfortunately won't be able to migrate to `v15`. |
|
|
|
- If you are connecting to the web ui via HTTP, you need to set the `INSECURE` environment variable to `true` in the new container. |
|
|
|
|
|
|
|
## Migration |
|
|
@ -42,7 +42,7 @@ docker-compose down |
|
|
|
|
|
|
|
Follow the instructions in the [Getting Started][docs-getting-started] or [Basic Installation][docs-examples] guide to start the new container. |
|
|
|
|
|
|
|
In the setup wizard, select that you already already have a configuration file and upload the `wg0.json` file you downloaded in the backup step. |
|
|
|
In the setup wizard, select that you already have a configuration file and upload the `wg0.json` file you downloaded in the backup step. |
|
|
|
|
|
|
|
[docs-getting-started]: ../../getting-started.md |
|
|
|
[docs-examples]: ../../examples/tutorials/basic-installation.md |
|
|
|
|
|
@ -8,7 +8,7 @@ title: Basic Installation |
|
|
|
|
|
|
|
1. You need to have a host that you can manage |
|
|
|
2. You need to have a domain name or a public IP address |
|
|
|
3. You need a supported architecture (x86_64, arm64) |
|
|
|
3. You need a supported architecture (x86_64, arm64, armv7) |
|
|
|
4. You need curl installed on your host |
|
|
|
|
|
|
|
## Install Docker |
|
|
|
|
|
@ -12,7 +12,7 @@ Before you can get started with deploying your own VPN, there are some requireme |
|
|
|
|
|
|
|
1. You need to have a host that you can manage |
|
|
|
2. You need to have a domain name or a public IP address |
|
|
|
3. You need a supported architecture (x86_64, arm64) |
|
|
|
3. You need a supported architecture (x86_64, arm64, armv7) |
|
|
|
|
|
|
|
### Host Setup |
|
|
|
|
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import { sql, relations } from 'drizzle-orm'; |
|
|
|
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'; |
|
|
|
|
|
|
|
import { oneTimeLink, user } from '../../schema'; |
|
|
|
import { oneTimeLink, user, wgInterface } from '../../schema'; |
|
|
|
|
|
|
|
/** null means use value from userConfig */ |
|
|
|
|
|
|
@ -13,6 +13,12 @@ export const client = sqliteTable('clients_table', { |
|
|
|
onDelete: 'restrict', |
|
|
|
onUpdate: 'cascade', |
|
|
|
}), |
|
|
|
interfaceId: text('interface_id') |
|
|
|
.notNull() |
|
|
|
.references(() => wgInterface.name, { |
|
|
|
onDelete: 'cascade', |
|
|
|
onUpdate: 'cascade', |
|
|
|
}), |
|
|
|
name: text().notNull(), |
|
|
|
ipv4Address: text('ipv4_address').notNull().unique(), |
|
|
|
ipv6Address: text('ipv6_address').notNull().unique(), |
|
|
@ -51,4 +57,8 @@ export const clientsRelations = relations(client, ({ one }) => ({ |
|
|
|
fields: [client.userId], |
|
|
|
references: [user.id], |
|
|
|
}), |
|
|
|
interface: one(wgInterface, { |
|
|
|
fields: [client.interfaceId], |
|
|
|
references: [wgInterface.name], |
|
|
|
}), |
|
|
|
})); |
|
|
|
|
|
@ -108,6 +108,7 @@ export class ClientService { |
|
|
|
name, |
|
|
|
// TODO: properly assign user id
|
|
|
|
userId: 1, |
|
|
|
interfaceId: 'wg0', |
|
|
|
expiresAt, |
|
|
|
privateKey, |
|
|
|
publicKey, |
|
|
@ -171,6 +172,7 @@ export class ClientService { |
|
|
|
.values({ |
|
|
|
name, |
|
|
|
userId: 1, |
|
|
|
interfaceId: 'wg0', |
|
|
|
privateKey, |
|
|
|
publicKey, |
|
|
|
preSharedKey, |
|
|
|
|
|
@ -14,7 +14,7 @@ export type CreateClientType = Omit< |
|
|
|
|
|
|
|
export type UpdateClientType = Omit< |
|
|
|
CreateClientType, |
|
|
|
'privateKey' | 'publicKey' | 'preSharedKey' | 'userId' |
|
|
|
'privateKey' | 'publicKey' | 'preSharedKey' | 'userId' | 'interfaceId' |
|
|
|
>; |
|
|
|
|
|
|
|
const name = z |
|
|
|