Move ssh-key README
This commit is contained in:
parent
50086f590f
commit
5647db6b46
2 changed files with 0 additions and 47 deletions
|
@ -1,41 +0,0 @@
|
|||
# Adding SSH keys
|
||||
|
||||
To incorporate SSH keys, for instance, to enable authentication with a Git server, follow these steps:
|
||||
|
||||
Step 0: If necessary, generate a keypair, for example using the command:
|
||||
|
||||
```bash
|
||||
ssh-keygen -t ed25519
|
||||
```
|
||||
|
||||
Please note that setting a password for the keypair is not yet tested.
|
||||
|
||||
Step 1: Create a new file named `yourservice.yaml` within the [secrets](../../../secrets/) directory by executing the following command:
|
||||
|
||||
```bash
|
||||
sops secrets/yourservice.yaml
|
||||
```
|
||||
|
||||
Within this file, create a value that contains your private key. For example:
|
||||
|
||||
```yaml
|
||||
yourservice:
|
||||
ssh: |
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
<...>
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
```
|
||||
|
||||
Step 2: Reference this value in [your sops configuration](../../utils/sops/default.nix) as follows:
|
||||
|
||||
```
|
||||
sops.secrets."yourservice/ssh".format = "yaml";
|
||||
sops.secrets."yourservice/sss".sopsFile = secrets/youservice.yaml;
|
||||
```
|
||||
|
||||
Step 3: Finally, add the SSH key to your SSH configuration so that it is used correctly when connecting to your host. Add the following lines to your SSH configuraton file:
|
||||
|
||||
```
|
||||
Host yourservice
|
||||
IdentityFile /run/secrets/yourservice/ssh
|
||||
```
|
|
@ -1,47 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
sops
|
||||
];
|
||||
|
||||
sops = {
|
||||
# Add secrets.yml to the nix store
|
||||
defaultSopsFile = ../../../secrets/secrets.yaml;
|
||||
age = {
|
||||
# Automatically import SSH keys as age keys
|
||||
sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
# Use an age key that is expected to already be in the filesystem
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
# Generate new keys if the key specified above does not exist
|
||||
# generateKey = true;
|
||||
};
|
||||
secrets =
|
||||
let
|
||||
user = config.users.users.tdpeuter.name;
|
||||
|
||||
Hugo = {
|
||||
format = "yaml";
|
||||
sopsFile = ../../../secrets/Hugo.yaml;
|
||||
owner = user;
|
||||
};
|
||||
UGent = {
|
||||
format = "yaml";
|
||||
sopsFile = ../../../secrets/UGent.yaml;
|
||||
owner = user;
|
||||
};
|
||||
in {
|
||||
"Hugo/ssh" = Hugo;
|
||||
"UGent/HPC/ssh" = UGent;
|
||||
|
||||
"GitHub/ssh" = {
|
||||
format = "yaml";
|
||||
sopsFile = ../../../secrets/GitHub.yaml;
|
||||
owner = user;
|
||||
};
|
||||
"Hugo/Gitea/ssh" = Hugo;
|
||||
"UGent/GitHub/ssh" = UGent;
|
||||
"UGent/SubGit/ssh" = UGent;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue