]> gitweb.fluxo.info Git - puppet-tor.git/commitdiff
add $cookie_authentication, $cookie_auth_file and $cookie_auth_file_group_readable...
authorMicah Anderson <micah@riseup.net>
Fri, 3 Aug 2012 19:00:32 +0000 (15:00 -0400)
committerMicah Anderson <micah@riseup.net>
Fri, 3 Aug 2012 19:00:32 +0000 (15:00 -0400)
manifests/daemon.pp
templates/torrc.control.erb

index 5150c96eb9d28a3cd2258879af45ea992f772d69..8f6d80d6bfc451666c7c69ba237a0adc474112c3 100644 (file)
@@ -123,13 +123,20 @@ class tor::daemon inherits tor {
   } 
 
   # control definition
-  define control( $port                    = 0,
-                  $hashed_control_password = '',
+  define control( $port                            = 0,
+                  $hashed_control_password         = '',
+                  $cookie_authentication           = 0,
+                  $cookie_auth_file                = '',
+                  $cookie_auth_file_group_readable = '',
                   $ensure                  = present ) {
 
-    if $hashed_control_password == '' and $ensure != 'absent' {
+    if $cookie_authentication == '0' and $hashed_control_password == '' and $ensure != 'absent' {
       fail("You need to define the tor control password")
     }
+
+    if $cookie_authentication == 0 and ($cookie_auth_file != '' or $cookie_auth_file_group_readable != '') {
+      notice("You set a tor cookie authentication option, but do not have cookie_authentication on")
+    }
     
     concatenated_file_part { '04.control':
       dir     => $tor::daemon::snippet_dir,
index df9513a5fae1d219d092243b32b30d5a93a4ed37..7e10d4dfaba6ce76d47c68bba9f1533e4ae8e03e 100644 (file)
@@ -1,6 +1,16 @@
 # tor controller
 <%- if port != '0' then -%>
 ControlPort <%= port %>
+<%- if cookie_authentication != '0' then -%>
+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 -%>