tor bridge
This commit is contained in:
parent
38e626da7f
commit
f8c8be2079
|
@ -4,8 +4,9 @@ import qualified Property.Apt as Apt
|
||||||
import qualified Property.Ssh as Ssh
|
import qualified Property.Ssh as Ssh
|
||||||
import qualified Property.User as User
|
import qualified Property.User as User
|
||||||
import qualified Property.Hostname as Hostname
|
import qualified Property.Hostname as Hostname
|
||||||
import qualified Property.GitHome as GitHome
|
|
||||||
import qualified Property.Reboot as Reboot
|
import qualified Property.Reboot as Reboot
|
||||||
|
import qualified Property.Tor as Tor
|
||||||
|
import qualified Property.GitHome as GitHome
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = ensureProperties . getProperties =<< getHostName
|
main = ensureProperties . getProperties =<< getHostName
|
||||||
|
@ -38,6 +39,7 @@ getProperties "clam" =
|
||||||
, GitHome.installedFor "joey"
|
, GitHome.installedFor "joey"
|
||||||
-- Clam is a tor bridge.
|
-- Clam is a tor bridge.
|
||||||
, Apt.installed ["tor"]
|
, Apt.installed ["tor"]
|
||||||
|
, Tor.isBridge
|
||||||
-- Should come last as it reboots.
|
-- Should come last as it reboots.
|
||||||
, Apt.installed ["systemd-sysv"] `onChange` Reboot.scheduled "+10"
|
, Apt.installed ["systemd-sysv"] `onChange` Reboot.scheduled "+10"
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
module Property.Tor where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
import Control.Monad
|
||||||
|
import System.FilePath
|
||||||
|
|
||||||
|
import Property
|
||||||
|
import Property.User
|
||||||
|
import Utility.SafeCommand
|
||||||
|
import Utility.Exception
|
||||||
|
|
||||||
|
isBridge :: Property
|
||||||
|
isBridge = fileHasContent "/etc/tor/torrc"
|
||||||
|
[ "SocksPort 0"
|
||||||
|
, "ORPort 443"
|
||||||
|
, "BridgeRelay 1"
|
||||||
|
, "Exitpolicy reject *:*"
|
||||||
|
] `onChange` restartTor
|
||||||
|
|
||||||
|
restartTor :: Property
|
||||||
|
restartTor = cmdProperty "service" [Param "tor", Param "restart"]
|
Loading…
Reference in New Issue