aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/torrc.bridge.erb4
-rw-r--r--templates/torrc.control.erb26
-rw-r--r--templates/torrc.directory.erb12
-rw-r--r--templates/torrc.dns.erb6
-rw-r--r--templates/torrc.exit_policy.erb16
-rw-r--r--templates/torrc.global.erb25
-rw-r--r--templates/torrc.hidden_service.erb8
-rw-r--r--templates/torrc.map_address.erb4
-rw-r--r--templates/torrc.relay.erb84
-rw-r--r--templates/torrc.socks.erb10
-rw-r--r--templates/torrc.transparent.erb6
11 files changed, 106 insertions, 95 deletions
diff --git a/templates/torrc.bridge.erb b/templates/torrc.bridge.erb
index 58ef70d..559ce5d 100644
--- a/templates/torrc.bridge.erb
+++ b/templates/torrc.bridge.erb
@@ -1,3 +1,3 @@
-# Bridge <%= name%>
-Bridge <%= ip%>:<%= port%><%- if fingerprint -%> <%= fingerprint%><%- end -%>
+# Bridge <%= @name %>
+Bridge <%= @ip %>:<%= @port %><% if @fingerprint -%> <%= @fingerprint%><% end -%>
diff --git a/templates/torrc.control.erb b/templates/torrc.control.erb
index 336c72d..0b68faf 100644
--- a/templates/torrc.control.erb
+++ b/templates/torrc.control.erb
@@ -1,16 +1,16 @@
# tor controller
-<%- if port != '0' then -%>
-ControlPort <%= port %>
-<%- if cookie_authentication != '0' then -%>
+<% if @port != '0' -%>
+ControlPort <%= @port %>
+<% if @cookie_authentication != '0' -%>
CookieAuthentication 1
-<%- if cookie_auth_file != '' then -%>
-CookieAuthFile <%= cookie_auth_file %>
-<%- end -%>
-<%- if cookie_auth_file_group_readable != '' then -%>
-CookieAuthFileGroupReadable <%= cookie_auth_file_group_readable %>
-<%- end -%>
-<%- else -%>
-HashedControlPassword <%= hashed_control_password %>
-<%- end -%>
-<%- end -%>
+<% if @cookie_auth_file != '' -%>
+CookieAuthFile <%= @cookie_auth_file %>
+<% end -%>
+<% if @cookie_auth_file_group_readable != '' -%>
+CookieAuthFileGroupReadable <%= @cookie_auth_file_group_readable %>
+<% end -%>
+<% else -%>
+HashedControlPassword <%= @hashed_control_password %>
+<% end -%>
+<% end -%>
diff --git a/templates/torrc.directory.erb b/templates/torrc.directory.erb
index c6b35b5..1af9f40 100644
--- a/templates/torrc.directory.erb
+++ b/templates/torrc.directory.erb
@@ -1,11 +1,11 @@
# directory listing
-<%- if port != '0' then -%>
-DirPort <%= port %>
-<%- end -%>
-<%- for listen_address in listen_addresses -%>
+<% if port != '0' -%>
+DirPort <%= @port %>
+<% end -%>
+<% listen_addresses.each do |listen_address| -%>
DirListenAddress <%= listen_address %>
-<%- end -%>
-<%- if port_front_page != '' then -%>
+<% end -%>
+<% if @port_front_page != '' -%>
DirPortFrontPage <%= port_front_page %>
<%- end -%>
diff --git a/templates/torrc.dns.erb b/templates/torrc.dns.erb
index bd1e719..57cf46d 100644
--- a/templates/torrc.dns.erb
+++ b/templates/torrc.dns.erb
@@ -1,5 +1,5 @@
# DNS
-DNSPort <%= port %>
-<%- for listen_address in listen_addresses -%>
+DNSPort <%= @port %>
+<% @listen_addresses.each do |listen_address| -%>
DNSListenAddress <%= listen_address %>
-<%- end -%>
+<% end -%>
diff --git a/templates/torrc.exit_policy.erb b/templates/torrc.exit_policy.erb
index 92367c2..a30d43b 100644
--- a/templates/torrc.exit_policy.erb
+++ b/templates/torrc.exit_policy.erb
@@ -1,11 +1,11 @@
-# exit policies: <%= name %>
-<%- if reject_private != 1 then -%>
-ExitPolicyRejectPrivate <%= reject_private %>
-<%- end -%>
-<%- for policy in accept -%>
+# exit policies: <%= @name %>
+<% if @reject_private != '1' -%>
+ExitPolicyRejectPrivate <%= @reject_private %>
+<% end -%>
+<% @accept.each do |policy| -%>
ExitPolicy accept <%= policy %>
-<%- end -%>
-<%- for policy in reject -%>
+<% end -%>
+<% @reject.each do |policy| -%>
ExitPolicy reject <%= policy %>
-<%- end -%>
+<% end -%>
diff --git a/templates/torrc.global.erb b/templates/torrc.global.erb
index 0bc3bf2..f577673 100644
--- a/templates/torrc.global.erb
+++ b/templates/torrc.global.erb
@@ -1,15 +1,24 @@
# runtime
RunAsDaemon 1
-DataDirectory <%= scope.lookupvar('tor::daemon::data_dir') %>
+<% if (v=scope.lookupvar('tor::daemon::data_dir')) != '/var/lib/tor' -%>
+DataDirectory <%= v %>
+<% end -%>
# log
-<%- if scope.lookupvar('tor::daemon::log_rules') != [] then -%>
-<%- for log_rule in scope.lookupvar('tor::daemon::log_rules') -%>
+<% if (rules=scope.lookupvar('tor::daemon::log_rules')).empty? -%>
+Log notice syslog
+<% else -%>
+<% rules.each do |log_rule| -%>
Log <%= log_rule %>
+<% end -%>
+<% end -%>
+<%- if @safe_logging != 1 then -%>
+SafeLogging <%= @safe_logging %>
<%- end -%>
-<%- else -%>
-Log notice syslog
-<%- end -%>
-AutomapHostsOnResolve <%= scope.lookupvar('tor::daemon::automap_hosts_on_resolve') %>
-UseBridges <%= scope.lookupvar('tor::daemon::use_bridges') %>
+<% if (v=scope.lookupvar('tor::daemon::automap_hosts_on_resolve')) != '0' -%>
+AutomapHostsOnResolve <%= v %>
+<% end -%>
+<% if (v=scope.lookupvar('tor::daemon::use_bridges')) != '0' -%>
+UseBridges <%= v %>
+<%- end -%>
diff --git a/templates/torrc.hidden_service.erb b/templates/torrc.hidden_service.erb
index b9f758a..4dec0b2 100644
--- a/templates/torrc.hidden_service.erb
+++ b/templates/torrc.hidden_service.erb
@@ -1,6 +1,6 @@
-# hidden service <%= name %>
-HiddenServiceDir <%= data_dir %>/<%= name %>
-<%- for port in ports -%>
+# hidden service <%= @name %>
+HiddenServiceDir <%= @data_dir %>/<%= @name %>
+<% @ports.each do |port| -%>
HiddenServicePort <%= port %>
-<%- end -%>
+<% end -%>
diff --git a/templates/torrc.map_address.erb b/templates/torrc.map_address.erb
index 3fb0274..ef4f268 100644
--- a/templates/torrc.map_address.erb
+++ b/templates/torrc.map_address.erb
@@ -1,3 +1,3 @@
-# map address <%= name %>
-MapAddress <%= address %> <%= newaddress %>
+# map address <%= @name %>
+MapAddress <%= @address %> <%= @newaddress %>
diff --git a/templates/torrc.relay.erb b/templates/torrc.relay.erb
index 85320d3..511bda1 100644
--- a/templates/torrc.relay.erb
+++ b/templates/torrc.relay.erb
@@ -1,44 +1,46 @@
# relay
-<%- if port != 0 then -%>
-ORPort <%= port %>
-<%- for listen_address in listen_addresses -%>
+<% if @port != 0 -%>
+ORPort <%= @port %>
+<% listen_addresses.each do |listen_address| -%>
ORListenAddress <%= listen_address %>
-<%- end -%>
-<%- for outbound_bindaddress in real_outbound_bindaddresses -%>
+<% end -%>
+<% real_outbound_bindaddresses.each do |outbound_bindaddress| -%>
OutboundBindAddress <%= outbound_bindaddress %>
-<%- end -%>
-<%- if nickname != '' then -%>
-Nickname <%= nickname %>
-<%- end -%>
-<%- if address != '' then -%>
-Address <%= address %>
-<%- end -%>
-<%- if bandwidth_rate != '' then -%>
-BandwidthRate <%= bandwidth_rate %> KB
-<%- end -%>
-<%- if bandwidth_burst != '' then -%>
-BandwidthBurst <%= bandwidth_burst %> KB
-<%- end -%>
-<%- if relay_bandwidth_rate != '0' then -%>
-RelayBandwidthRate <%= relay_bandwidth_rate %> KB
-<%- end -%>
-<%- if relay_bandwidth_burst != '0' then -%>
-RelayBandwidthBurst <%= relay_bandwidth_burst %> KB
-<%- end -%>
-<%- if accounting_max != '0' then -%>
-AccountingMax <%= accounting_max %> GB
-<%- if accounting_start then -%>
-AccountingStart <%= accounting_start %>
-<%- end -%>
-<%- end -%>
-<%- if contact_info != '' then -%>
-ContactInfo <%= contact_info %>
-<%- end -%>
-<%- end -%>
-<%- if my_family != '' then -%>
-MyFamily <%= my_family %>
-<%- end -%>
-<%- if bridge_relay != '0' then -%>
-BridgeRelay <%= bridge_relay %>
-<%- end -%>
-
+<% end -%>
+<% if @nickname != '' -%>
+Nickname <%= @nickname %>
+<% end -%>
+<% if @address != '' -%>
+Address <%= @address %>
+<% end -%>
+<% if @portforwarding != '0' -%>
+PortForwarding <%= @portforwarding %>
+<% end -%>
+<% if @bandwidth_rate != '' -%>
+BandwidthRate <%= @bandwidth_rate %> KB
+<% end -%>
+<% if @bandwidth_burst != '' -%>
+BandwidthBurst <%= @bandwidth_burst %> KB
+<% end -%>
+<% if @relay_bandwidth_rate != '0' -%>
+RelayBandwidthRate <%= @relay_bandwidth_rate %> KB
+<% end -%>
+<% if @relay_bandwidth_burst != '0' -%>
+RelayBandwidthBurst <%= @relay_bandwidth_burst %> KB
+<% end -%>
+<% if @accounting_max != '0' -%>
+AccountingMax <%= @accounting_max %> GB
+<% if @accounting_start -%>
+AccountingStart <%= @accounting_start %>
+<% end -%>
+<% end -%>
+<% if @contact_info != '' -%>
+ContactInfo <%= @contact_info %>
+<% end -%>
+<% end -%>
+<% if @my_family != '' -%>
+MyFamily <%= @my_family %>
+<% end -%>
+<% if @bridge_relay != '0' -%>
+BridgeRelay <%= @bridge_relay %>
+<% end -%>
diff --git a/templates/torrc.socks.erb b/templates/torrc.socks.erb
index caf750d..4bc3ddc 100644
--- a/templates/torrc.socks.erb
+++ b/templates/torrc.socks.erb
@@ -1,9 +1,9 @@
# socks
-SocksPort <%= port %>
-<%- for listen_address in listen_addresses -%>
+SocksPort <%= @port %>
+<% @listen_addresses.each do |listen_address| -%>
SocksListenAddress <%= listen_address %>
-<%- end -%>
-<%- for policy in policies -%>
+<% end -%>
+<% @policies.each do |policy| -%>
SocksPolicy <%= policy %>
-<%- end -%>
+<% end -%>
diff --git a/templates/torrc.transparent.erb b/templates/torrc.transparent.erb
index dae97dc..c683150 100644
--- a/templates/torrc.transparent.erb
+++ b/templates/torrc.transparent.erb
@@ -1,5 +1,5 @@
# Transparent proxy
-TransPort <%= port %>
-<%- for listen_address in listen_addresses -%>
+TransPort <%= @port %>
+<% @listen_addresses.each do |listen_address| -%>
TransListenAddress <%= listen_address %>
-<%- end -%>
+<% end -%>