From 245d5590c9805bfad14c1c993d13626a96818a9d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Oct 2013 16:16:38 -0400 Subject: [PATCH] fix use of mangled ssh hostname However, this is not working for gcrypt repos with a mangled hostname. Problem is that the locked down key is installed before the repo is initialized, so git-annex-shell refuses to allow the gcrypt special remote to do its setup. --- Assistant/WebApp/Configurators/Ssh.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Assistant/WebApp/Configurators/Ssh.hs b/Assistant/WebApp/Configurators/Ssh.hs index 7e8eb31962..811a44babc 100644 --- a/Assistant/WebApp/Configurators/Ssh.hs +++ b/Assistant/WebApp/Configurators/Ssh.hs @@ -335,21 +335,23 @@ prepSsh gcrypt sshdata a | otherwise = prepSsh' gcrypt sshdata sshdata Nothing a prepSsh' :: Bool -> SshData -> SshData -> Maybe SshKeyPair -> (SshData -> Handler Html) -> Handler Html -prepSsh' gcrypt origsshdata sshdata keypair a = - sshSetup ["-p", show (sshPort origsshdata), sshhost, remoteCommand] "" (a origsshdata) +prepSsh' gcrypt origsshdata sshdata keypair a = sshSetup + [ "-p", show (sshPort origsshdata) + , genSshHost (sshHostName origsshdata) (sshUserName origsshdata) + , remoteCommand + ] "" (a sshdata) where - sshhost = genSshHost (sshHostName origsshdata) (sshUserName origsshdata) remotedir = T.unpack $ sshDirectory sshdata remoteCommand = shellWrap $ intercalate "&&" $ catMaybes [ Just $ "mkdir -p " ++ shellEscape remotedir , Just $ "cd " ++ shellEscape remotedir , if rsynconly then Nothing else Just "if [ ! -d .git ]; then git init --bare --shared; fi" , if (rsynconly || gcrypt) then Nothing else Just "git annex init" - , if needsPubKey sshdata - then addAuthorizedKeysCommand (hasCapability sshdata GitAnnexShellCapable) remotedir . sshPubKey <$> keypair + , if needsPubKey origsshdata + then addAuthorizedKeysCommand (hasCapability origsshdata GitAnnexShellCapable) remotedir . sshPubKey <$> keypair else Nothing ] - rsynconly = onlyCapability sshdata RsyncCapable + rsynconly = onlyCapability origsshdata RsyncCapable makeSshRepo :: SshData -> Handler Html makeSshRepo sshdata = setupCloudRemote TransferGroup Nothing $