Compare commits
38 Commits
reproducib
...
1083949c87
| Author | SHA1 | Date | |
|---|---|---|---|
| 1083949c87 | |||
| 413202e940 | |||
| ec20c80251 | |||
| 251f87553f | |||
|
abb565cace
|
|||
|
|
65e7152ef0 | ||
| b94849b2f8 | |||
|
|
0058c90c34 | ||
|
|
b82777fadf | ||
|
|
c0d6607368 | ||
|
|
7c300eb385 | ||
| c409c5d53b | |||
|
|
e2fac827bd | ||
|
|
912c8e1195 | ||
|
|
ff2ccd5fb4 | ||
|
|
505354078b | ||
| ca246861c3 | |||
| f0e25ab64c | |||
| 251fe62574 | |||
|
|
2297dec03d | ||
| 02292085ef | |||
| 1980ab4ec1 | |||
| 21cb9ece11 | |||
|
|
f4544b1b90 | ||
|
|
3871f2e553 | ||
|
|
67e3037039 | ||
|
|
6fdd5e1d0d | ||
|
|
ff53ef6383 | ||
|
|
2a873b22fd | ||
|
|
95e1bd1299 | ||
|
|
03d7816617 | ||
| 3a4a1500c0 | |||
| 2e0e58b843 | |||
| 9df89d6039 | |||
|
|
8b33a1c704 | ||
|
|
eb61088dc9 | ||
|
|
fdb9980176 | ||
|
|
dfd8eb9c15 |
75
README.md
75
README.md
@@ -1,44 +1,20 @@
|
|||||||
# malobeo infrastructure
|
# malobeo infrastructure
|
||||||
|
|
||||||
this repository nxios configurations of the digital malobeo infrastructure. it should be used to setup, test, build and deploy different hosts in a reproducible manner.
|
this repository contains nixos configurations of the digital malobeo infrastructure. it should be used to setup, test, build and deploy different hosts in a reproducible manner.
|
||||||
|
|
||||||
the file structure is based on this [blog post](https://samleathers.com/posts/2022-02-03-my-new-network-and-deploy-rs.html)
|
|
||||||
|
|
||||||
## hosts
|
|
||||||
|
|
||||||
#### durruti
|
|
||||||
- nixos-container running on dedicated hetzner server
|
|
||||||
- login via ```ssh -p 222 malobeo@dynamicdiscord.de```
|
|
||||||
- if rebuild switch fails due to biglock do ```mount -o remount,rw /nix/var/nix/db```
|
|
||||||
- currently is running tasklist in detached tmux session
|
|
||||||
- [x] make module with systemd service out of that
|
|
||||||
|
|
||||||
## creating a new host
|
|
||||||
|
|
||||||
### setting up filesystem
|
|
||||||
currently nixos offers no declarative way of setting up filesystems and partitions. that means this has to be done manually for every new host. [to make it as easy as possible we can use this guide to setup an encrypted zfs filesystem](https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/Root%20on%20ZFS.html)
|
|
||||||
|
|
||||||
*we could create a shell script out of that*
|
|
||||||
|
|
||||||
### deploying configuration
|
### deploying configuration
|
||||||
|
|
||||||
#### local deployment
|
hosts are deployed automatically from master. The [hydra build server](https://hydra.dynamicdiscord.de/jobset/malobeo/infrastructure) will build new commits and on success, hosts will periodically pull those changes.
|
||||||
``` shell
|
Big changes (like updating flake lock) could be commited to the staging branch first. [Hydra builds staging seperate](https://hydra.dynamicdiscord.de/jobset/malobeo/staging), and on success you can merge into master.
|
||||||
nixos-rebuild switch --use-remote-sudo
|
|
||||||
```
|
|
||||||
|
|
||||||
#### remote deployment
|
### deploy fresh host
|
||||||
|
if you want to deploy a completly new host refer to [docs](https://docs.malobeo.org/anleitung/create.html)
|
||||||
|
|
||||||
you need the hostname and ip address of the host:
|
### testing configuration
|
||||||
``` shell
|
|
||||||
nixos-rebuild switch --flake .#<hostname> --target-host root@<ip_address> --build-host localhost
|
|
||||||
```
|
|
||||||
|
|
||||||
in this case 'localhost' is used as buildhost which can be usefull if the target host is low systemresources
|
|
||||||
|
|
||||||
|
refer to https://docs.malobeo.org/anleitung/microvm.html#testing-microvms-locally
|
||||||
|
|
||||||
## development
|
## development
|
||||||
|
|
||||||
### requirements
|
### requirements
|
||||||
we use flake based configurations for our hosts. if you want to build configurations on you own machine you have to enable flakes first by adding the following to your *configuration.nix* or *nix.conf*
|
we use flake based configurations for our hosts. if you want to build configurations on you own machine you have to enable flakes first by adding the following to your *configuration.nix* or *nix.conf*
|
||||||
``` nix
|
``` nix
|
||||||
@@ -55,46 +31,13 @@ a development shell with the correct environment can be created by running ```ni
|
|||||||
If you're using direnv you can add flake support by following those steps: [link](https://nixos.wiki/wiki/Flakes#Direnv_integration)
|
If you're using direnv you can add flake support by following those steps: [link](https://nixos.wiki/wiki/Flakes#Direnv_integration)
|
||||||
|
|
||||||
### build a configuration
|
### build a configuration
|
||||||
|
|
||||||
to build a configuration run the following command (replace ```<hostname>``` with the actual hostname):
|
to build a configuration run the following command (replace ```<hostname>``` with the actual hostname):
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
||||||
```
|
```
|
||||||
|
|
||||||
### building raspberry image
|
|
||||||
|
|
||||||
for the raspberry it is possible to build the whole configuration as an sd-card image which then can be flashed directly. more information about building arm on nixos can be found [here](https://nixos.wiki/wiki/NixOS_on_ARM).
|
|
||||||
|
|
||||||
to be able to build the image you need to enable qemu emulation on the machine you are building with. therefore it is necessary to add the following to your configuration.nix:
|
|
||||||
|
|
||||||
``` nix
|
|
||||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
|
||||||
```
|
|
||||||
|
|
||||||
then you can build the image with:
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
nix build .#nixosConfigurations.rpi1_base_image.config.system.build.sdImage
|
|
||||||
```
|
|
||||||
|
|
||||||
### run a configuration as vm
|
|
||||||
|
|
||||||
to run a vm we have to build it first using the following command (replace ```<hostname>``` with the actual hostname):
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
nix build .#nixosConfigurations.<hostname>.config.system.build.vm
|
|
||||||
```
|
|
||||||
|
|
||||||
afterwards run the following command to start the vm:
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
./result/bin/run-<hostname>-vm
|
|
||||||
```
|
|
||||||
|
|
||||||
### documentation
|
### documentation
|
||||||
|
|
||||||
for documentation we currently just use README.md files.
|
documentation is automatically build from master and can be found here: docs.malobeo.org
|
||||||
|
locally you can run documentation using ```nix run .#docs``` or ```nix run .#docsDev```
|
||||||
the devshell provides the python package ['grip'](https://github.com/joeyespo/grip) which can be used to preview different README.md files in the browser.
|
|
||||||
the usage is simple, just run ```grip``` in the same folder as the README.md you wanna preview. then open your browser at ```http://localhost:6419 ```.
|
|
||||||
|
|||||||
@@ -1,26 +1,20 @@
|
|||||||
# malobeo infrastructure
|
# malobeo infrastructure
|
||||||
|
|
||||||
this repository nxios configurations of the digital malobeo infrastructure. it should be used to setup, test, build and deploy different hosts in a reproducible manner.
|
this repository contains nixos configurations of the digital malobeo infrastructure. it should be used to setup, test, build and deploy different hosts in a reproducible manner.
|
||||||
|
|
||||||
the file structure is based on this [blog post](https://samleathers.com/posts/2022-02-03-my-new-network-and-deploy-rs.html)
|
|
||||||
|
|
||||||
### deploying configuration
|
### deploying configuration
|
||||||
#### local deployment
|
|
||||||
``` shell
|
|
||||||
nixos-rebuild switch --use-remote-sudo
|
|
||||||
```
|
|
||||||
|
|
||||||
#### remote deployment
|
hosts are deployed automatically from master. The [hydra build server](https://hydra.dynamicdiscord.de/jobset/malobeo/infrastructure) will build new commits and on success, hosts will periodically pull those changes.
|
||||||
you need the hostname and ip address of the host:
|
Big changes (like updating flake lock) could be commited to the staging branch first. [Hydra builds staging seperate](https://hydra.dynamicdiscord.de/jobset/malobeo/staging), and on success you can merge into master.
|
||||||
``` shell
|
|
||||||
nixos-rebuild switch --flake .#<hostname> --target-host root@<ip_address> --build-host localhost
|
|
||||||
```
|
|
||||||
|
|
||||||
in this case 'localhost' is used as buildhost which can be usefull if the target host is low systemresources
|
### deploy fresh host
|
||||||
|
if you want to deploy a completly new host refer to [docs](https://docs.malobeo.org/anleitung/create.html)
|
||||||
|
|
||||||
|
### testing configuration
|
||||||
|
|
||||||
|
refer to https://docs.malobeo.org/anleitung/microvm.html#testing-microvms-locally
|
||||||
|
|
||||||
## development
|
## development
|
||||||
|
|
||||||
### requirements
|
### requirements
|
||||||
we use flake based configurations for our hosts. if you want to build configurations on you own machine you have to enable flakes first by adding the following to your *configuration.nix* or *nix.conf*
|
we use flake based configurations for our hosts. if you want to build configurations on you own machine you have to enable flakes first by adding the following to your *configuration.nix* or *nix.conf*
|
||||||
``` nix
|
``` nix
|
||||||
@@ -37,46 +31,13 @@ a development shell with the correct environment can be created by running ```ni
|
|||||||
If you're using direnv you can add flake support by following those steps: [link](https://nixos.wiki/wiki/Flakes#Direnv_integration)
|
If you're using direnv you can add flake support by following those steps: [link](https://nixos.wiki/wiki/Flakes#Direnv_integration)
|
||||||
|
|
||||||
### build a configuration
|
### build a configuration
|
||||||
|
|
||||||
to build a configuration run the following command (replace ```<hostname>``` with the actual hostname):
|
to build a configuration run the following command (replace ```<hostname>``` with the actual hostname):
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
|
||||||
```
|
```
|
||||||
|
|
||||||
### building raspberry image
|
|
||||||
|
|
||||||
for the raspberry it is possible to build the whole configuration as an sd-card image which then can be flashed directly. more information about building arm on nixos can be found [here](https://nixos.wiki/wiki/NixOS_on_ARM).
|
|
||||||
|
|
||||||
to be able to build the image you need to enable qemu emulation on the machine you are building with. therefore it is necessary to add the following to your configuration.nix:
|
|
||||||
|
|
||||||
``` nix
|
|
||||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
|
||||||
```
|
|
||||||
|
|
||||||
then you can build the image with:
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
nix build .#nixosConfigurations.rpi1_base_image.config.system.build.sdImage
|
|
||||||
```
|
|
||||||
|
|
||||||
### run a configuration as vm
|
|
||||||
|
|
||||||
to run a vm we have to build it first using the following command (replace ```<hostname>``` with the actual hostname):
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
nix build .#nixosConfigurations.<hostname>.config.system.build.vm
|
|
||||||
```
|
|
||||||
|
|
||||||
afterwards run the following command to start the vm:
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
./result/bin/run-<hostname>-vm
|
|
||||||
```
|
|
||||||
|
|
||||||
### documentation
|
### documentation
|
||||||
|
|
||||||
for documentation we currently just use README.md files.
|
documentation is automatically build from master and can be found here: docs.malobeo.org
|
||||||
|
locally you can run documentation using ```nix run .#docs``` or ```nix run .#docsDev```
|
||||||
the devshell provides the python package ['grip'](https://github.com/joeyespo/grip) which can be used to preview different README.md files in the browser.
|
|
||||||
the usage is simple, just run ```grip``` in the same folder as the README.md you wanna preview. then open your browser at ```http://localhost:6419 ```.
|
|
||||||
|
|||||||
30
flake.lock
generated
30
flake.lock
generated
@@ -109,11 +109,11 @@
|
|||||||
"spectrum": "spectrum"
|
"spectrum": "spectrum"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736905611,
|
"lastModified": 1739104176,
|
||||||
"narHash": "sha256-eW6SfZRaOnOybBzhvEzu3iRL8IhwE0ETxUpnkErlqkE=",
|
"narHash": "sha256-bNvtud2PUcbYM0i5Uq1v01Dcgq7RuhVKfjaSKkW2KRI=",
|
||||||
"owner": "astro",
|
"owner": "astro",
|
||||||
"repo": "microvm.nix",
|
"repo": "microvm.nix",
|
||||||
"rev": "a18d7ba1bb7fd4841191044ca7a7f895ef2adf3b",
|
"rev": "d3a9b7504d420a1ffd7c83c1bb8fe57deaf939d2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -160,11 +160,11 @@
|
|||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736978406,
|
"lastModified": 1738816619,
|
||||||
"narHash": "sha256-oMr3PVIQ8XPDI8/x6BHxsWEPBRU98Pam6KGVwUh8MPk=",
|
"narHash": "sha256-5yRlg48XmpcX5b5HesdGMOte+YuCy9rzQkJz+imcu6I=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "b678606690027913f3434dea3864e712b862dde5",
|
"rev": "2eccff41bab80839b1d25b303b53d339fbb07087",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -192,11 +192,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737062831,
|
"lastModified": 1739020877,
|
||||||
"narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=",
|
"narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c",
|
"rev": "a79cfe0ebd24952b580b1cf08cd906354996d547",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -208,11 +208,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736916166,
|
"lastModified": 1739206421,
|
||||||
"narHash": "sha256-puPDoVKxkuNmYIGMpMQiK8bEjaACcCksolsG36gdaNQ=",
|
"narHash": "sha256-PwQASeL2cGVmrtQYlrBur0U20Xy07uSWVnFup2PHnDs=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e24b4c09e963677b1beea49d411cd315a024ad3a",
|
"rev": "44534bc021b85c8d78e465021e21f33b856e2540",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -245,11 +245,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737107480,
|
"lastModified": 1739262228,
|
||||||
"narHash": "sha256-GXUE9+FgxoZU8v0p6ilBJ8NH7k8nKmZjp/7dmMrCv3o=",
|
"narHash": "sha256-7JAGezJ0Dn5qIyA2+T4Dt/xQgAbhCglh6lzCekTVMeU=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "4c4fb93f18b9072c6fa1986221f9a3d7bf1fe4b6",
|
"rev": "07af005bb7d60c7f118d9d9f5530485da5d1e975",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ keys:
|
|||||||
- &admin_atlan age1ljpdczmg5ctqyeezn739hv589fwhssjjnuqf7276fqun6kc62v3qmhkd0c
|
- &admin_atlan age1ljpdczmg5ctqyeezn739hv589fwhssjjnuqf7276fqun6kc62v3qmhkd0c
|
||||||
- &machine_moderatio 3b7027ab1933c4c5e0eb935f8f9b3c058aa6d4c2
|
- &machine_moderatio 3b7027ab1933c4c5e0eb935f8f9b3c058aa6d4c2
|
||||||
- &machine_lucia 3474196f3adf27cfb70f8f56bcd52d1ed55033db
|
- &machine_lucia 3474196f3adf27cfb70f8f56bcd52d1ed55033db
|
||||||
- &machine_durruti age1pd2kkscyh7fuvm49umz8lfhse4fpkmp5pa3gvnh4ranwxs4mz9nqdy7sda
|
- &machine_durruti age1tc6aqmcl74du56d04wsz6mzp83n9990krzu4kuam2jqu8fx6kqpq038xuz
|
||||||
- &machine_infradocs age1decc74l6tm5sjtnjyj8rkxysr9j49fxsc92r2dcfpmzdcjv5dews8f03se
|
- &machine_infradocs age1tesz7xnnq9e58n5qwjctty0lw86gzdzd5ke65mxl8znyasx3nalqe4x6yy
|
||||||
- &machine_overwatch age1psj6aeu03s2k4zdfcte89nj4fw95xgk4e7yr3e6k6u2evq84ng3s57p6f0
|
- &machine_overwatch age1hq75x3dpnfqat9sgtfjf8lep49qvkdgza3xwp7ugft3kd74pdfnqfsmmdn
|
||||||
- &machine_vpn age1v6uxwej4nlrpfanr9js7x6059mtvyg4fw50pzt0a2kt3ahk7edlslafeuh
|
- &machine_vpn age1v6uxwej4nlrpfanr9js7x6059mtvyg4fw50pzt0a2kt3ahk7edlslafeuh
|
||||||
- &machine_fanny age136sz3lzhxf74ryruvq34d4tmmxnezkqkgu6zqa3dm582c22fgejqagrqxk
|
- &machine_fanny age136sz3lzhxf74ryruvq34d4tmmxnezkqkgu6zqa3dm582c22fgejqagrqxk
|
||||||
- &machine_nextcloud age1z0cfz7l4vakjrte220h46fc05503506fjcz440na92pzgztlspmqc8vt6k
|
- &machine_nextcloud age1g084sl230x94mkd2wq92s03mw0e8mnpjdjfx9uzaxw6psm8neyzqqwpnqe
|
||||||
#this dummy key is used for testing.
|
#this dummy key is used for testing.
|
||||||
- &machine_dummy age18jn5mrfs4gqrnv0e2sxsgh3kq4sgxx39hwr8z7mz9kt7wlgaasjqlr88ng
|
- &machine_dummy age18jn5mrfs4gqrnv0e2sxsgh3kq4sgxx39hwr8z7mz9kt7wlgaasjqlr88ng
|
||||||
creation_rules:
|
creation_rules:
|
||||||
|
|||||||
@@ -8,12 +8,11 @@ in
|
|||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
#./hardware-configuration.nix
|
#./hardware-configuration.nix
|
||||||
../modules/xserver.nix
|
../modules/xserver.nix
|
||||||
../modules/malobeo_user.nix
|
|
||||||
../modules/sshd.nix
|
../modules/sshd.nix
|
||||||
../modules/minimal_tools.nix
|
|
||||||
../modules/autoupdate.nix
|
../modules/autoupdate.nix
|
||||||
inputs.self.nixosModules.malobeo.disko
|
inputs.self.nixosModules.malobeo.disko
|
||||||
inputs.self.nixosModules.malobeo.initssh
|
inputs.self.nixosModules.malobeo.initssh
|
||||||
|
inputs.self.nixosModules.malobeo.users
|
||||||
];
|
];
|
||||||
|
|
||||||
malobeo.autoUpdate = {
|
malobeo.autoUpdate = {
|
||||||
@@ -38,6 +37,8 @@ in
|
|||||||
ethernetDrivers = ["r8169"];
|
ethernetDrivers = ["r8169"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
malobeo.users.malobeo = true;
|
||||||
|
|
||||||
hardware.sane.enable = true; #scanner support
|
hardware.sane.enable = true; #scanner support
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ in
|
|||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
#./hardware-configuration.nix
|
#./hardware-configuration.nix
|
||||||
../modules/malobeo_user.nix
|
|
||||||
../modules/sshd.nix
|
../modules/sshd.nix
|
||||||
../modules/minimal_tools.nix
|
../modules/minimal_tools.nix
|
||||||
../modules/autoupdate.nix
|
../modules/autoupdate.nix
|
||||||
@@ -18,6 +17,7 @@ in
|
|||||||
inputs.self.nixosModules.malobeo.disko
|
inputs.self.nixosModules.malobeo.disko
|
||||||
inputs.self.nixosModules.malobeo.microvm
|
inputs.self.nixosModules.malobeo.microvm
|
||||||
inputs.self.nixosModules.malobeo.metrics
|
inputs.self.nixosModules.malobeo.metrics
|
||||||
|
inputs.self.nixosModules.malobeo.users
|
||||||
];
|
];
|
||||||
|
|
||||||
virtualisation.vmVariantWithDisko = {
|
virtualisation.vmVariantWithDisko = {
|
||||||
@@ -50,6 +50,10 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
malobeo.users = {
|
||||||
|
malobeo = true;
|
||||||
|
admin = true;
|
||||||
|
};
|
||||||
|
|
||||||
malobeo.disks = {
|
malobeo.disks = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ in
|
|||||||
postCreateHook = lib.mkIf cfg.encryption ''
|
postCreateHook = lib.mkIf cfg.encryption ''
|
||||||
zfs set keylocation="prompt" zroot/encrypted;
|
zfs set keylocation="prompt" zroot/encrypted;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
"encrypted/root" = {
|
"encrypted/root" = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
@@ -245,16 +244,18 @@ in
|
|||||||
};
|
};
|
||||||
# use this to read the key during boot
|
# use this to read the key during boot
|
||||||
postCreateHook = lib.mkIf cfg.encryption ''
|
postCreateHook = lib.mkIf cfg.encryption ''
|
||||||
zfs set keylocation="file:///root/secret.key" storage/encrypted;
|
zfs set keylocation="prompt" storage/encrypted;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"encrypted/data" = {
|
"encrypted/data" = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mountpoint = "/data";
|
mountpoint = "/data";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
};
|
};
|
||||||
"encrypted/data/microvms" = {
|
"encrypted/data/microvms" = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mountpoint = "/data/microvms";
|
mountpoint = "/data/microvms";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
};
|
};
|
||||||
reserved = {
|
reserved = {
|
||||||
# for cow delete if pool is full
|
# for cow delete if pool is full
|
||||||
@@ -271,7 +272,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
boot.zfs.devNodes = lib.mkDefault cfg.devNodes;
|
boot.zfs.devNodes = lib.mkDefault cfg.devNodes;
|
||||||
boot.zfs.extraPools = lib.mkIf cfg.storage.enable [ "storage" ];
|
|
||||||
fileSystems."/".neededForBoot = true;
|
fileSystems."/".neededForBoot = true;
|
||||||
fileSystems."/etc".neededForBoot = true;
|
fileSystems."/etc".neededForBoot = true;
|
||||||
fileSystems."/boot".neededForBoot = true;
|
fileSystems."/boot".neededForBoot = true;
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ in
|
|||||||
loader.efi.canTouchEfiVariables = true;
|
loader.efi.canTouchEfiVariables = true;
|
||||||
supportedFilesystems = [ "vfat" "zfs" ];
|
supportedFilesystems = [ "vfat" "zfs" ];
|
||||||
zfs = {
|
zfs = {
|
||||||
|
forceImportAll = true;
|
||||||
requestEncryptionCredentials = true;
|
requestEncryptionCredentials = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
initrd = {
|
initrd = {
|
||||||
availableKernelModules = cfg.ethernetDrivers;
|
availableKernelModules = cfg.ethernetDrivers;
|
||||||
|
|||||||
97
machines/modules/malobeo/users.nix
Normal file
97
machines/modules/malobeo/users.nix
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
{config, lib, pkgs, inputs, ...}:
|
||||||
|
let
|
||||||
|
cfg = config.malobeo.users;
|
||||||
|
sshKeys = import ( inputs.self + /machines/ssh_keys.nix);
|
||||||
|
inherit (config.networking) hostName;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.malobeo.users = {
|
||||||
|
malobeo = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "enable malobeo user, defaults to on, ";
|
||||||
|
};
|
||||||
|
admin = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "enable admin user, defaults to on to prevent lockouts, passwordless sudo access";
|
||||||
|
};
|
||||||
|
backup = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "enable backup user, ";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf cfg.malobeo {
|
||||||
|
users.users.malobeo = {
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "malobeo user, password and ssh access, no root";
|
||||||
|
extraGroups = [ "pipewire" "pulse-access" "scanner" "lp" ];
|
||||||
|
openssh.authorizedKeys.keys = sshKeys.admins;
|
||||||
|
hashedPassword = "$y$j9T$39oJwpbFDeETiyi9TjZ/2.$olUdnIIABp5TQSOzoysuEsomn2XPyzwVlM91ZsEkIz1";
|
||||||
|
};
|
||||||
|
environment.systemPackages = with pkgs; [];
|
||||||
|
})
|
||||||
|
(lib.mkIf cfg.admin {
|
||||||
|
users.users.admin = {
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "admin user, passwordless sudo access, only ssh";
|
||||||
|
hashedPassword = null;
|
||||||
|
openssh.authorizedKeys.keys = sshKeys.admins;
|
||||||
|
extraGroups = [ "networkmanager" ];
|
||||||
|
};
|
||||||
|
environment.systemPackages = with pkgs; [];
|
||||||
|
nix.settings.trusted-users = [ "admin" ];
|
||||||
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
|
users = [ "admin" ];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "ALL";
|
||||||
|
options = [ "NOPASSWD" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
})
|
||||||
|
(lib.mkIf cfg.backup {
|
||||||
|
users.users.backup = {
|
||||||
|
isNormalUser = true;
|
||||||
|
hashedPassword = null;
|
||||||
|
openssh.authorizedKeys.keys = sshKeys.backup;
|
||||||
|
description = "backup user for pull style backups, can only use zfs commands";
|
||||||
|
};
|
||||||
|
environment.systemPackages = with pkgs; [];
|
||||||
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
|
users = [ "backup" ];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "${pkgs.zfs-user}/bin/zfs";
|
||||||
|
options = [ "NOPASSWD" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
})
|
||||||
|
{
|
||||||
|
users.mutableUsers = false;
|
||||||
|
services.openssh.hostKeys = [
|
||||||
|
{
|
||||||
|
path = "/etc/ssh/${hostName}";
|
||||||
|
type = "ssh-ed25519";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
sops.age.sshKeyPaths = [ "/etc/ssh/${hostName}" ];
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
nix-output-monitor
|
||||||
|
vim
|
||||||
|
htop
|
||||||
|
wget
|
||||||
|
git
|
||||||
|
pciutils
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ with lib;
|
|||||||
};
|
};
|
||||||
extraAppsEnable = true;
|
extraAppsEnable = true;
|
||||||
extraApps = {
|
extraApps = {
|
||||||
inherit (config.services.nextcloud.package.packages.apps) contacts calendar deck polls;
|
inherit (config.services.nextcloud.package.packages.apps) contacts calendar deck polls registration;
|
||||||
collectives = pkgs.fetchNextcloudApp {
|
collectives = pkgs.fetchNextcloudApp {
|
||||||
sha256 = "sha256-cj/8FhzxOACJaUEu0eG9r7iAQmnOG62yFHeyUICalFY=";
|
sha256 = "sha256-cj/8FhzxOACJaUEu0eG9r7iAQmnOG62yFHeyUICalFY=";
|
||||||
url = "https://github.com/nextcloud/collectives/releases/download/v2.15.2/collectives-2.15.2.tar.gz";
|
url = "https://github.com/nextcloud/collectives/releases/download/v2.15.2/collectives-2.15.2.tar.gz";
|
||||||
@@ -56,6 +56,7 @@ with lib;
|
|||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
trusted_domains = ["10.0.0.13"];
|
trusted_domains = ["10.0.0.13"];
|
||||||
|
trusted_proxies = [ "10.0.0.1" ];
|
||||||
"maintenance_window_start" = "1";
|
"maintenance_window_start" = "1";
|
||||||
"default_phone_region" = "DE";
|
"default_phone_region" = "DE";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,60 +8,60 @@ sops:
|
|||||||
- recipient: age1ljpdczmg5ctqyeezn739hv589fwhssjjnuqf7276fqun6kc62v3qmhkd0c
|
- recipient: age1ljpdczmg5ctqyeezn739hv589fwhssjjnuqf7276fqun6kc62v3qmhkd0c
|
||||||
enc: |
|
enc: |
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB4dCt1ZFR0QnRqVFdiL0Zi
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBPT3ZxNEpRVktDWG9BR0Rv
|
||||||
VTR6Zy9ZTy9YNDBZaDRTZzJnU2ZKcjJ0MG1vCldpRU5tTzc1YU5KbjlDbXlNRjBU
|
ZUZQTkJwQ0pSblNvTkFOT3BBdjVaSzJhVzBvCnVWc2xRUjBnRFFXSDgxczRMSFMy
|
||||||
Sm8yc0oyNWU1WHJoYTRvK3o4aGtTY2MKLS0tIE9wY0R0V3Vkc3Y1T1YwTkFTY0J5
|
WFdaMGo4eE13b0RkZkphN2MvOUZtRmcKLS0tIDFHZU9tNjBNa0sveUYzN2dmYnM1
|
||||||
ZCtzbVdtNlh0cXpra2RWbEwzUDM0UjgKY3zZn5PUWuLBQgYxm9BUpLYWw3CdXYA8
|
aDd0UlpMR3RNd3BDMmhqNmxhTFRoUlkK6Pni+cswKIU94WkP/fg5fzSmx/fhXjjl
|
||||||
4U6OVdRF6foj4/GrKKyhVf8dMbLbkhPvxqZ5wg40o6bwHEw9QNM+5Q==
|
mRG2o4ALCqcOxAxHBrKJppUCLjUgKG53wPF/jlIzkvbwHwnqVMfYsQ==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
- recipient: age1z0cfz7l4vakjrte220h46fc05503506fjcz440na92pzgztlspmqc8vt6k
|
- recipient: age1g084sl230x94mkd2wq92s03mw0e8mnpjdjfx9uzaxw6psm8neyzqqwpnqe
|
||||||
enc: |
|
enc: |
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBQbDZaYjRTTDc0SFU2U2xQ
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBRK2o2K2tPTFcvbXRkZ0lq
|
||||||
cUhESStvKzM5Z0QyZlJldURtRUJZTHhvNEFrCmxReGJ6MU9qdkh6UFVPYmRuQThs
|
bS9ZOUc3dG1JeERZYVNsc3k3RjcxQ0RsdkRJCkx1VFhBQXRDOElqakJ0eTd3NEJX
|
||||||
VmVCMTQwc0xkR0gzemlSUVlnN0NCZE0KLS0tIDFtK041ZlF4VFBreHVacitSVEN5
|
b0JxOUtSOGJWeXlqdE5DdC9qNHA2N1UKLS0tIEFiQ3ZQM0NOaXRhUHBjVFhRMFk4
|
||||||
WXg4UkJtU2dTR3ZjeFYzR3lRODhLYzgKrO+NtT0Q3K8FgDwW0WiZJOUHwkEz+wp8
|
VjBFeldXS1p0Zk1uSk02aHpJd3BPOHcKvCmnK/KttB4RgnID/fj2KOdjvNnV3EWU
|
||||||
lgBkXy2QJuuJ11f2e9ZJ3hx1xgOm6SMBmgl3zQVfVpq88yZE8uDe2Q==
|
B9mW4yxbEqhoxtu+GFD3eR/8SvMPEsHl9xorT/ZygMG7hAzedSukWw==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2024-11-26T20:00:50Z"
|
lastmodified: "2024-11-26T20:00:50Z"
|
||||||
mac: ENC[AES256_GCM,data:qoY9SfpoU+8HfvD5v/1S6BOkbnZUmHIbtwr0tTSuPETjnFNgr1VVw9mnRatJKPYYFb9/rMZQWIqTY+iUIEkcTVyVXhd6ki5CHW+uxCeBIyMzq33rtEa/btkEUoii4iPieamBCIY21W0znE+edxfR04yRJtLxMICEbuW4Hjf6bwk=,iv:nG42fRgjpuIjPMYnn/6egEdzYolcUBsspaZ8zMv4888=,tag:C6apGoAvVLsWdLWSCwrx6w==,type:str]
|
mac: ENC[AES256_GCM,data:qoY9SfpoU+8HfvD5v/1S6BOkbnZUmHIbtwr0tTSuPETjnFNgr1VVw9mnRatJKPYYFb9/rMZQWIqTY+iUIEkcTVyVXhd6ki5CHW+uxCeBIyMzq33rtEa/btkEUoii4iPieamBCIY21W0znE+edxfR04yRJtLxMICEbuW4Hjf6bwk=,iv:nG42fRgjpuIjPMYnn/6egEdzYolcUBsspaZ8zMv4888=,tag:C6apGoAvVLsWdLWSCwrx6w==,type:str]
|
||||||
pgp:
|
pgp:
|
||||||
- created_at: "2025-02-06T12:36:59Z"
|
- created_at: "2025-03-05T08:24:30Z"
|
||||||
enc: |-
|
enc: |-
|
||||||
-----BEGIN PGP MESSAGE-----
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
hQGMA5HdvEwzh/H7AQv8DLbU8OaQmYtAjTPlqeg1nv+/z3gA16MTZjz8rRBqK695
|
hQGMA5HdvEwzh/H7AQv+Lr4ISzvM/IEkckNhOOYAeZ0XCJ3JviSwT5wh3nd5u7ZJ
|
||||||
JaEbWoCJ2Nv5Mnzj7owQSk/+f+Q/d00osr4KOhQWTNoq1442MyWgIXKGPDmHgXv8
|
tXdLgLwGvFs0gXBf/R2kAoyEMyFziP3dqehvrjwTipuj/5lLdw73X9kddGkGOeQK
|
||||||
CxFT3hIKMEFFvFtkSdo+HlBSTQJZtHgDSGabd2xd4e45tLnHsPvWQ4ngGn+piUaw
|
EDq2+cW3ufuukpyRq+o4lJjMmbwQuqvhqeVOxohQ677e1Xy8q6DorfwOgEgHegK1
|
||||||
qz5+YIpmFNlnL9ubsB8NivryXlIL6wBXL83FyfAPnY+qG0/7frVWwP1Cejg1CGYl
|
t1H/DlVHritv54mPjr9hx0fZ5Auow17wteKD71KD/Y4s9JNB0DghcHAGiwYZzL7U
|
||||||
bOYxgb1uPYIIqvvU9bZ4r46DfojFFGur9pwG/wKGOgIQ867vsXtRnNm6+SJIHeyt
|
aFBY0itZyeJwH7rmFJDTQ+N+595t8dguTS/V1J0SKrIynMXVgTo6dpX10lSRubYe
|
||||||
eNqil3tee++V4VVUrDTf+gWufx9YFS/afRgMKuf1pUvQGTBMbUJNhIp+PjpOSBCk
|
9TQRMO3bmnsdPlmVJ7SlCkcc8blpHSgeQYdaZgPjDmbs+cuAkUMBnR/aEFXIX5IC
|
||||||
Kk6uyMWrBhiCpAVU9GKFW1AbDBCgUig2sLIUGOrfb+RkzDLX4pEoa9DVVDC2pRVy
|
lohDRX5Vd7dUfVl5CiPNbG8hnvcp2lg7CUBV46fVQ5ZJ73jW1+1Bk3hxGdLklLlF
|
||||||
F2fjEEbPAZepsPFNbgDyaixv+FeA5oWWiBnA7qO/v8t142UOtqBcexUZjBYYgRmt
|
N3hLzBBUpF8U0mvGMXJYX2gQKivRurIoLHZgmjQTjhA1uBfhTI3ktyLABz04dt7I
|
||||||
c0S+lTk//xEip9wYvY6W0lgBOLqEUEiLg1tw0xvt9H4R9aGNLkCyvUediwuAbfw4
|
OQYOlpsAZ/qnxbt+37LD0lgBz5XoHDuGNS2nnVQnuvtzt69GDP8mR1QXnhZedTrM
|
||||||
bGha9PTckYpnKN589xxsDMqbQ0Vn/rxeSzC7RT+qtjUg1gDbDJQTZdYr0+//e0YV
|
kDxxTXV7tMIbqw55tr+qVVG4H8QGy1xat3LSTIxoMmz0MmkyjQhApPN2ipwjyNof
|
||||||
xRvlnfPW9voB
|
X0Aw9hmAZV52
|
||||||
=xqAk
|
=A/yB
|
||||||
-----END PGP MESSAGE-----
|
-----END PGP MESSAGE-----
|
||||||
fp: c4639370c41133a738f643a591ddbc4c3387f1fb
|
fp: c4639370c41133a738f643a591ddbc4c3387f1fb
|
||||||
- created_at: "2025-02-06T12:36:59Z"
|
- created_at: "2025-03-05T08:24:30Z"
|
||||||
enc: |-
|
enc: |-
|
||||||
-----BEGIN PGP MESSAGE-----
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
hQIMA98TrrsQEbXUARAAqGyBZLrJ1UpiJKIbQSTQpKA7bRD7olMczjh0Bx1fTN0U
|
hQIMA98TrrsQEbXUAQ//UtocoQPpMZL71RyjSnJFZq1NT4H5KxbcvQb4LtPBbanK
|
||||||
bctdfIGVvdp5pM1C6xbvubNqAMEisQ1tMVozDkXCnLARTwcaq6lyE9vl3gJ1iF1Z
|
/gPja40wOWXy/3plCHuZYQ/mR69k9URgwD6/0RSSmCCuVp/+FPbK3UbMYyTOtYBr
|
||||||
N8SbxVTYV1SXg3qokyBsZIggQ6gJqAr62Pyoansp4HfwwFwYohwR2zTfHJ8pFkkW
|
wKnq9eRP8URK6LINJMcNHzfQtgvTcBclJSY1kLfUVjl2RV2NqXVa6+B1sHJdse8A
|
||||||
R2FfEI2Gw5nN4GaauIxUGFDPuvvZapCWZ/ejt4s/ezT9cYrwYfu9XIlqsivsi3yp
|
5NyJ/VNRRrNDtNnmIaIHPFUBySVKLqiXeex4gFNy02IcwwSiFZnBt/ReaFjZQTGE
|
||||||
I03ohKS/pKhxlE7RV2ufRboG+m6TUCnyj5U5AzQa09hkSHd94s9A6M8I6M6zWebv
|
TKfyohQF4V4/e35wvhbqWSFYZmWHCwW94gnwTwnlEO/H/NvbNUNDSYL6WwrIFF7+
|
||||||
pdX73sCjWZQdIZoeM5oXcyY/s/h4/w37loOUE/thh1+hIjybAG0CH31nJkjcdcLg
|
h/tP7nWbBxNqSByHGQuJnKSysndwUuSMuH+uj+uYdJDn1L1VEoErfAZcRSsDAz1Z
|
||||||
l/fqTLa89JVt37bU9c/hVsx2Bc1cTO7nqhG3kyahkMSLFrsb73yTNn4kOqSKZ7+z
|
BVkEaPJM6ZmRM48up5eHQtPG2rklmoFw/O/bPd9QUWJ/ZRu2gcY8aLGczHygaq6W
|
||||||
189oR0EjNySgRt+M20vjKzhPbjxxQTKlpTE0vho6fEHYRmzPQ3IQbVUbPEbZR64I
|
gvZTCPrke7XZTd9S3mAcdlJ2iAYuKY4AmGqfmXbd7mRZXP3DQkRaA/IwCCNJVmhX
|
||||||
S+Nk7m95ZV8djaUOwqqU9pwDTvuYIBwhGOY1kefDg1sCCTM8C9RI9sG02HeQpme3
|
um5MbCa17I9Uwh58NBmDuejLcmJDWL5jLmN6S86t3k3jKxwaX56SRwAD92klMdQq
|
||||||
bgkO+m4khXeiiIrTAODiyM+GCwx6UcwooUSpu8LZJmhiZtfgMsFdGF3P7ngtoOEQ
|
8UX2dkUkwnnI+YjfOEeLGDAT655TsejpE97JKjI/m39Pwnn+MrDEfNDHhfjX+9QC
|
||||||
4cxP231EI/zoMqRyXYrvAovxXndwghG0LGcCAZZL6mNN2xzE6z1gesVWRjXM8inS
|
5k+fiP7yWc7hG3A7jt5vEadazPgDeqy0q7jbmTPtmdieqBs71P3j19l3VKAU8ZnS
|
||||||
WAFB7DgLTlY43D4QbhkyZfo6XltYe1g1tcJJraG/HICa7hq5BZn48t/BcacCvsrJ
|
WAGz21MFYjhESmU7fqhTyVE9Dsd4GqyB+ZSa8hHj2ISaOi0QQ9JXjjtQhkDGlsB4
|
||||||
lIkEgOT8gn1SlQbDL+T+3pRNOixGKPNU6Ategoy+Eq0Im3AhE0XO8Ns=
|
/PrjZhyqd62wHS075YV1B9YqOhC1nAkC+s9mj9CrWIeH2JMOSK9EUyI=
|
||||||
=Uvc2
|
=5u7o
|
||||||
-----END PGP MESSAGE-----
|
-----END PGP MESSAGE-----
|
||||||
fp: aef8d6c7e4761fc297cda833df13aebb1011b5d4
|
fp: aef8d6c7e4761fc297cda833df13aebb1011b5d4
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
|
|||||||
@@ -5,4 +5,8 @@
|
|||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINQg6a2EGmq+i9lfwU+SRMQ8MGN3is3VS6janzl9qOHo quaseb67@hzdr.de"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINQg6a2EGmq+i9lfwU+SRMQ8MGN3is3VS6janzl9qOHo quaseb67@hzdr.de"
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICKaEcGaSKU0xC5qCwzj2oCLLG4PYjWHZ7/CXHw4urVk atlan@nixos"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICKaEcGaSKU0xC5qCwzj2oCLLG4PYjWHZ7/CXHw4urVk atlan@nixos"
|
||||||
];
|
];
|
||||||
|
backup = [
|
||||||
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIGryhnXdmbGObONG88K+c9zeduMrwtoLHwzMDZg3UXB+Cnq2FXWOrlLZxA+95VUgHpyGZiykJmzeWrKhldDlDeGGd8QCCLeuliiOgXADTYjWaVfhd+6arPZrK2VtqqsguvH40gW1xfoGAOmAT4WFnxWxIaEip0V2u6NOoKTiH9I3bz2Qe4lfJvPXig+XwCXcukXd6XUkDFYDpiw8XNV3X7pqTus5d2RYR97bAhIYZZQ6h50ZpTY8N0lFh4RY5yfx8BhxJW3tfoi9uZvVuPx7dGPsZsSniENFPMNz3UwHGitTJMr4088cJrAGgd5lyFuLouiHiM2JMGA0wx9wWTbWJEwTLaTVQK9gSJf857ndV2zCh9vKlfko4w9bQgqxKg4U/mY8dXX1E7D51nD2ci8Ed+ZG+NEneFLyZhLsD82GkBY+YovA+4xm/pcx+hBhlyqGNxI8v+Jh+JhEyD/ZLgJfq3ZMbGIGsTiDwZ2flLLxImHHEoDoT6PHU6hDhPDJu560="
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJKl5FWPskhlnzJs1+mMYrVTMNnRG92uFKUgGlteTPhL"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ in
|
|||||||
|
|
||||||
malobeo.disks = {
|
malobeo.disks = {
|
||||||
enable = true;
|
enable = true;
|
||||||
encryption = true;
|
encryption = false;
|
||||||
hostId = "83abc8cb";
|
hostId = "83abc8cb";
|
||||||
devNodes = "/dev/disk/by-path/";
|
devNodes = "/dev/disk/by-path/";
|
||||||
root = {
|
root = {
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ in (utils.lib.eachSystem (builtins.filter filter_system utils.lib.defaultSystems
|
|||||||
initssh.imports = [ ./machines/modules/malobeo/initssh.nix ];
|
initssh.imports = [ ./machines/modules/malobeo/initssh.nix ];
|
||||||
metrics.imports = [ ./machines/modules/malobeo/metrics.nix ];
|
metrics.imports = [ ./machines/modules/malobeo/metrics.nix ];
|
||||||
disko.imports = [ ./machines/modules/disko ];
|
disko.imports = [ ./machines/modules/disko ];
|
||||||
|
users.imports = [ ./machines/modules/malobeo/users.nix ];
|
||||||
};
|
};
|
||||||
|
|
||||||
hydraJobs = nixpkgs.lib.mapAttrs (_: nixpkgs.lib.hydraJob) (
|
hydraJobs = nixpkgs.lib.mapAttrs (_: nixpkgs.lib.hydraJob) (
|
||||||
|
|||||||
@@ -16,16 +16,17 @@ if [ ! -e flake.nix ]
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pwpath="machines"
|
read -p "Enter new host name: " hostname
|
||||||
hostkey="ssh_host_ed25519_key"
|
|
||||||
initrdkey="initrd_ed25519_key"
|
|
||||||
read -p "Enter new host name: " host
|
|
||||||
|
|
||||||
if [ "$host" = "" ]; then exit 0
|
if [ "$hostname" = "" ]; then exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $pwpath/$host/secrets
|
pwpath="machines/$hostname/secrets"
|
||||||
cd $pwpath/$host/secrets
|
hostkey="ssh_host_ed25519_key"
|
||||||
|
initrdkey="initrd_ed25519_key"
|
||||||
|
|
||||||
|
mkdir -p "$pwpath"
|
||||||
|
cd "$pwpath"
|
||||||
|
|
||||||
# Generate SSH keys
|
# Generate SSH keys
|
||||||
ssh-keygen -f $hostkey -t ed25519 -N "" -C "root@$host"
|
ssh-keygen -f $hostkey -t ed25519 -N "" -C "root@$host"
|
||||||
@@ -45,6 +46,6 @@ echo "Hier ist der age public key für sops etc:"
|
|||||||
echo "$(ssh-to-age -i ./"$hostkey".pub)"
|
echo "$(ssh-to-age -i ./"$hostkey".pub)"
|
||||||
echo
|
echo
|
||||||
echo "Hier ist eine reproduzierbare mac-addresse:"
|
echo "Hier ist eine reproduzierbare mac-addresse:"
|
||||||
echo "$host"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'
|
echo "$hostname"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -40,15 +40,13 @@ trap cleanup EXIT
|
|||||||
|
|
||||||
# Create the directory where sshd expects to find the host keys
|
# Create the directory where sshd expects to find the host keys
|
||||||
install -d -m755 "$temp/etc/ssh/"
|
install -d -m755 "$temp/etc/ssh/"
|
||||||
install -d -m755 "$temp/root/"
|
|
||||||
|
|
||||||
diskKey=$(sops -d $pwpath/disk.key)
|
diskKey=$(sops -d $pwpath/disk.key)
|
||||||
echo "$diskKey" > /tmp/secret.key
|
echo "$diskKey" > /tmp/secret.key
|
||||||
echo "$diskKey" > $temp/root/secret.key
|
|
||||||
|
|
||||||
sops -d "$pwpath/$hostkey" > "$temp/etc/ssh/$hostname"
|
sops -d "$pwpath/$hostkey" > "$temp/etc/ssh/$hostname"
|
||||||
|
|
||||||
sopd -d "$pwpath/$initrdkey" > "$temp/etc/ssh/initrd"
|
sops -d "$pwpath/$initrdkey" > "$temp/etc/ssh/initrd"
|
||||||
|
|
||||||
# # Set the correct permissions so sshd will accept the key
|
# # Set the correct permissions so sshd will accept the key
|
||||||
chmod 600 "$temp/etc/ssh/$hostname"
|
chmod 600 "$temp/etc/ssh/$hostname"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ set -o errexit
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
sshoptions="-o StrictHostKeyChecking=no -o ServerAliveInterval=1 -o ServerAliveCountMax=1 -p 222 -T"
|
sshoptions="-o StrictHostKeyChecking=no -o ServerAliveInterval=1 -o ServerAliveCountMax=1 -p 222 -T"
|
||||||
HOSTNAME=$1
|
hostname=$1
|
||||||
|
|
||||||
if [ ! -e flake.nix ]
|
if [ ! -e flake.nix ]
|
||||||
then
|
then
|
||||||
@@ -19,17 +19,19 @@ if [ ! -e flake.nix ]
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
diskkey=$(sops -d machines/$HOSTNAME/secrets/disk.key)
|
diskkey=$(sops -d machines/$hostname/secrets/disk.key)
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if [ $# = 1 ]
|
if [ $# = 1 ]
|
||||||
then
|
then
|
||||||
echo "$diskkey" | ssh $sshoptions root@$HOSTNAME-initrd "systemd-tty-ask-password-agent" #root
|
echo "$diskkey" | ssh $sshoptions root@$hostname-initrd "systemd-tty-ask-password-agent" #root
|
||||||
|
echo "$diskkey" | ssh $sshoptions root@$hostname-initrd "systemd-tty-ask-password-agent" #data
|
||||||
|
|
||||||
elif [ $# = 2 ]
|
elif [ $# = 2 ]
|
||||||
then
|
then
|
||||||
IP=$2
|
ip=$2
|
||||||
echo "$diskkey" | ssh $sshoptions root@$IP "systemd-tty-ask-password-agent" #root
|
echo "$diskkey" | ssh $sshoptions root@$ip "systemd-tty-ask-password-agent" #root
|
||||||
|
echo "$diskkey" | ssh $sshoptions root@$ip "systemd-tty-ask-password-agent" #data
|
||||||
|
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user