Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,41 @@ let
user = { };
# sara = { };
};
# clanServices replacements for the clanModules.* imports that
# modules/shared.nix used to carry (clanModules was removed
# upstream; see #159). state-version is not listed here:
# clanCore enables it by default.
inventory.instances = {
# Runs the OpenSSH server with persistent host keys.
# Root's authorized keys stay in machines/user/configuration.nix.
sshd = {
roles.server.tags.all = { };
# The old sshd module only generated host keys; CA-signed host
# certificates are a new-service extra that would require
# shared openssh-ca vars this repo does not have.
roles.server.settings.certificate.enable = false;
};
# Generates the root password (was clanModules.root-password).
user-root = {
module.name = "users";
roles.default.tags.all = { };
roles.default.settings.user = "root";
};
# Zerotier network (was clan.core.networking.zerotier.controller
# in machines/user/configuration.nix; the direct option was
# removed upstream). This machine is the controller and a peer.
zerotier = {
module.name = "zerotier";
roles.controller.machines.user = { };
roles.peer.machines.user = { };
};
# Generates the "user" password (was clanModules.user-password).
user-user = {
module.name = "users";
roles.default.tags.all = { };
roles.default.settings.user = "user";
};
};
};
in
{
Expand Down Expand Up @@ -608,7 +643,12 @@ let
in
{
packages = {
inherit mcpx idMailDeploy pkarrDeploy developingTodayBackupDeploy;
inherit
mcpx
idMailDeploy
pkarrDeploy
developingTodayBackupDeploy
;
mcpx-docs = mcpxDocs;
};
checks = {
Expand Down
6 changes: 3 additions & 3 deletions machines/user/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
''
];

# Zerotier needs one controller to accept new nodes. Once accepted
# the controller can be offline and routing still works.
clan.core.networking.zerotier.controller.enable = true;
# Zerotier is configured through the clan inventory (zerotier instance
# in lib/default.nix): this machine is the network controller. Once a
# node is accepted the controller can be offline and routing still works.
}
21 changes: 8 additions & 13 deletions modules/disko.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{
lib,
clan-core,
config,
...
}:
{ lib, ... }:

let
suffix = config.clan.core.vars.generators.disk-id.files.diskId.value;
in
{
imports = [ clan-core.clanModules.disk-id ];

# Migrated off the removed clan-core disk-id module per the upstream
# clan-core disk-id migration guide: this file is now a standalone static
# disko configuration. The disk name suffix is the machine's generated
# diskId, cross-checked against vars/per-machine/user/disk-id/diskId/value
# (`clan vars list user`) — do not change it after installation.
# DO NOT EDIT THIS FILE AFTER INSTALLATION of a machine
# Otherwise your system might not boot because of missing partitions / filesystems
boot.loader.grub.efiSupport = lib.mkDefault true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
disko.devices = {
disk = {
"main" = {
# suffix is to prevent disk name collisions
name = "main-" + suffix;
# static diskId suffix prevents disk name collisions
name = "main-822c2b3a90814675aa45e433aa1fe59a";
type = "disk";
# Set the following in flake.nix for each maschine:
# device = <uuid>;
Expand Down
25 changes: 12 additions & 13 deletions modules/shared.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{ config, clan-core, ... }:
{ config, ... }:
{
imports = [
# Enables the OpenSSH server for remote access
clan-core.clanModules.sshd
# Set a root password
clan-core.clanModules.root-password
clan-core.clanModules.user-password
clan-core.clanModules.state-version
];
# The services this file used to import from clan-core
# (sshd, root-password, user-password, state-version) were removed
# upstream. At the locked clan-core rev they are clanServices enabled
# as inventory instances in lib/default.nix (make-clan): sshd runs the
# OpenSSH server, and the users service generates the root and "user"
# passwords. state-version needs no replacement: clanCore enables
# clan.core.settings.state-version by default. See #159.

# Locale service discovery and mDNS
services.avahi.enable = true;

# generate a random password for our user below
# can be read using `clan secrets get <machine-name>-user-password` command
clan.user-password.user = "user";
# A generated password for the user below is provided by the users
# clanService instance in lib/default.nix; read it with
# `clan vars get user user-password-user/user-password`.
users.users.user = {
isNormalUser = true;
extraGroups = [
Expand All @@ -31,5 +30,5 @@
# Enable Android/ADB and MTP support
# programs.adb.enable = true;
services.udisks2.enable = true;
programs.gvfs.enable = true;
services.gvfs.enable = true;
}
1 change: 1 addition & 0 deletions vars/shared/zerotier-network-zerotier/network-id/value
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c5e451b2d6c22070

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate the controller identity together with its network ID

On deployment, this preserves the old network ID without migrating the controller identity from sops/secrets/user-zerotier-identity-secret/secret into the new vars store. A newly generated identity cannot control this network: ZeroTier's protocol documentation specifies that the first 10 hex digits of a network ID identify its controller, so this network requires the identity c5e451b2d6. Being both controller and peer does not allow a different identity to authorize itself on that network. Import the existing controller identity before generating/deploying the new service; preserving identities alongside network IDs is also required by the Clan migration guide.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted — verified, not merging past this.

Verified on the PR head (6306477): vars/per-machine/user/ contains only disk-id, openssh, and state-version — there is no zerotier identity in the vars store, while the controller identity exists only at sops/secrets/user-zerotier-identity-secret. The PR preserves the network ID (vars/shared/zerotier-network-zerotier/network-id/value) without importing that identity, so a deploy-time vars generation would mint a new controller identity that cannot authorize peers on this network (network-ID prefix = controller identity, per the linked ZeroTier doc and the Clan zerotier migration guide).

Disposition: merge of PR #3684 is blocked on this finding. Fix path (queue task 2943, parked with this as the resume condition): import the existing controller identity from the sops secret into the zerotier service's vars before any deploy, per the Clan migration guide — a deliberate secrets-handling step, not done in a shift tail. Alternative if the import proves impractical: split the zerotier instance out of this PR and re-verify eval. The rest of the PR is verified: nix eval .#nixosConfigurations.user.config.system.build.toplevel.drvPath passes at head and no clanModules refs remain in modules/*.nix.