summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--joeyconfig.hs2
-rw-r--r--src/Propellor/Property/Tor.hs22
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"