Skip to content
Snippets Groups Projects
Commit 210b1dc2 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Merge remote-tracking branch 'origin/develop' into 71.ssh-known_hosts-files

parents 52765e29 d1d42ecb
No related branches found
No related tags found
3 merge requests!140Merge staging into production,!133Merge develop into staging,!130Burn in some SSH host key knowledge
Pipeline #886 passed
...@@ -11,13 +11,7 @@ let ...@@ -11,13 +11,7 @@ let
# `restrict` means "disable all the things" then `command` means "but # `restrict` means "disable all the things" then `command` means "but
# enable running this one command" (the client does not have to supply the # enable running this one command" (the client does not have to supply the
# command; if they authenticate, this is the command that will run). # command; if they authenticate, this is the command that will run).
# environment lets us pass an environment variable into the process "restrict,command=\"${command} ${gridName}\" ${authorizedKey}";
# started by the given command. It only works because we configured our
# sshd to allow this particular variable through. By passing this value,
# we can pin nixpkgs in the executed command to the same version
# configured for use here. It might be better if we just had a channel
# the system could be configured with ... but we don't at the moment.
"restrict,environment=\"NIXPKGS_FOR_MORPH=${pkgs.path}\",command=\"${command} ${gridName}\" ${authorizedKey}";
in { in {
options = { options = {
services.private-storage.deployment.authorizedKey = lib.mkOption { services.private-storage.deployment.authorizedKey = lib.mkOption {
...@@ -50,10 +44,6 @@ in { ...@@ -50,10 +44,6 @@ in {
]; ];
}; };
services.openssh.extraConfig = ''
PermitUserEnvironment=NIXPKGS_FOR_MORPH
'';
# Create a one-time service that will set up an ssh key that allows the # Create a one-time service that will set up an ssh key that allows the
# deployment user to authorize as root to perform the system update with # deployment user to authorize as root to perform the system update with
# `morph deploy`. # `morph deploy`.
......
...@@ -75,12 +75,15 @@ EOF ...@@ -75,12 +75,15 @@ EOF
# Make sure known_hosts has the host key in it. # Make sure known_hosts has the host key in it.
ssh -o StrictHostKeyChecking=no "$(hostname).$(domainname)" ":" ssh -o StrictHostKeyChecking=no "$(hostname).$(domainname)" ":"
# Set nixpkgs to our preferred version for the morph build. The NIX_PATH # Set nixpkgs to our preferred version for the morph build. Annoyingly, we
# environment variable itself receives special treatment by some parts of the # can't just use nixpkgs-2105.nix as our nixpkgs because some code (in morph,
# system (especially those parts leading up to the execution of this script) # at least) wants <nixpkgs> to be a fully-resolved path to a nixpkgs tree.
# so we pass the desired information through a different variable and then # For example, morph evaluated `import <nixpkgs/lib>` which would turn into
# shuffle it into the right place here, just before it is needed. # something like `import nixpkgs-2105.nix/lib` which is nonsense.
export NIX_PATH="nixpkgs=$NIXPKGS_FOR_MORPH" #
# So instead, import our nixpkgs which forces it to be instantiated in the
# store, then ask for its path, then set NIX_PATH to that.
export NIX_PATH="nixpkgs=$(nix eval "(import ${CHECKOUT}/nixpkgs-2105.nix { }).path")"
# Attempt to update just this host. Choose the morph grid definition matching # Attempt to update just this host. Choose the morph grid definition matching
# the grid we belong to and limit the morph deployment update to the host # the grid we belong to and limit the morph deployment update to the host
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment