Tor: hidden service
Signed-off-by: Félix Sipma <felix.sipma@no-log.org>
This commit is contained in:
parent
9608a390d2
commit
053183d44b
|
@ -16,5 +16,28 @@ isBridge = setup `requires` Apt.installed ["tor"]
|
||||||
, "Exitpolicy reject *:*"
|
, "Exitpolicy reject *:*"
|
||||||
] `onChange` restarted
|
] `onChange` restarted
|
||||||
|
|
||||||
|
hiddenServiceAvailable :: FilePath -> Int -> Property
|
||||||
|
hiddenServiceAvailable dir port = hiddenServiceHostName prop
|
||||||
|
where
|
||||||
|
prop = "/etc/tor/torrc" `File.containsLines`
|
||||||
|
[ "HiddenServiceDir " ++ dir
|
||||||
|
, "HiddenServicePort " ++ show port ++ " 127.0.0.1:" ++ show port
|
||||||
|
]
|
||||||
|
`describe` "hidden service available"
|
||||||
|
`onChange` Service.reloaded "tor"
|
||||||
|
hiddenServiceHostName p = adjustProperty p $ \satisfy -> do
|
||||||
|
r <- satisfy
|
||||||
|
h <- liftIO $ readFile (dir </> "hostname")
|
||||||
|
warningMessage $ unlines ["hidden service hostname:", h]
|
||||||
|
return r
|
||||||
|
|
||||||
|
hiddenService :: FilePath -> Int -> Property
|
||||||
|
hiddenService dir port = "/etc/tor/torrc" `File.containsLines`
|
||||||
|
[ "HiddenServiceDir " ++ dir
|
||||||
|
, "HiddenServicePort " ++ show port ++ " 127.0.0.1:" ++ show port
|
||||||
|
]
|
||||||
|
`describe` ("hidden service (" ++ dir ++ " " ++ show port ++ ") available")
|
||||||
|
`onChange` Service.reloaded "tor"
|
||||||
|
|
||||||
restarted :: Property
|
restarted :: Property
|
||||||
restarted = Service.restarted "tor"
|
restarted = Service.restarted "tor"
|
||||||
|
|
Loading…
Reference in New Issue