diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-09-01 10:36:22 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-09-01 10:36:22 -0400 |
| commit | e350175be425e966bd81153580644c741a09eafb (patch) | |
| tree | f03f72ea78569c23a639a51394dd9d54c9909244 | |
| parent | 4c90e41829d3c2565df200373b6e822bc244a998 (diff) | |
propellor spin
| -rw-r--r-- | joeyconfig.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Tor.hs | 22 |
2 files changed, 14 insertions, 10 deletions
diff --git a/joeyconfig.hs b/joeyconfig.hs index 67398048..9c2985ae 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -484,7 +484,7 @@ keysafe = host "keysafe.joeyh.name" $ props & Tor.installed & Tor.hiddenServiceAvailable "keysafe" (Port 4242) - `requires` Tor.hiddenServiceData "keysafe" hostContext + -- `requires` Tor.hiddenServiceData "keysafe" hostContext -- keysafe installed manually until package is available iabak :: Host diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs index fb756f56..951084b4 100644 --- a/src/Propellor/Property/Tor.hs +++ b/src/Propellor/Property/Tor.hs @@ -119,15 +119,7 @@ bandwidthRate' s divby = case readSize dataUnits s of `describe` ("tor BandwidthRate " ++ v) Nothing -> property ("unable to parse " ++ s) noChange -hiddenServiceAvailable :: HiddenServiceName -> Port -> Property DebianLike -hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port - where - hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do - r <- satisfy - h <- liftIO $ readFile (varLib </> hn </> "hostname") - warningMessage $ unwords ["hidden service hostname:", h] - return r - +-- | Enables a hidden service for a given port. hiddenService :: HiddenServiceName -> Port -> Property DebianLike hiddenService hn (Port port) = ConfFile.adjustSection (unwords ["hidden service", hn, "available on port", show port]) @@ -141,6 +133,18 @@ hiddenService hn (Port port) = ConfFile.adjustSection oniondir = unwords ["HiddenServiceDir", varLib </> hn] onionport = unwords ["HiddenServicePort", show port, "127.0.0.1:" ++ show port] +-- | Same as `hiddenService` but also causes propellor to display +-- the onion address of the hidden service. +hiddenServiceAvailable :: HiddenServiceName -> Port -> Property DebianLike +hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port + where + hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do + r <- satisfy + h <- liftIO $ readFile (varLib </> hn </> "hostname") + warningMessage $ unwords ["hidden service hostname:", h] + return r + +-- | hiddenServiceData :: IsContext c => HiddenServiceName -> c -> Property (HasInfo + DebianLike) hiddenServiceData hn context = combineProperties desc $ props & installonion "hostname" |
