Skip to content

Commit d576311

Browse files
committed
logging/givc: enable nvidia logging with cross-aware GIVC pin
Enable GIVC and logging wiring for Orin targets, remove temporary host TLS guard logic, and pin ghaf-givc to the cross-aware branch revision used for x86_64 -> aarch64 flash builds. Also drop redundant Jetson logging endpoint override now provided by global defaults. Signed-off-by: vadik likholetov <vadikas@gmail.com>
1 parent 0968408 commit d576311

File tree

13 files changed

+74
-20
lines changed

13 files changed

+74
-20
lines changed

flake.lock

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
# Ghaf Inter VM communication and control library
107107
givc = {
108-
url = "github:tiiuae/ghaf-givc";
108+
url = "github:vadika/ghaf-givc/vadika/cross-givc-packages";
109109
inputs = {
110110
nixpkgs.follows = "nixpkgs";
111111
flake-parts.follows = "flake-parts";

lib/builders/mkGhafConfiguration.nix

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,15 @@ let
108108
# 1. ghaf.profiles.{debug,release}.enable for host-side module activation
109109
# 2. ghaf.global-config to the corresponding profile for VM-side config propagation
110110
#
111-
# Note: global-config uses mkDefault so that platform-specific profiles (like orin.nix)
112-
# can override specific values. For example, orin.nix sets ghaf.givc.enable = false
113-
# and this should propagate to VMs via ghaf.global-config.givc.enable.
111+
# Note: global-config uses mkDefault so target modules can still override specific
112+
# values when needed.
113+
114114
variantModule = {
115115
ghaf.profiles = {
116116
debug.enable = variant == "debug";
117117
release.enable = variant == "release";
118118
};
119119
# Set global-config to match the variant's profile using mkDefault
120-
# This allows profile modules to override specific global-config values
121-
# Example: orin.nix can set ghaf.global-config.givc.enable = false
122120
ghaf.global-config = lib.mapAttrsRecursive (_: v: lib.mkDefault v) (
123121
lib.ghaf.profiles.${variant} or lib.ghaf.profiles.minimal
124122
);

lib/global-config.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ rec {
5252
description = "Logging listener address";
5353
};
5454

55+
serverName = mkOption {
56+
type = types.nullOr types.str;
57+
default = null;
58+
description = "Optional TLS server name for validating the admin-vm logging listener certificate";
59+
};
60+
5561
port = mkOption {
5662
type = types.port;
5763
default = 9999;

modules/common/global-config.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
logging.listener.address = lib.mkIf (
4848
config.ghaf.global-config.logging.enable && config.ghaf.common.adminHost != null
4949
) (lib.mkDefault config.ghaf.networking.hosts.admin-vm.ipv4);
50+
# Auto-populate logging TLS server_name for producer-side certificate validation.
51+
logging.listener.serverName = lib.mkIf (
52+
config.ghaf.global-config.logging.enable && config.ghaf.common.adminHost != null
53+
) (lib.mkDefault "admin-vm");
5054
};
5155
};
5256
}

modules/common/logging/client.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let
1111
mkEnableOption
1212
mkOption
1313
types
14+
hasPrefix
1415
optionalString
1516
;
1617
cfg = config.ghaf.logging.client;
@@ -58,6 +59,11 @@ in
5859
default = "TLS12";
5960
description = "Minimum TLS version for the outbound connection.";
6061
};
62+
serverName = mkOption {
63+
type = types.nullOr types.str;
64+
default = if listener.serverName != null then listener.serverName else "admin-vm";
65+
description = "Expected TLS server_name (SNI) for validating the admin-vm listener certificate.";
66+
};
6167
};
6268
};
6369

@@ -121,6 +127,7 @@ in
121127
cert_file = sys.env("CREDENTIALS_DIRECTORY") + "/client_cert"
122128
key_file = sys.env("CREDENTIALS_DIRECTORY") + "/client_key"
123129
min_version = "${cfg.tls.minVersion}"
130+
${optionalString (cfg.tls.serverName != null) ''server_name = "${cfg.tls.serverName}"''}
124131
}
125132
}
126133
}
@@ -131,6 +138,18 @@ in
131138

132139
services.alloy.enable = true;
133140

141+
systemd.services.alloy.unitConfig.RequiresMountsFor = lib.unique (
142+
lib.optionals (cfg.tls.certFile != null && hasPrefix "/etc/givc/" (toString cfg.tls.certFile)) [
143+
(dirOf (toString cfg.tls.certFile))
144+
]
145+
++ lib.optionals (cfg.tls.keyFile != null && hasPrefix "/etc/givc/" (toString cfg.tls.keyFile)) [
146+
(dirOf (toString cfg.tls.keyFile))
147+
]
148+
++ lib.optionals (cfg.tls.caFile != null && hasPrefix "/etc/givc/" (toString cfg.tls.caFile)) [
149+
(dirOf (toString cfg.tls.caFile))
150+
]
151+
);
152+
134153
systemd.services.alloy.serviceConfig = {
135154
after = [
136155
"systemd-journald.service"

modules/common/logging/common.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ in
102102
default = 9999;
103103
};
104104

105+
listener.serverName = mkOption {
106+
description = ''
107+
Optional TLS server name used by log producers when
108+
verifying the admin-vm listener certificate.
109+
'';
110+
type = types.nullOr types.str;
111+
default = null;
112+
};
113+
105114
journalRetention = {
106115
enable = mkOption {
107116
description = ''

modules/common/logging/fss.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ in
453453
after = [ "systemd-journald.service" ];
454454
wants = [ "systemd-journald.service" ];
455455

456+
unitConfig = {
457+
RequiresMountsFor = [
458+
cfg.keyPath
459+
"/var/log/journal"
460+
"/run/log/journal"
461+
];
462+
};
463+
456464
serviceConfig = {
457465
Type = "oneshot";
458466
RemainAfterExit = true;
@@ -477,6 +485,11 @@ in
477485
unitConfig = {
478486
# Only run if FSS setup has completed successfully
479487
ConditionPathExists = "${cfg.keyPath}/initialized";
488+
RequiresMountsFor = [
489+
cfg.keyPath
490+
"/var/log/journal"
491+
"/run/log/journal"
492+
];
480493
};
481494

482495
serviceConfig = {

modules/common/security/audit/default.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ in
114114

115115
# Let systemd use default ordering for audit-rules instead of early-boot
116116
unitConfig.DefaultDependencies = lib.mkForce true;
117+
unitConfig.RequiresMountsFor = [
118+
"/etc/givc"
119+
"/etc/common/journal-fss"
120+
"/var/log/journal"
121+
];
117122
before = lib.mkForce [ ];
118123
};
119124

modules/givc/host.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ let
1515
optionalString
1616
optionals
1717
;
18+
tlsStoragePath = "/persist/storagevm/givc";
1819
in
1920
{
2021
_file = ./host.nix;
@@ -80,7 +81,7 @@ in
8081
addr = v.ipv4;
8182
}) config.ghaf.networking.hosts;
8283
generatorHostName = config.networking.hostName;
83-
storagePath = "/persist/storagevm/givc";
84+
storagePath = tlsStoragePath;
8485
};
8586

8687
ghaf.security.audit.extraRules = [

0 commit comments

Comments
 (0)