diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-11 00:23:34 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-11 00:23:34 -0400 |
commit | 675621d903aeb9928955483a58c2e5d463d31a35 (patch) | |
tree | c92389ed139c6a1cd44e1a54089f68e4ec4dfbb0 /Assistant/Pairing | |
parent | e588383e09259ddb06a661ce73a583b6e7257ce6 (diff) |
clean up authorized_keys handling
Including rollback of adding the key when a pairing response
gets canceled by the user.
Diffstat (limited to 'Assistant/Pairing')
-rw-r--r-- | Assistant/Pairing/MakeRemote.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Assistant/Pairing/MakeRemote.hs b/Assistant/Pairing/MakeRemote.hs index 9e65f4d13..1b39fcff7 100644 --- a/Assistant/Pairing/MakeRemote.hs +++ b/Assistant/Pairing/MakeRemote.hs @@ -19,6 +19,16 @@ import Assistant.MakeRemote import Network.Socket import qualified Data.Text as T +{- Authorized keys are set up before pairing is complete, so that the other + - side can immediately begin syncing. -} +setupAuthorizedKeys :: PairMsg -> IO () +setupAuthorizedKeys msg = do + validateSshPubKey pubkey + unlessM (liftIO $ addAuthorizedKeys False pubkey) $ + error "failed setting up ssh authorized keys" + where + pubkey = remoteSshPubKey $ pairMsgData msg + {- When pairing is complete, this is used to set up the remote for the host - we paired with. -} finishedPairing :: ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> PairMsg -> SshKeyPair -> IO () |