pmcf 3.8.18 → 3.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "3.8.18",
3
+ "version": "3.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,5 +1,6 @@
1
1
  import { mkdir } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
+ import { string_attribute_writable, secret_attribute } from "pacc";
3
4
  import { addType } from "../types.mjs";
4
5
  import { writeLines, sectionLines } from "../utils.mjs";
5
6
  import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
@@ -14,17 +15,26 @@ const WLANNetworkInterfaceTypeDefinition = {
14
15
  owners: EthernetNetworkInterfaceTypeDefinition.owners,
15
16
  extends: EthernetNetworkInterfaceTypeDefinition,
16
17
  priority: 0.1,
17
- properties: {}
18
+ properties: {
19
+ ssid: string_attribute_writable,
20
+ psk: { ...secret_attribute, writable: true },
21
+ secretName: string_attribute_writable
22
+ }
18
23
  };
19
24
 
20
25
  export class WLANNetworkInterface extends EthernetNetworkInterface {
21
26
  _ssid;
22
27
  _psk;
28
+ _secretName;
23
29
 
24
30
  static {
25
31
  addType(this);
26
32
  }
27
33
 
34
+ static isCommonName(name) {
35
+ return name.match(/wlan\d+$/);
36
+ }
37
+
28
38
  static get typeDefinition() {
29
39
  return WLANNetworkInterfaceTypeDefinition;
30
40
  }
@@ -33,6 +43,18 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
33
43
  return WLANNetworkInterfaceTypeDefinition.name;
34
44
  }
35
45
 
46
+ set secretName(value) {
47
+ this._secretName = value;
48
+ }
49
+
50
+ get secretName() {
51
+ return (
52
+ this.extendedProperty("_secretName") ??
53
+ this.network?.secretName ??
54
+ `${this.network.name}.password`
55
+ );
56
+ }
57
+
36
58
  set ssid(value) {
37
59
  this._ssid = value;
38
60
  }
@@ -53,7 +75,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
53
75
  await super.systemdDefinitions(packageData);
54
76
  await mkdir(join(packageData.dir, "var/lib/iwd/"), { recursive: true });
55
77
 
56
- const secretName = "iwd-secret";
78
+ const secretName = this.secretName;
57
79
 
