Commit Graph

1541 Commits

Author SHA1 Message Date
Johannes Kirschbauer
1d566a47f4 Clan-api: init set disk_schema from facter report 2024-11-29 21:30:46 +01:00
hsjobeki
9201a29c1d revert 2031807acb
revert Clan-app: init single-disk template
2024-11-29 20:08:02 +00:00
DavHau
8d007867b3 vars/migration: remove useless check 2024-11-29 17:23:31 +07:00
DavHau
5c5a87d416 vars: rename: invalidation -> validation 2024-11-29 17:23:31 +07:00
DavHau
fbbfcc0aa5 vars: generate docs for cli and module 2024-11-29 17:23:31 +07:00
clan-bot
e1d9467357 Merge pull request 'vars: make upload actually upload' (#2520) from lassulus/clan-core:vars_upload into main 2024-11-28 20:08:19 +00:00
lassulus
936a9f555b vars: make upload actually upload 2024-11-28 21:00:12 +01:00
Qubasa
cf2ddfc191 clan-vm-manager: Fix regression part2 2024-11-28 19:01:46 +01:00
lassulus
b746f393a6 cli vars upload: fix sops 2024-11-28 17:52:04 +01:00
clan-bot
894e31f983 Merge pull request 'remove secretsUploadDirectory from common module' (#2509) from lassulus/clan-core:no-secrets-upload-dir into main 2024-11-28 15:46:51 +00:00
lassulus
8337a3ec41 vars: remove secretsUploadDirectory from common module 2024-11-28 16:38:06 +01:00
Johannes Kirschbauer
2031807acb Clan-app: init single-disk template 2024-11-28 16:37:52 +01:00
Johannes Kirschbauer
ff1164369a Clan-app/api: improve error message for mismatching types 2024-11-28 16:37:52 +01:00
Johannes Kirschbauer
f5a6052f43 Clan-app/api: error on {unknown api method, mismatching parameter name} 2024-11-28 16:37:52 +01:00
Qubasa
cc8c76e4d4 clan-cli: refactor HostGroup._run_local to work with RunOpts 2024-11-28 16:05:51 +01:00
Qubasa
1f98df96e3 clan-cli: cmd.run now has its options extracted to a dataclass 2024-11-28 15:26:37 +01:00
Johannes Kirschbauer
3b7559e066 CLI: use new template path 2024-11-28 11:44:44 +01:00
Qubasa
9c2c33d577 clan-cli: SSH now completely refactored to use dataclasses everywhere 2024-11-28 10:52:14 +01:00
Qubasa
80045a9af1 clan-cli: Add -L option to nixos-rebuild switch to still have build output, simplify logging code 2024-11-28 10:42:43 +01:00
Qubasa
a1a367c57c clan-cli: Refactor colors to a subset of colors that work in light and dark mode 2024-11-27 12:42:10 +01:00
lassulus
e978f91209 cli machines update: remove dead code 2024-11-27 10:33:28 +01:00
Johannes Kirschbauer
fa7e9a9670 Cli: improve targetHost error message 2024-11-27 10:06:04 +01:00
Johannes Kirschbauer
4e61df9601 API/serde: fix construction of Enum values 2024-11-27 10:06:04 +01:00
Johannes Kirschbauer
f8b98dfe54 Cli: fix error description should be appended 2024-11-27 10:06:04 +01:00
DavHau
44e6fe803f vars: make all python tests work in nix sandbox
- generate a flake.lock file for each template by copying the clan-core flake.lock and modifying it

- call nix build with --store for tests inside the sandbox
2024-11-27 14:32:02 +07:00
Louis Opter
93fa2af239 clan-cli: secrets: sops: SOPS_NIX_SECRET is not a sops variable
It's a variable internal to us, and it does not need to be allowed.
2024-11-27 06:27:53 +00:00
Louis Opter
ffe7b9057d clan-cli: secrets: address CR feedback for sops encryption and key handling
- Move public keys collection to a class method on `SopsKey`, and
  implement collection for each key type in `KeyType`, this helps make
  the code more generic ;
- Replace `Operation.__call__` by `run` (`sops.run` if you import the
  entire module), that allows us to dedent the code so that's cool ;
- Fix exception handling when trying to get a in-memory temporary file ;
- Make Executor cuter 😵🪦.
2024-11-27 06:27:53 +00:00
Louis Opter
07cd22393a clan-cli: rebase sops changes on top of vars changes
vars changes in question are from commit: 8b94bc71bc

With this changeset the age specific sops logic that was added is now
generic.

To keep things simple, this changeset modifies `SopsKey` so that
`username` is ignored when comparing different keys. I don't really see
us relying on `username` and this makes `SopsKey` hashable, and usable
in a `set`, which is nice when you check that you have a particular key.
2024-11-27 06:27:53 +00:00
Louis Opter
c266ffce6f clan-cli: secrets: treemft 2024-11-27 06:27:53 +00:00
Louis Opter
f4e621af88 clan-cli: secrets.sops: improve age keys detection
This change allows you to e.g. directly pass `$(age-keygen)` on the
command line.
2024-11-27 06:27:53 +00:00
Louis Opter
775be88a9c clan-cli: filter any sops recipients set in the environment for encryption
This forces sops to use our config file, otherwise if any of the
environment variables set to specify recipients is present then
`--config` will be ignored (see [env_check]).

That's simple enough, still I ended up refactoring how we call sops for
correctness, and to align with its behavior. The code now distinguishes
between public and private keys explicitly. `secrets.decrypt_secret`
does not try to lookup for public and private keys anymore.

With this changeset, some people might have to adjust their environment
as public age and PGP keys will be discovered like sops would do. In
particular if multiple public keys are discovered, then the user will
have to specify which one to use for the clan.

This also makes the following changes:

- try to use `/dev/shm` when swapping a secret (it's what [pass] does
  fwiw);
- alias immediate values for readability;
- remove some float comparison that could never succeed, and use sops'
  exit status instead;
- remove unused function `maybe_get_sops_key`.

[env_check]: 8c567aa8a7/cmd/sops/main.go (L2229)
[pass]: http://passwordstore.org/
2024-11-27 06:27:53 +00:00
Jörg Thalheim
c9e80f38ca vars: make interface more type-safe 2024-11-26 17:08:26 +01:00
a-kenji
22af137e17 pkgs/cli: Add --password flag to machines install
Add `--password` flag to `clan machines install`,
which allows installing through the `nixos-image` installer
manually without extra configuration.
2024-11-26 15:01:43 +01:00
Jörg Thalheim
fc9fcc5aa5 less verbose logging if commands fail 2024-11-26 14:38:59 +01:00
Jörg Thalheim
39db147e48 test_vars: mock ask function instead of sys.stdin 2024-11-26 11:56:38 +00:00
Johannes Kirschbauer
0811dd8e3e API/serde: add handling for serializing enum classes 2024-11-26 10:44:06 +00:00
DavHau
1881d7f0a5 vars: fix migration - secrets end up in public store 2024-11-26 17:02:11 +07:00
Qubasa
1063ac661a clan-cli: Remove tty.py 2024-11-25 20:32:36 +01:00
Qubasa
b9154fddd2 clan-cli: Refactor ssh classes to dataclasses 2024-11-25 19:47:17 +01:00
Qubasa
4e6051acdc docs: Fix nix flake check problem with diskId 2024-11-25 18:39:16 +01:00
lassulus
22c5e8ca8b cli password-store: upload generators folder only if it has secrets 2024-11-22 22:34:09 +01:00
lassulus
52b2b1c350 password-store: include filenames in manifest for upload check 2024-11-22 22:34:09 +01:00
lassulus
2c839ae768 cli password-store: skip uploading non secret files 2024-11-22 22:34:09 +01:00
Qubasa
a0b013d3cc clan-cli: Fix inventory update.sh 2024-11-22 22:23:10 +01:00
Qubasa
979e5e839d clan-cli: Refactor ssh part 2, Refactor custom_logger 2024-11-22 22:08:50 +01:00
Johannes Kirschbauer
6a6306f7f0 Clan-cli/api: init dynamic get module interface 2024-11-22 13:58:30 +01:00
Johannes Kirschbauer
0e556302c1 Clan-cli/api: list external modules 2024-11-21 17:04:35 +01:00
Johannes Kirschbauer
88114ebfdc Clan-cli: update inventory classes.py 2024-11-21 15:38:17 +00:00
Qubasa
a4f3d9d1fc clan-cli: Refactor ssh folder part 1 2024-11-21 13:02:22 +01:00
a-kenji
5a9d58ec59 pkgs/cli: Fix generation of hardware configuration for machines install
Correctly use the `value` of the `enum`, which is expected by
`nixos-anywhere`.
2024-11-20 16:15:45 +01:00