summaryrefslogtreecommitdiff
path: root/manifests/daemon/relay.pp
blob: ff528937fe35605b58b0ee60a85f9d242da71556 (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
# relay definition
define tor::daemon::relay(
  $port                    = 0,
  $listen_addresses        = [],
  $outbound_bindaddresses  = [],
  $portforwarding          = 0,
  # KB/s, defaulting to using tor's default: 5120KB/s
  $bandwidth_rate          = '',
  # KB/s, defaulting to using tor's default: 10240KB/s
  $bandwidth_burst         = '',
  # KB/s, 0 for no limit
  $relay_bandwidth_rate    = 0,
  # KB/s, 0 for no limit
  $relay_bandwidth_burst   = 0,
  # GB, 0 for no limit
  $accounting_max          = 0,
  $accounting_start        = [],
  $contact_info            = '',
  # TODO: autofill with other relays
  $my_family               = '',
  $address                 = "tor.${::domain}",
  $bridge_relay            = 0,
  $ensure                  = present ) {

  $nickname = $name

  if $outbound_bindaddresses == [] {
    $real_outbound_bindaddresses = []
  } else {
    $real_outbound_bindaddresses = $outbound_bindaddresses
  }

  concat::fragment { '03.relay':
    ensure  => $ensure,
    content => template('tor/torrc.relay.erb'),
    owner   => 'debian-tor',
    group   => 'debian-tor',
    mode    => '0644',
    order   => 03,
    target  => $tor::daemon::config_file,
  }
}