58
80
  await writeLines(join(packageData.dir, "/etc/iwd"), "main.conf", [
59
81
  sectionLines("General", {
@@ -63,7 +85,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
63
85
 
64
86
  await writeLines(
65
87
  join(packageData.dir, "usr/lib/systemd/system/iwd.service.d/"),
66
- "mf.conf",
88
+ "pmcf.conf",
67
89
  [
68
90
  sectionLines("Service", {
69
91
  LoadCredentialEncrypted: `${secretName}:/etc/credstore.encrypted/${secretName}`
@@ -22,6 +22,7 @@ export const networkProperties = {
22
22
  },
23
23
  ssid: { ...string_attribute_writable },
24
24
  psk: { ...string_attribute_writable },
25
+ secretName: string_attribute_writable,
25
26
  metric: { ...number_attribute_writable /*default: 1004*/ },
26
27
  mtu: { ...number_attribute_writable, default: 1500 },
27
28
  gateway: { type: "host", collection: false, writable: true },
package/src/network.mjs CHANGED
@@ -79,4 +79,12 @@ export class Network extends Owner {
79
79
  this._bridge = this.owner.addBridge(this, network);
80
80
  network.bridge = this.bridge; // TODO should happen in addBridge
81
81
  }
82
+
83
+ set secretName(value) {
84
+ this._secretName = value;
85
+ }
86
+
87
+ get secretName() {
88
+ return this._secretName ?? `${this.name}.password`;
89
+ }
82
90
  }
@@ -262,6 +262,7 @@ export class EthernetNetworkInterface extends NetworkInterface {
262
262
  get?: Function;
263
263
  env?: string[] | string;
264
264
  };
265
+ secretName: import("pacc").AttributeDefinition;
265
266
  metric: {
266
267
  type: string;
267
268
  isKey: boolean;
@@ -546,6 +547,7 @@ export class EthernetNetworkInterface extends NetworkInterface {
546
547
  get?: Function;
547
548
  env?: string[] | string;
548
549
  };
550
+ secretName: import("pacc").AttributeDefinition;
549
551
  metric: {
550
552
  type: string;
551
553
  isKey: boolean;
@@ -248,6 +248,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
248
248
  get?: Function;
249
249
  env?: string[] | string;
250
250
  };
251
+ secretName: import("pacc").AttributeDefinition;
251
252
  metric: {
252
253
  type: string;
253
254
  isKey: boolean;
@@ -532,6 +533,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
532
533
  get?: Function;
533
534
  env?: string[] | string;
534
535
  };
536
+ secretName: import("pacc").AttributeDefinition;
535
537
  metric: {
536
538
  type: string;
537
539
  isKey: boolean;
@@ -246,6 +246,7 @@ export namespace NetworkInterfaceTypeDefinition {
246
246
  get?: Function;
247
247
  env?: string[] | string;
248
248
  };
249
+ secretName: import("pacc").AttributeDefinition;
249
250
  metric: {
250
251
  type: string;
251
252
  isKey: boolean;
@@ -530,6 +531,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
530
531
  get?: Function;
531
532
  env?: string[] | string;
532
533
  };
534
+ secretName: import("pacc").AttributeDefinition;
533
535
  metric: {
534
536
  type: string;
535
537
  isKey: boolean;
@@ -248,6 +248,7 @@ export class TUNNetworkInterface extends NetworkInterface {
248
248
  get?: Function;
249
249
  env?: string[] | string;
250
250
  };
251
+ secretName: import("pacc").AttributeDefinition;
251
252
  metric: {
252
253
  type: string;
253
254
  isKey: boolean;
@@ -532,6 +533,7 @@ export class TUNNetworkInterface extends NetworkInterface {
532
533
  get?: Function;
533
534
  env?: string[] | string;
534
535
  };
536
+ secretName: import("pacc").AttributeDefinition;
535
537
  metric: {
536
538
  type: string;
537
539
  isKey: boolean;
@@ -248,6 +248,7 @@ export class WireguardNetworkInterface extends SkeletonNetworkInterface {
248
248
  get?: Function;
249
249
  env?: string[] | string;
250
250
  };
251
+ secretName: import("pacc").AttributeDefinition;
251
252
  metric: {
252
253
  type: string;
253
254
  isKey: boolean;
@@ -532,6 +533,7 @@ export class WireguardNetworkInterface extends SkeletonNetworkInterface {
532
533
  get?: Function;
533
534
  env?: string[] | string;
534
535
  };
536
+ secretName: import("pacc").AttributeDefinition;
535
537
  metric: {
536
538
  type: string;
537
539
  isKey: boolean;
@@ -248,6 +248,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
248
248
  get?: Function;
249
249
  env?: string[] | string;
250
250
  };
251
+ secretName: import("pacc").AttributeDefinition;
251
252
  metric: {
252
253
  type: string;
253
254
  isKey: boolean;
@@ -534,6 +535,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
534
535
  get?: Function;
535
536
  env?: string[] | string;
536
537
  };
538
+ secretName: import("pacc").AttributeDefinition;
537
539
  metric: {
538
540
  type: string;
539
541
  isKey: boolean;
@@ -818,6 +820,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
818
820
  get?: Function;
819
821
  env?: string[] | string;
820
822
  };
823
+ secretName: import("pacc").AttributeDefinition;
821
824
  metric: {
822
825
  type: string;
823
826
  isKey: boolean;
@@ -864,10 +867,30 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
864
867
  };
865
868
  };
866
869
  priority: number;
867
- properties: {};
870
+ properties: {
871
+ ssid: import("pacc").AttributeDefinition;
872
+ psk: {
873
+ writable: boolean;
874
+ type: string;
875
+ isKey: boolean;
876
+ mandatory: boolean;
877
+ collection: boolean;
878
+ private?: boolean;
879
+ depends?: string;
880
+ description?: string;
881
+ default?: any;
882
+ set?: Function;
883
+ get?: Function;
884
+ env?: string[] | string;
885
+ };
886
+ secretName: import("pacc").AttributeDefinition;
887
+ };
868
888
  };
869
889
  _ssid: any;
870
890
  _psk: any;
891
+ _secretName: any;
892
+ set secretName(value: any);
893
+ get secretName(): any;
871
894
  set ssid(value: any);
872
895
  get ssid(): any;
873
896
  set psk(value: any);
@@ -73,6 +73,7 @@ export namespace networkProperties {
73
73
  get?: Function;
74
74
  env?: string[] | string;
75
75
  };
76
+ export { string_attribute_writable as secretName };
76
77
  export let metric: {
77
78
  type: string;
78
79
  isKey: boolean;
@@ -180,4 +181,5 @@ export namespace networkAddressProperties {
180
181
  env?: string[] | string;
181
182
  };
182
183
  }
184
+ import { string_attribute_writable } from "pacc";
183
185
  import { boolean_attribute_writable } from "pacc";
@@ -329,6 +329,7 @@ export class Network extends Owner {
329
329
  get?: Function;
330
330
  env?: string[] | string;
331
331
  };
332
+ secretName: import("pacc").AttributeDefinition;
332
333
  metric: {
333
334
  type: string;
334
335
  isKey: boolean;
@@ -369,5 +370,8 @@ export class Network extends Owner {
369
370
  get address(): any;
370
371
  set bridge(network: any);
371
372
  get bridge(): any;
373
+ set secretName(value: any);
374
+ get secretName(): any;
375
+ _secretName: any;
372
376
  }
373
377
  import { Owner } from "./owner.mjs";