summaryrefslogtreecommitdiff
path: root/manifests/daemon.pp
blob: 7b28cd48b5c2c5aded975dc8491f3cbc673b269b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class tor::daemon inherits tor::polipo {

  group { "debian-tor":
    ensure    => present,
    allowdupe => false,
  }

  Package[ "tor", "torsocks" ] {
    require => File["/var/tor"],
  }

  user { "debian-tor":
    allowdupe => false,
    comment   => "tor user,,,",
    ensure    => present,
    home      => "/var/tor",
    shell     => "/bin/sh",
    gid       => "debian-tor",
    require   => Group["debian-tor"], 
  }

  file { "/var/tor":
    ensure  => directory,
    mode    => 0755,
    owner   => debian-tor,
    group   => debian-tor,
    require => User["debian-tor"],
  }

  define config( $socks_port = 9050,
                 $socks_listen_addresses = [ '127.0.0.1' ],
                 $socks_policies = [ 'accept 127.0.0.1/16', 'reject *' ],
                 $log_rules = [ 'notice file /var/log/tor/notices.log' ],
                 $data_directory = '/var/tor',
                 $control_port = 0,
                 $hashed_control_password = '',
                 $hidden_services = [],
                 $or_port = 0,
                 $or_listen_address = '',
                 $nickname = '',
                 $address = $hostname,
                 $relay_bandwidth_rate = 0,  # KB/s, 0 for no limit.
                 $relay_bandwidth_burst = 0, # KB/s, 0 for no limit.
                 $accounting_max = 0,       # GB, 0 for no limit.
                 $accounting_start = [],
                 $contact_info = '',
                 $dir_port = 0,
                 $dir_listen_address = '',
                 $dir_port_front_page = '',
                 $my_family = '',
                 $exit_policies = [],
                 $bridge_relay = 0) {

    file { "/etc/tor/torrc":
      ensure  => present,
      content => template('tor/torrc.erb'),
      owner   => root,
      group   => root,
      mode    => 0644,
      notify  => Service["tor"],
    }
  }

}