From 682cc7622e033575d6238c5792f135fce05b13c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= Date: Wed, 18 Oct 2017 16:09:14 -0400 Subject: add support for Server Transport Plugins --- manifests/daemon/transport_plugin.pp | 17 +++++++++++++++++ templates/torrc.transport_plugin.pp | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 manifests/daemon/transport_plugin.pp create mode 100644 templates/torrc.transport_plugin.pp diff --git a/manifests/daemon/transport_plugin.pp b/manifests/daemon/transport_plugin.pp new file mode 100644 index 0000000..f0ba41f --- /dev/null +++ b/manifests/daemon/transport_plugin.pp @@ -0,0 +1,17 @@ +# transport plugin +define tor::daemon::transport_plugin( + $servertransport_plugin = '', + $servertransport_listenaddr = '', + $servertransport_options = '', + $ext_port = '' ) { + + if $port == $ext_port { + fail('ORPort and ExtORPort values cannot be the same') + } + + concat::fragment { "11.transport_plugin": + content => template('tor/torrc.transport_plugin.erb'), + order => 11, + target => $tor::daemon::config_file, + } +} diff --git a/templates/torrc.transport_plugin.pp b/templates/torrc.transport_plugin.pp new file mode 100644 index 0000000..6adf00e --- /dev/null +++ b/templates/torrc.transport_plugin.pp @@ -0,0 +1,10 @@ +# transport plugin +<% if @servertransport_plugin != '' -%> +ServerTransportPlugin <%= @servertransport_plugin %> +<% if @servertransport_listenaddr != '' -%> +ServerTransportListenAddr <%= @servertransport_listenaddr %> +<% if @servertransport_options != '' -%> +ServerTransportOptions <%= @servertransport_options %> +<% if @ext_port != '' -%> +ExtORPort <%= @ext_port %> +<% end -%> -- cgit v1.2.3 From 354a87462f346ce6da31c52857f21a923d798445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= Date: Wed, 25 Oct 2017 15:51:22 -0400 Subject: remove the port check, since we can't access a variable in another define without creating a fact --- manifests/daemon/transport_plugin.pp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifests/daemon/transport_plugin.pp b/manifests/daemon/transport_plugin.pp index f0ba41f..7242e5e 100644 --- a/manifests/daemon/transport_plugin.pp +++ b/manifests/daemon/transport_plugin.pp @@ -5,10 +5,6 @@ define tor::daemon::transport_plugin( $servertransport_options = '', $ext_port = '' ) { - if $port == $ext_port { - fail('ORPort and ExtORPort values cannot be the same') - } - concat::fragment { "11.transport_plugin": content => template('tor/torrc.transport_plugin.erb'), order => 11, -- cgit v1.2.3 From 2785024a9b2bb49847d8cc77e0691b70cbb3fd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= Date: Wed, 25 Oct 2017 15:58:32 -0400 Subject: fix syntax error in transport_plugin template --- templates/torrc.transport_plugin.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/torrc.transport_plugin.pp b/templates/torrc.transport_plugin.pp index 6adf00e..d57f0e8 100644 --- a/templates/torrc.transport_plugin.pp +++ b/templates/torrc.transport_plugin.pp @@ -1,10 +1,13 @@ # transport plugin <% if @servertransport_plugin != '' -%> ServerTransportPlugin <%= @servertransport_plugin %> +<% end -%> <% if @servertransport_listenaddr != '' -%> ServerTransportListenAddr <%= @servertransport_listenaddr %> +<% end -%> <% if @servertransport_options != '' -%> ServerTransportOptions <%= @servertransport_options %> +<% end -%> <% if @ext_port != '' -%> ExtORPort <%= @ext_port %> <% end -%> -- cgit v1.2.3