Installs Tor and optionally sets up a hidden service or configures as a relay
- Ohai: 6.14.0+
This cookbook makes use of node['platform_family'] to simplify platform
selection logic. This attribute was introduced in Ohai v0.6.12.
The following platform families are supported:
- Debian
- RHEL
- Fedora
- apt (for Debian installation)
- yum (for RHEL 5 installation)
node['tor']['DataDirectory']- The directory for keeping all the keys/etcnode['tor']['MinLogLevel']- The minimum log level to log. Possible values include debug, info, notice, warn, and err.node['tor']['LogDestination']- Where logs should be written. Valid values include a path to a file or "syslog"node['tor']['SocksPorts']- List of 'address:port' to open tor socks proxy on. Defaults to disabled
Hidden Services config section
node['tor']['HiddenServices']- hidden services Tor should expose
# Example
default['tor']['hiddenServices'] = {
'HIDDEN_SERVICE_NAME':{
'HiddenServiceDir' => '/var/lib/tor/some_service/', #default is /var/lib/tor/HIDDEN_SERVICE_NAME/
'HiddenServicePorts' => ['80 127.0.0.1:80'] #x y:z says to redirect requests on port x to the address y:z
}node['tor']['relay']['enabled']- if true tor will act as a relaynode['tor']['relay']['ORPort']- What port to advertise for incoming Tor connectionsnode['tor']['relay']['Address']- The IP address or full DNS name for incoming connections to your relaynode['tor']['relay']['OutboundBindAddress']- If you have multiple network interfaces, you can specify one for outgoing traffic to usenode['tor']['relay']['Nickname']- A handle for your relay, so people don't have to refer to it by keynode['tor']['relay']['RelayBandwidthRate']- Limit how much relayed traffic you will allow in kilobytes (not bits)node['tor']['relay']['RelayBandwidthBurst']- Limit how much relayed traffic you will allow for bursts in kilobytes (not bits)node['tor']['relay']['ContactInfo']- ContactInfo you can be reached at- Example:
"0xFFFFFFFF Random Person nobody AT example dot com"
- Example:
node['tor']['relay']['ExitPolicy']- Sets the exit node policy for tor defaults to no exit- Exampe:
['accept *:6660-6667','reject *:*'] # allow irc ports but no more
- Exampe:
node['tor']['relay']['BridgeRelay']- Set to 1 to run a bridge relaynode['tor']['relay']['PublishServerDescriptor']- Set to 0 to run a private bridge relaynode['tor']['relay']['Directory']- If true tor relay will server as a directory mirrornode['tor']['relay']['DirPort']- "address:port" from which to mirror directory informationnode['tor']['relay']['DirPortFrontPage']- If true a blob of html will be returned on your DirPort explaining Tor.- To send a custom HTML blob specify its full path, example
"/etc/tor/tor-exit-notice.html"
- To send a custom HTML blob specify its full path, example
node['tor']['relay']['MyFamily']- If you run more than one tor node add keyids for other tor nodes
Installs Tor and enables Tor service. By default it will not open a socks proxy, offer a hidden service, or act as a relay.
Installs Tor and configs Tor to be a relay. By default the relay will not be an exit or directory. Make sure to read through the attributes section for relays above.
This cookbook primarily installs Tor core packages. It can also be used to run a Tor relay or a hidden service.
To install tor client (all supported platforms):
include_recipe 'tor'
To install tor relay:
include_recipe "tor::relay"
The example role below opens a Tor socks proxy on port 9050 available to localhost only
name "torproxy"
run_list("recipe[tor-full]")
override_attributes(
"tor" => {
"SocksPorts" => ["127.0.0.1:9050"]
}
)Hidden service on port 80
The example role below serves a website on port 80 as a hidden service.
name "torservice"
run_list("recipe[tor-full]")
override_attributes(
"tor" => {
"hiddenServices" => {
"hidden_web_service" => {
"HiddenServicePorts" => ["80 127.0.0.1:8080"]
#requests on port 80 are redirected to localhost port 8080
}
}
}
)Note: The tor-full recipe will write the hidden service's hostname to the attribute node.tor.hiddenServices.HIDDEN_SERVICE_NAME.hostname after node convergence.
The node config below sets up a Tor relay. The relay is a directory and an exit for IRC (ports 6660 & 6667).
{
"run_list": [
"recipe[tor-full::relay]"
],
"tor": {
"relay": {
"Address":"tor.icyego.com",
"Nickname":"IcyEgo",
"RelayBandwidthRate":"1000",
"RelayBandwidthBurst":"1100",
"ContactInfo":"ContactInfo 0x04FAC2E9CC21424A Richard Klafter <[email protected]>",
"Directory":true,
"ExitPolicy":["accept *:6660-6667","reject *:*"]
}
}
}
Note: you can make recipe[tor-full] behave like recipe[tor-full::relay] by
setting the attribute tor.relay.enabled = true.
- Author:: Richard Klafter ([email protected])
- License:: MIT