From 6e49deaaf26b693ca3538b0239ba7f998d81ef37 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 10 Jan 2012 17:41:13 -0200 Subject: splitting config in many templates --- templates/torrc.control.erb | 7 +++ templates/torrc.directory.erb | 12 +++++ templates/torrc.erb | 92 -------------------------------------- templates/torrc.exit_policy.erb | 10 +++++ templates/torrc.header.erb | 17 +++++++ templates/torrc.hidden_service.erb | 7 +++ templates/torrc.relay.erb | 36 +++++++++++++++ templates/torrc.socks.erb | 10 +++++ 8 files changed, 99 insertions(+), 92 deletions(-) create mode 100644 templates/torrc.control.erb create mode 100644 templates/torrc.directory.erb delete mode 100644 templates/torrc.erb create mode 100644 templates/torrc.exit_policy.erb create mode 100644 templates/torrc.header.erb create mode 100644 templates/torrc.hidden_service.erb create mode 100644 templates/torrc.relay.erb create mode 100644 templates/torrc.socks.erb (limited to 'templates') 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 -%> + -- cgit v1.2.3