propellor spin
This commit is contained in:
parent
6075fc636d
commit
967a0d82dd
|
@ -66,22 +66,24 @@ uniqueHostKeys = flagFile prop "/etc/ssh/.unique_host_keys"
|
||||||
["configure"]
|
["configure"]
|
||||||
|
|
||||||
-- | Sets up a user with a ssh private key from the site's privdata.
|
-- | Sets up a user with a ssh private key from the site's privdata.
|
||||||
--
|
|
||||||
-- The ssh public key (.pub) is not installed. Ssh does not use it.
|
|
||||||
keyImported :: SshKeyType -> UserName -> Property
|
keyImported :: SshKeyType -> UserName -> Property
|
||||||
keyImported keytype user = Property desc install
|
keyImported keytype user = propertyList desc
|
||||||
|
[ Property desc (install (SshPubKey keytype user) ".pub")
|
||||||
|
, Property desc (install (SshPrivKey keytype user) "")
|
||||||
|
]
|
||||||
where
|
where
|
||||||
desc = user ++ " has ssh key"
|
desc = user ++ " has ssh key"
|
||||||
install = do
|
install p ext = do
|
||||||
f <- liftIO keyfile
|
f <- liftIO $ keyfile ext
|
||||||
ifM (liftIO $ doesFileExist f)
|
ifM (liftIO $ doesFileExist f)
|
||||||
( noChange
|
( noChange
|
||||||
, withPrivData (SshKey keytype user) $ \key -> makeChange $
|
, withPrivData p $ \key -> makeChange $
|
||||||
writeFileProtected f key
|
writeFileProtected f key
|
||||||
)
|
)
|
||||||
keyfile = do
|
keyfile ext = do
|
||||||
home <- homeDirectory <$> getUserEntryForName user
|
home <- homeDirectory <$> getUserEntryForName user
|
||||||
return $ home </> ".ssh" </> "id_" ++
|
return $ home </> ".ssh" </> "id_"
|
||||||
case keytype of
|
++ case keytype of
|
||||||
SshRsa -> "rsa"
|
SshRsa -> "rsa"
|
||||||
SshDsa -> "dsa"
|
SshDsa -> "dsa"
|
||||||
|
++ ext
|
||||||
|
|
|
@ -164,7 +164,8 @@ data CmdLine
|
||||||
-- It's fine to add new fields.
|
-- It's fine to add new fields.
|
||||||
data PrivDataField
|
data PrivDataField
|
||||||
= DockerAuthentication
|
= DockerAuthentication
|
||||||
| SshKey SshKeyType UserName
|
| SshPubKey SshKeyType UserName
|
||||||
|
| SshPrivKey SshKeyType UserName
|
||||||
| Password UserName
|
| Password UserName
|
||||||
| PrivFile FilePath
|
| PrivFile FilePath
|
||||||
| GpgKey GpgKeyId
|
| GpgKey GpgKeyId
|
||||||
|
|
Loading…
Reference in New Issue