[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
96/376: nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substit
From: |
Ludovic Courtès |
Subject: |
96/376: nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substituter |
Date: |
Wed, 28 Jan 2015 22:04:17 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 67937907ca7e90bc8fe3019d3c4d6436a8eba7ed
Author: Eelco Dolstra <address@hidden>
Date: Fri Jul 25 18:02:48 2014 +0200
nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substituter
---
src/download-via-ssh/download-via-ssh.cc | 5 +++++
src/libstore/globals.cc | 8 ++++++++
src/libstore/globals.hh | 2 ++
src/libstore/remote-store.cc | 2 ++
4 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/download-via-ssh/download-via-ssh.cc
b/src/download-via-ssh/download-via-ssh.cc
index 0fa0897..466233c 100644
--- a/src/download-via-ssh/download-via-ssh.cc
+++ b/src/download-via-ssh/download-via-ssh.cc
@@ -101,6 +101,11 @@ void run(Strings args)
std::cout << std::endl;
+ /* Pass on the location of the daemon client's SSH authentication
+ socket. */
+ string sshAuthSock = settings.get("ssh-auth-sock");
+ if (sshAuthSock != "") setenv("SSH_AUTH_SOCK", sshAuthSock.c_str(), 1);
+
string host = settings.sshSubstituterHosts.front();
std::pair<FdSink, FdSource> pipes = connect(host);
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 82f3e95..e9fe0be 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -122,6 +122,14 @@ void Settings::set(const string & name, const string &
value)
}
+string Settings::get(const string & name, const string & def)
+{
+ auto i = settings.find(name);
+ if (i == settings.end()) return def;
+ return i->second;
+}
+
+
void Settings::update()
{
get(tryFallback, "build-fallback");
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index f174833..d16969c 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -21,6 +21,8 @@ struct Settings {
void set(const string & name, const string & value);
+ string get(const string & name, const string & def = "");
+
void update();
string pack();
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index b3967bb..7c51f39 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -163,6 +163,8 @@ void RemoteStore::setOptions()
if (GET_PROTOCOL_MINOR(daemonVersion) >= 12) {
Settings::SettingsMap overrides = settings.getOverrides();
+ if (overrides["ssh-auth-sock"] == "")
+ overrides["ssh-auth-sock"] = getEnv("SSH_AUTH_SOCK");
writeInt(overrides.size(), to);
foreach (Settings::SettingsMap::iterator, i, overrides) {
writeString(i->first, to);
- 100/376: Rename nixPath to __nixPath, (continued)
- 100/376: Rename nixPath to __nixPath, Ludovic Courtès, 2015/01/28
- 95/376: Change the default for use-ssh-substituter to ‘true’, Ludovic Courtès, 2015/01/28
- 90/376: Implement nix-copy-closure --from via nix-store --serve, Ludovic Courtès, 2015/01/28
- 97/376: Remove outdated AUTHORS file, Ludovic Courtès, 2015/01/28
- 92/376: Fix NIX_SSHOPTS, Ludovic Courtès, 2015/01/28
- 103/376: Allow regular files as GC roots, Ludovic Courtès, 2015/01/28
- 94/376: nix-copy-closure: Drop --bzip2, --xz, --show-progress, Ludovic Courtès, 2015/01/28
- 84/376: Use pthread_cancel instead of a signal, Ludovic Courtès, 2015/01/28
- 102/376: Restore default SIGPIPE handler before invoking ‘man’, Ludovic Courtès, 2015/01/28
- 98/376: nix-profile.sh: Set $SSL_CERT_FILE, Ludovic Courtès, 2015/01/28
- 96/376: nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substituter,
Ludovic Courtès <=
- 101/376: make clean: Remove Makefile.config, Ludovic Courtès, 2015/01/28
- 105/376: findRoots(): Prevent a call to lstat(), Ludovic Courtès, 2015/01/28
- 108/376: Remove ugly hack for detecting build environment setup errors, Ludovic Courtès, 2015/01/28
- 107/376: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/01/28
- 104/376: Make readDirectory() return inode / file type, Ludovic Courtès, 2015/01/28
- 106/376: Eliminate redundant copy, Ludovic Courtès, 2015/01/28
- 110/376: Make chroot builds easier to set up, Ludovic Courtès, 2015/01/28
- 109/376: Speed up nix-shell, Ludovic Courtès, 2015/01/28
- 121/376: nix-install-package: Use extra-binary-caches, Ludovic Courtès, 2015/01/28
- 119/376: Add support for order-only dependencies, Ludovic Courtès, 2015/01/28