Skip to content
Closed
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
12 changes: 12 additions & 0 deletions src/download-via-ssh/download-via-ssh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ void run(Strings args)
if (args.empty())
throw UsageError("download-via-ssh requires an argument");

Settings::SettingsMap overrides = settings.getOverrides();
Settings::SettingsMap::iterator use = overrides.find("untrusted-use-ssh-substituter");
if (use != overrides.end()) {
if (use->second == "true") settings.useSshSubstituter = true;
else if (use->second == "false") settings.useSshSubstituter = false;
else throw Error(format("configuration option `use-ssh-substituter' should be either `true' or `false', not `%1%'")
% use->second);
}

if (!settings.useSshSubstituter)
return;

if (settings.sshSubstituterHosts.empty())
return;

Expand Down
2 changes: 2 additions & 0 deletions src/libstore/globals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Settings::Settings()
syncBeforeRegistering = false;
useSubstitutes = true;
useChroot = false;
useSshSubstituter = false;
dirsInChroot.insert("/dev");
dirsInChroot.insert("/dev/pts");
impersonateLinux26 = false;
Expand Down Expand Up @@ -153,6 +154,7 @@ void Settings::update()
get(autoOptimiseStore, "auto-optimise-store");
get(envKeepDerivations, "env-keep-derivations");
get(sshSubstituterHosts, "ssh-substituter-hosts");
get(useSshSubstituter, "use-ssh-substituter");
}


Expand Down
3 changes: 3 additions & 0 deletions src/libstore/globals.hh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ struct Settings {
/* Set of ssh connection strings for the ssh substituter */
Strings sshSubstituterHosts;

/* Whether to use the ssh substituter at all */
bool useSshSubstituter;

/* Whether to impersonate a Linux 2.6 machine on newer kernels. */
bool impersonateLinux26;

Expand Down