Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for ControlPort setting #7

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 46 additions & 27 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@
# Administrative contact information for server.
# Default: none
#
# [*controlport*]
# The port on which Tor will listen for local connections from Tor
# controller applications.
# If you enable the controlport, be sure to set hashedcontrolpassword or
# cookieauthentication as well.
# Default: none
#
# [*hashedcontrolpassword*]
# Set hashed password to access the controlport.
# Default: none
#
# [*cookieauthentication*]
# Enable cookie authentication to access the controlport.
# Can be set to 1 to be enabled.
# Default: none
#
# [*dirportfrontpage*]
# When this option is set, it takes an HTML file and publishes it as "/" on
# the DirPort. Now relay operators can provide a disclaimer without needing
Expand Down Expand Up @@ -178,35 +194,38 @@
# Copyright (C) 2012 Mike Arnold, unless otherwise noted.
#
class tor (
$socksport = $tor::params::socksport,
$sockspolicy = $tor::params::sockspolicy,
$orport = $tor::params::orport,
$address = $tor::params::address,
$outboundbindaddress = $tor::params::outboundbindaddress,
$nickname = $tor::params::nickname,
$myfamily = $tor::params::myfamily,
$bandwidthrate = $tor::params::bandwidthrate,
$bandwidthburst = $tor::params::bandwidthburst,
$numcpus = $tor::params::numcpus,
$contactinfo = $tor::params::contactinfo,
$dirport = $tor::params::dirport,
$dirportfrontpage = $tor::params::dirportfrontpage,
$exitpolicy = $tor::params::exitpolicy,
$socksport = $tor::params::socksport,
$sockspolicy = $tor::params::sockspolicy,
$orport = $tor::params::orport,
$address = $tor::params::address,
$outboundbindaddress = $tor::params::outboundbindaddress,
$nickname = $tor::params::nickname,
$myfamily = $tor::params::myfamily,
$bandwidthrate = $tor::params::bandwidthrate,
$bandwidthburst = $tor::params::bandwidthburst,
$numcpus = $tor::params::numcpus,
$contactinfo = $tor::params::contactinfo,
$controlport = $tor::params::controlport,
$hashedcontrolpassword = $tor::params::hashedcontrolpassword,
$cookieauthentication = $tor::params::cookieauthentication,
$dirport = $tor::params::dirport,
$dirportfrontpage = $tor::params::dirportfrontpage,
$exitpolicy = $tor::params::exitpolicy,

$yum_server = $tor::params::yum_server,
$yum_path = $tor::params::yum_path,
$yum_priority = $tor::params::yum_priority,
$yum_protect = $tor::params::yum_protect,
$yum_server = $tor::params::yum_server,
$yum_path = $tor::params::yum_path,
$yum_priority = $tor::params::yum_priority,
$yum_protect = $tor::params::yum_protect,

$ensure = $tor::params::ensure,
$autoupgrade = $tor::params::safe_autoupgrade,
$package_name = $tor::params::package_name,
$file_name = $tor::params::file_name,
$service_ensure = $tor::params::service_ensure,
$service_name = $tor::params::service_name,
$service_enable = $tor::params::safe_service_enable,
$service_hasrestart = $tor::params::safe_service_hasrestart,
$service_hasstatus = $tor::params::service_hasstatus
$ensure = $tor::params::ensure,
$autoupgrade = $tor::params::safe_autoupgrade,
$package_name = $tor::params::package_name,
$file_name = $tor::params::file_name,
$service_ensure = $tor::params::service_ensure,
$service_name = $tor::params::service_name,
$service_enable = $tor::params::safe_service_enable,
$service_hasrestart = $tor::params::safe_service_hasrestart,
$service_hasstatus = $tor::params::service_hasstatus
) inherits tor::params {
# Validate our arrays
validate_array($socksport)
Expand Down
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
$myfamily = getvar('::tor_myfamily')
$contactinfo = getvar('::tor_contactinfo')
$dirportfrontpage = getvar('::tor_dirportfrontpage')
$controlport = getvar('::tor_controlport')
$hashedcontrolpassword = getvar('::tor_hashedcontrolpassword')
$cookieauthentication = getvar('::tor_cookieauthentication')

######################################################################

Expand Down
9 changes: 9 additions & 0 deletions templates/torrc.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ BandwidthBurst <%= @bandwidthburst %>
<% if @contactinfo -%>
ContactInfo <%= @contactinfo %>
<% end -%>
<% if @controlport -%>
ControlPort <%= @controlport %>
<%- if @hashedcontrolpassword -%>
HashedControlPassword <%= @hashedcontrolpassword %>
<%- end -%>
<%- if @cookieauthentication -%>
CookieAuthentication <%= @cookieauthentication %>
<%- end -%>
<% end -%>
<% @dirport.each do |dirportarray| -%>
DirPort <%= dirportarray %>
<% end -%>
Expand Down