@highstate/library 0.21.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/highstate.library.msgpack +0 -0
- package/dist/index.js +3934 -1838
- package/package.json +3 -3
- package/src/abbreviations.ts +2 -0
- package/src/apps/index.ts +1 -0
- package/src/apps/vault.ts +374 -0
- package/src/common/access-point.ts +152 -9
- package/src/common/filter.ts +40 -0
- package/src/common/index.ts +1 -0
- package/src/common/server.ts +131 -1
- package/src/databases/etcd.ts +12 -4
- package/src/databases/index.ts +1 -0
- package/src/databases/minio.ts +19 -0
- package/src/databases/mongodb.ts +12 -4
- package/src/databases/mysql.ts +12 -4
- package/src/databases/postgresql.ts +12 -4
- package/src/databases/rustfs.ts +169 -0
- package/src/dns.ts +3 -3
- package/src/index.ts +3 -2
- package/src/k3s.ts +129 -3
- package/src/k8s/apps/envoy-gateway.ts +50 -0
- package/src/k8s/apps/etcd.ts +1 -1
- package/src/k8s/apps/grafana.ts +1 -1
- package/src/k8s/apps/index.ts +4 -0
- package/src/k8s/apps/mariadb.ts +1 -1
- package/src/k8s/apps/matrix-stack.ts +2 -1
- package/src/k8s/apps/minio.ts +2 -2
- package/src/k8s/apps/mongodb.ts +1 -1
- package/src/k8s/apps/postgresql.ts +1 -1
- package/src/k8s/apps/rustfs.ts +119 -0
- package/src/k8s/apps/shared.ts +16 -1
- package/src/k8s/apps/signoz.ts +32 -0
- package/src/k8s/apps/traefik.ts +5 -5
- package/src/k8s/apps/valkey.ts +1 -1
- package/src/k8s/apps/vault.ts +113 -0
- package/src/k8s/apps/vaultwarden.ts +31 -2
- package/src/k8s/apps/workload.ts +12 -14
- package/src/k8s/cert-manager.ts +44 -2
- package/src/k8s/cilium.ts +3 -16
- package/src/k8s/coredns.ts +62 -0
- package/src/k8s/gateway.ts +25 -0
- package/src/k8s/index.ts +1 -0
- package/src/k8s/scheduling.ts +87 -0
- package/src/k8s/service-args.ts +109 -0
- package/src/k8s/shared.ts +26 -0
- package/src/k8s/workload.ts +21 -0
- package/src/netaminity.ts +950 -0
- package/src/network/endpoint.ts +12 -1
- package/src/network/index.ts +1 -0
- package/src/network/network.ts +58 -0
- package/src/restic.ts +2 -1
- package/src/ssh.ts +27 -0
- package/src/third-party/gcp.ts +427 -0
- package/src/third-party/index.ts +1 -0
- package/src/third-party/yandex.ts +210 -1
- package/src/tls.ts +135 -6
- package/src/utils.ts +16 -1
- package/src/wireguard.ts +257 -4
package/src/wireguard.ts
CHANGED
|
@@ -80,7 +80,7 @@ export const networkArgs = {
|
|
|
80
80
|
/**
|
|
81
81
|
* The extra parameters for the amneziawg backend.
|
|
82
82
|
*/
|
|
83
|
-
amnezia: amneziaParametersSchema.
|
|
83
|
+
amnezia: amneziaParametersSchema.default({}),
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
const configSharedArgs = $args({
|
|
@@ -121,6 +121,14 @@ export const networkEntity = defineEntity({
|
|
|
121
121
|
})
|
|
122
122
|
|
|
123
123
|
export const nodeExposePolicySchema = z.enum(["always", "when-has-endpoint", "never"])
|
|
124
|
+
export const feedDaemonSyncModeSchema = z.enum(["sse", "polling"])
|
|
125
|
+
export const feedDaemonBackendTypeSchema = z.enum([
|
|
126
|
+
"wg-quick",
|
|
127
|
+
"networkmanager",
|
|
128
|
+
"netns",
|
|
129
|
+
"windows",
|
|
130
|
+
"windows-manager",
|
|
131
|
+
])
|
|
124
132
|
|
|
125
133
|
export const feedDisplayInfoSchema = z.object({
|
|
126
134
|
/**
|
|
@@ -171,6 +179,11 @@ export const feedMetadataSchema = z.object({
|
|
|
171
179
|
* The display information of the tunnel.
|
|
172
180
|
*/
|
|
173
181
|
displayInfo: feedDisplayInfoSchema,
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The warning message to display for the tunnel.
|
|
185
|
+
*/
|
|
186
|
+
warningMessage: z.string().optional(),
|
|
174
187
|
})
|
|
175
188
|
|
|
176
189
|
export const peerEntity = defineEntity({
|
|
@@ -330,6 +343,19 @@ export const configEntity = defineEntity({
|
|
|
330
343
|
* The file containing the wg-quick configuration.
|
|
331
344
|
*/
|
|
332
345
|
file: fileEntity,
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The identity for which the config is generated.
|
|
349
|
+
*/
|
|
350
|
+
identity: identityEntity,
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* The peers included in the config.
|
|
354
|
+
*/
|
|
355
|
+
peers: {
|
|
356
|
+
entity: peerEntity,
|
|
357
|
+
multiple: true,
|
|
358
|
+
},
|
|
333
359
|
},
|
|
334
360
|
|
|
335
361
|
schema: z.object({
|
|
@@ -354,6 +380,8 @@ export type Network = EntityValue<typeof networkEntity>
|
|
|
354
380
|
export type Identity = EntityValue<typeof identityEntity>
|
|
355
381
|
export type Peer = EntityValue<typeof peerEntity>
|
|
356
382
|
export type NodeExposePolicy = z.infer<typeof nodeExposePolicySchema>
|
|
383
|
+
export type FeedDaemonSyncMode = z.infer<typeof feedDaemonSyncModeSchema>
|
|
384
|
+
export type FeedDaemonBackendType = z.infer<typeof feedDaemonBackendTypeSchema>
|
|
357
385
|
export type Config = EntityValue<typeof configEntity>
|
|
358
386
|
|
|
359
387
|
export type NetworkInput = EntityInput<typeof networkEntity>
|
|
@@ -364,6 +392,40 @@ export type ConfigInput = EntityInput<typeof configEntity>
|
|
|
364
392
|
export type FeedDisplayInfo = z.infer<typeof feedDisplayInfoSchema>
|
|
365
393
|
export type FeedMetadata = z.infer<typeof feedMetadataSchema>
|
|
366
394
|
|
|
395
|
+
const feedDaemonArgs = $args({
|
|
396
|
+
/**
|
|
397
|
+
* The label of the feed in the wg-feed daemon config.
|
|
398
|
+
*/
|
|
399
|
+
feedName: genericNameSchema.default("main"),
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The label of the backend in the wg-feed daemon config.
|
|
403
|
+
*/
|
|
404
|
+
backendName: genericNameSchema.default("default"),
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The backend type used by the wg-feed daemon.
|
|
408
|
+
*/
|
|
409
|
+
backendType: feedDaemonBackendTypeSchema.default("wg-quick"),
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* The sync mode used by the wg-feed daemon.
|
|
413
|
+
*/
|
|
414
|
+
syncMode: feedDaemonSyncModeSchema.default("sse"),
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* The polling interval in seconds.
|
|
418
|
+
*
|
|
419
|
+
* If set to 0, wg-feed daemon uses the server-provided TTL.
|
|
420
|
+
*/
|
|
421
|
+
pollingInterval: z.number().int().nonnegative().default(0),
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* The state file path used by the wg-feed daemon.
|
|
425
|
+
*/
|
|
426
|
+
statePath: z.string().default("/var/lib/wg-feed/state.json"),
|
|
427
|
+
})
|
|
428
|
+
|
|
367
429
|
/**
|
|
368
430
|
* Holds the shared configuration for WireGuard identities, peers, and nodes.
|
|
369
431
|
*/
|
|
@@ -403,7 +465,14 @@ const sharedFeedArgs = $args({
|
|
|
403
465
|
*/
|
|
404
466
|
provided: z.literal("yes"),
|
|
405
467
|
|
|
406
|
-
...pick(feedMetadataSchema.shape, [
|
|
468
|
+
...pick(feedMetadataSchema.shape, [
|
|
469
|
+
"id",
|
|
470
|
+
"name",
|
|
471
|
+
"enabled",
|
|
472
|
+
"forced",
|
|
473
|
+
"exclusive",
|
|
474
|
+
"warningMessage",
|
|
475
|
+
]),
|
|
407
476
|
|
|
408
477
|
// Highstate does not support nested objects in UI
|
|
409
478
|
...feedDisplayInfoSchema.shape,
|
|
@@ -744,7 +813,16 @@ export const nodeK8s = defineUnit({
|
|
|
744
813
|
},
|
|
745
814
|
|
|
746
815
|
inputs: {
|
|
747
|
-
identity:
|
|
816
|
+
identity: {
|
|
817
|
+
entity: identityEntity,
|
|
818
|
+
required: false,
|
|
819
|
+
},
|
|
820
|
+
|
|
821
|
+
config: {
|
|
822
|
+
entity: configEntity,
|
|
823
|
+
required: false,
|
|
824
|
+
},
|
|
825
|
+
|
|
748
826
|
k8sCluster: clusterEntity,
|
|
749
827
|
|
|
750
828
|
workload: {
|
|
@@ -831,6 +909,11 @@ export const nodeFeedK8s = defineUnit({
|
|
|
831
909
|
*/
|
|
832
910
|
listenPort: z.number().default(51820),
|
|
833
911
|
|
|
912
|
+
/**
|
|
913
|
+
* The NodePort to assign when the node is exposed.
|
|
914
|
+
*/
|
|
915
|
+
nodePort: z.number().int().min(30000).max(32767).optional(),
|
|
916
|
+
|
|
834
917
|
/**
|
|
835
918
|
* The name of the WireGuard interface to export as `interface` output.
|
|
836
919
|
*
|
|
@@ -839,6 +922,13 @@ export const nodeFeedK8s = defineUnit({
|
|
|
839
922
|
*/
|
|
840
923
|
interfaceName: z.string().default("wg0"),
|
|
841
924
|
|
|
925
|
+
...feedDaemonArgs,
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* The wg-feed tunnel IDs to force-enable in the daemon config.
|
|
929
|
+
*/
|
|
930
|
+
enabledTunnels: z.string().array().default([]),
|
|
931
|
+
|
|
842
932
|
/**
|
|
843
933
|
* List of CIDR blocks that should be blocked from forwarding through this WireGuard node.
|
|
844
934
|
*
|
|
@@ -919,6 +1009,114 @@ export const nodeFeedK8s = defineUnit({
|
|
|
919
1009
|
},
|
|
920
1010
|
})
|
|
921
1011
|
|
|
1012
|
+
/**
|
|
1013
|
+
* The wg-feed daemon deployed on a server using a systemd service.
|
|
1014
|
+
*/
|
|
1015
|
+
export const nodeFeed = defineUnit({
|
|
1016
|
+
type: "wireguard.node.feed.v1",
|
|
1017
|
+
|
|
1018
|
+
args: {
|
|
1019
|
+
/**
|
|
1020
|
+
* The name of the wg-feed daemon systemd service.
|
|
1021
|
+
*
|
|
1022
|
+
* By default, the name is `wg-feed-${unitName}`.
|
|
1023
|
+
*/
|
|
1024
|
+
serviceName: z.string().optional(),
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* The UDP port that will be exposed by the output peer.
|
|
1028
|
+
*/
|
|
1029
|
+
listenPort: z.number().default(51820),
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* The name of the WireGuard interface to use for lockdown rules.
|
|
1033
|
+
*
|
|
1034
|
+
* Note: wg-feed may manage multiple tunnels.
|
|
1035
|
+
*/
|
|
1036
|
+
interfaceName: z.string().default("wg0"),
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* The path where the wg-feed daemon binary should be installed.
|
|
1040
|
+
*/
|
|
1041
|
+
daemonPath: z.string().default("/usr/local/bin/wg-feed-daemon"),
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* The path where the wg-feed daemon config should be written.
|
|
1045
|
+
*/
|
|
1046
|
+
configPath: z.string().default("/etc/wg-feed/config.yaml"),
|
|
1047
|
+
|
|
1048
|
+
...feedDaemonArgs,
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* The wg-feed tunnel IDs to force-enable in the daemon config.
|
|
1052
|
+
*/
|
|
1053
|
+
enabledTunnels: z.string().array().default([]),
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* List of CIDR blocks that should be blocked from forwarding through this WireGuard node.
|
|
1057
|
+
*
|
|
1058
|
+
* This prevents other peers from reaching these destination CIDRs while still allowing
|
|
1059
|
+
* the peers in those CIDRs to access the internet and other allowed endpoints.
|
|
1060
|
+
*/
|
|
1061
|
+
forwardRestrictedSubnets: z.string().array().default([]),
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Whether to drop all traffic from the interface using ip rule with priority 100.
|
|
1065
|
+
*
|
|
1066
|
+
* This is useful for preventing traffic leaks before another routing rule is installed.
|
|
1067
|
+
*/
|
|
1068
|
+
lockdownUpstream: z.boolean().default(false),
|
|
1069
|
+
},
|
|
1070
|
+
|
|
1071
|
+
secrets: {
|
|
1072
|
+
/**
|
|
1073
|
+
* The wg-feed setup URLs to configure on the daemon.
|
|
1074
|
+
*
|
|
1075
|
+
* This is useful for URLs that include secret fragments such as age keys.
|
|
1076
|
+
*/
|
|
1077
|
+
endpoints: z.string().array().default([]),
|
|
1078
|
+
},
|
|
1079
|
+
|
|
1080
|
+
inputs: {
|
|
1081
|
+
server: {
|
|
1082
|
+
entity: serverEntity,
|
|
1083
|
+
required: true,
|
|
1084
|
+
},
|
|
1085
|
+
|
|
1086
|
+
endpoints: {
|
|
1087
|
+
entity: l7EndpointEntity,
|
|
1088
|
+
multiple: true,
|
|
1089
|
+
required: false,
|
|
1090
|
+
},
|
|
1091
|
+
|
|
1092
|
+
peer: {
|
|
1093
|
+
entity: peerEntity,
|
|
1094
|
+
required: false,
|
|
1095
|
+
},
|
|
1096
|
+
},
|
|
1097
|
+
|
|
1098
|
+
outputs: {
|
|
1099
|
+
peer: {
|
|
1100
|
+
entity: peerEntity,
|
|
1101
|
+
required: false,
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
|
|
1105
|
+
meta: {
|
|
1106
|
+
title: "WireGuard Feed Server Node",
|
|
1107
|
+
description: "The wg-feed daemon deployed on a server.",
|
|
1108
|
+
icon: "simple-icons:wireguard",
|
|
1109
|
+
iconColor: "#88171a",
|
|
1110
|
+
secondaryIcon: "mdi:server",
|
|
1111
|
+
category: "VPN",
|
|
1112
|
+
},
|
|
1113
|
+
|
|
1114
|
+
source: {
|
|
1115
|
+
package: "@highstate/wireguard",
|
|
1116
|
+
path: "node.feed",
|
|
1117
|
+
},
|
|
1118
|
+
})
|
|
1119
|
+
|
|
922
1120
|
/**
|
|
923
1121
|
* The WireGuard node deployed on a server using wg-quick systemd service.
|
|
924
1122
|
*/
|
|
@@ -974,7 +1172,16 @@ export const node = defineUnit({
|
|
|
974
1172
|
},
|
|
975
1173
|
|
|
976
1174
|
inputs: {
|
|
977
|
-
identity:
|
|
1175
|
+
identity: {
|
|
1176
|
+
entity: identityEntity,
|
|
1177
|
+
required: false,
|
|
1178
|
+
},
|
|
1179
|
+
|
|
1180
|
+
config: {
|
|
1181
|
+
entity: configEntity,
|
|
1182
|
+
required: false,
|
|
1183
|
+
},
|
|
1184
|
+
|
|
978
1185
|
server: {
|
|
979
1186
|
entity: serverEntity,
|
|
980
1187
|
required: true,
|
|
@@ -1050,6 +1257,43 @@ export const config = defineUnit({
|
|
|
1050
1257
|
},
|
|
1051
1258
|
})
|
|
1052
1259
|
|
|
1260
|
+
/**
|
|
1261
|
+
* Parses an existing WireGuard configuration into config, identity, network, and peer entities.
|
|
1262
|
+
*/
|
|
1263
|
+
export const existingConfig = defineUnit({
|
|
1264
|
+
type: "wireguard.existing-config.v1",
|
|
1265
|
+
|
|
1266
|
+
args: {
|
|
1267
|
+
/**
|
|
1268
|
+
* The existing wg-quick or awg-quick configuration content.
|
|
1269
|
+
*/
|
|
1270
|
+
config: z.string().meta({ language: "ini" }),
|
|
1271
|
+
},
|
|
1272
|
+
|
|
1273
|
+
outputs: {
|
|
1274
|
+
config: configEntity,
|
|
1275
|
+
identity: identityEntity,
|
|
1276
|
+
network: networkEntity,
|
|
1277
|
+
peers: {
|
|
1278
|
+
entity: peerEntity,
|
|
1279
|
+
multiple: true,
|
|
1280
|
+
},
|
|
1281
|
+
},
|
|
1282
|
+
|
|
1283
|
+
meta: {
|
|
1284
|
+
title: "Existing WireGuard Config",
|
|
1285
|
+
icon: "simple-icons:wireguard",
|
|
1286
|
+
iconColor: "#88171a",
|
|
1287
|
+
secondaryIcon: "mdi:file-import",
|
|
1288
|
+
category: "VPN",
|
|
1289
|
+
},
|
|
1290
|
+
|
|
1291
|
+
source: {
|
|
1292
|
+
package: "@highstate/wireguard",
|
|
1293
|
+
path: "existing-config",
|
|
1294
|
+
},
|
|
1295
|
+
})
|
|
1296
|
+
|
|
1053
1297
|
/**
|
|
1054
1298
|
* The WireGuard configuration bundle for the identity and peers.
|
|
1055
1299
|
*/
|
|
@@ -1071,6 +1315,10 @@ export const configBundle = defineUnit({
|
|
|
1071
1315
|
multiple: true,
|
|
1072
1316
|
required: false,
|
|
1073
1317
|
},
|
|
1318
|
+
network: {
|
|
1319
|
+
entity: networkEntity,
|
|
1320
|
+
required: false,
|
|
1321
|
+
},
|
|
1074
1322
|
},
|
|
1075
1323
|
|
|
1076
1324
|
outputs: {
|
|
@@ -1129,6 +1377,11 @@ export const feed = defineUnit({
|
|
|
1129
1377
|
* The display information of the feed.
|
|
1130
1378
|
*/
|
|
1131
1379
|
displayInfo: feedDisplayInfoSchema,
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* The warning message to display for the feed.
|
|
1383
|
+
*/
|
|
1384
|
+
warningMessage: z.string().optional(),
|
|
1132
1385
|
},
|
|
1133
1386
|
|
|
1134
1387
|
secrets: {
|