summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2012-01-10 17:41:13 -0200
committerdrebs <drebs@riseup.net>2012-01-10 17:41:13 -0200
commit6e49deaaf26b693ca3538b0239ba7f998d81ef37 (patch)
tree41f0fb428b11ac621e608f15fba7dc4b9fac250d /templates
parent0e970df70e04129e76053b2c6eccb80610a8f197 (diff)
splitting config in many templates
Diffstat (limited to 'templates')
-rw-r--r--templates/torrc.control.erb7
-rw-r--r--templates/torrc.directory.erb12
-rw-r--r--templates/torrc.erb92
-rw-r--r--templates/torrc.exit_policy.erb10
-rw-r--r--templates/torrc.header.erb17
-rw-r--r--templates/torrc.hidden_service.erb7
-rw-r--r--templates/torrc.relay.erb36
-rw-r--r--templates/torrc.socks.erb10
8 files changed, 99 insertions, 92 deletions
diff --git a/templates/torrc.control.erb b/templates/torrc.control.erb
new file mode 100644
index 0000000..27b8156
--- /dev/null
+++ b/templates/torrc.control.erb
@@ -0,0 +1,7 @@
+# tor controller
+
+<%- if control_port != '0' then -%>
+ControlPort <%= control_port %>
+HashedControlPassword <%= hashed_control_password %>
+<%- end -%>
+
diff --git a/templates/torrc.directory.erb b/templates/torrc.directory.erb
new file mode 100644
index 0000000..56cfae0
--- /dev/null
+++ b/templates/torrc.directory.erb
@@ -0,0 +1,12 @@
+# directory listing
+
+<%- if dir_port != '0' then -%>
+DirPort <%= dir_port %>
+<%- end -%>
+<%- if dir_listen_address != '' then -%>
+DirListenAddress <%= dir_listen_address %>
+<%- end -%>
+<%- if dir_port_front_page != '' then -%>
+DirPortFrontPage <%= dir_port_front_page %>
+<%- end -%>
+
diff --git a/templates/torrc.erb b/templates/torrc.erb
deleted file mode 100644
index 1e233a8..0000000
--- a/templates/torrc.erb
+++ /dev/null
@@ -1,92 +0,0 @@
-## This file is managed by puppet.
-
-## socks
-SocksPort <%= socks_port %>
-<%- for add in socks_listen_addresses -%>
-SocksListenAddress <%= add %>
-<%- end -%>
-<%- for policy in socks_policies -%>
-SocksPolicy <%= policy %>
-<%- end -%>
-
-## log
-<%- if log_rules != [] then -%>
-<%- for log_rule in log_rules -%>
-Log <%= log_rule %>
-<%- end -%>
-<%- else -%>
-Log notice syslog
-<%- end -%>
-
-## runtime
-RunAsDaemon 1
-DataDirectory <%= data_directory %>
-
-## tor controller
-<%- if control_port != '0' then -%>
-ControlPort <%= control_port %>
-HashedControlPassword <%= hashed_control_password %>
-<%- end -%>
-
-## hidden services
-<%- for service in hidden_services -%>
-HiddenServiceDir /var/tor/<%= service[:name] %>/<%= service[:dir] %>
-<%- for port in service[:ports] -%>
-HiddenServicePort <%= port %>
-<%- end -%>
-<%- end -%>
-
-## relay
-<%- if or_port != 0 then -%>
-ORPort <%= or_port %>
-<%- end -%>
-<%- if or_listen_address != '' then -%>
-ORListenAddress <%= or_listen_address %>
-<%- end -%>
-<%- if nickname != '' then -%>
-Nickname <%= nickname %>
-<%- end -%>
-<%- if address != '' then -%>
-Address <%= address %>
-<%- 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
-<%- end -%>
-<%- for accounting in accounting_start -%>
-AccountingStart <%= accounting_start %>
-<%- end -%>
-<%- if contact_info != '' then -%>
-ContactInfo <%= contact_info %>
-<%- end -%>
-
-## directory listing
-<%- if dir_port != '0' then -%>
-DirPort <%= dir_port %>
-<%- end -%>
-<%- if dir_listen_address != '' then -%>
-DirListenAddress <%= dir_listen_address %>
-<%- end -%>
-<%- if dir_port_front_page != '' then -%>
-DirPortFrontPage <%= dir_port_front_page %>
-<%- end -%>
-
-## relay family
-<%- if my_family != '' then -%>
-MyFamily <%= my_family %>
-<%- end -%>
-
-## bridge relay
-<%- if bridge_relay != '0' then -%>
-BridgeRelay <%= bridge_relay %>
-<%- end -%>
-
-## exit policies
-<%- for policy in exit_policies -%>
-ExitPolicy <%= policy %>
-<%- end -%>
diff --git a/templates/torrc.exit_policy.erb b/templates/torrc.exit_policy.erb
new file mode 100644
index 0000000..68ceba2
--- /dev/null
+++ b/templates/torrc.exit_policy.erb
@@ -0,0 +1,10 @@
+# exit policies: <%= name %>
+
+<%- for policy in accept -%>
+ExitPolicy accept <%= policy %>
+<%- end -%>
+
+<%- for policy in reject -%>
+ExitPolicy reject <%= policy %>
+<%- end -%>
+
diff --git a/templates/torrc.header.erb b/templates/torrc.header.erb
new file mode 100644
index 0000000..b393631
--- /dev/null
+++ b/templates/torrc.header.erb
@@ -0,0 +1,17 @@
+# This file is managed by puppet.
+
+# runtime
+
+RunAsDaemon 1
+DataDirectory <%= data_directory %>
+
+# log
+
+<%- if log_rules != [] then -%>
+<%- for log_rule in log_rules -%>
+Log <%= log_rule %>
+<%- end -%>
+<%- else -%>
+Log notice syslog
+<%- end -%>
+
diff --git a/templates/torrc.hidden_service.erb b/templates/torrc.hidden_service.erb
new file mode 100644
index 0000000..d2f2d49
--- /dev/null
+++ b/templates/torrc.hidden_service.erb
@@ -0,0 +1,7 @@
+# hidden service <%= name %>
+
+HiddenServiceDir /var/tor/<%= name %>
+<%- for port in ports -%>
+HiddenServicePort <%= port %>
+<%- end -%>
+
diff --git a/templates/torrc.relay.erb b/templates/torrc.relay.erb
new file mode 100644
index 0000000..9531c9b
--- /dev/null
+++ b/templates/torrc.relay.erb
@@ -0,0 +1,36 @@
+# relay
+
+<%- if port != 0 then -%>
+ORPort <%= port %>
+<%- for listen_address in listen_addresses -%>
+ORListenAddress <%= listen_address %>
+<%- end -%>
+<%- if nickname != '' then -%>
+Nickname <%= nickname %>
+<%- end -%>
+<%- if address != '' then -%>
+Address <%= address %>
+<%- 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
+<%- end -%>
+<%- for accounting in accounting_start -%>
+AccountingStart <%= accounting_start %>
+<%- 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 -%>
+
diff --git a/templates/torrc.socks.erb b/templates/torrc.socks.erb
new file mode 100644
index 0000000..a27489d
--- /dev/null
+++ b/templates/torrc.socks.erb
@@ -0,0 +1,10 @@
+# socks
+
+SocksPort <%= socks_port %>
+<%- for listen_address in socks_listen_addresses -%>
+SocksListenAddress <%= listen_address %>
+<%- end -%>
+<%- for policy in socks_policies -%>
+SocksPolicy <%= policy %>
+<%- end -%>
+