Defined Type: tor::instance

Defined in:
modules/tor/manifests/instance.pp

Overview

sets up additional Tor instances needs Tor >= 0.2.7.4-rc-1

Parameters:

  • address (Stdlib::Host)
  • nickname (String)
  • contact (String)
  • controlport (Stdlib::Port)
  • controlpassword (String)
  • orport (Stdlib::Port)
  • dirport (Stdlib::Port)
  • exit_policy (String)
  • fingerprints (Array[String])


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
# File 'modules/tor/manifests/instance.pp', line 3

define tor::instance(
    Stdlib::Host $address,
    String $nickname,
    String $contact,
    Stdlib::Port $controlport,
    String $controlpassword,
    Stdlib::Port $orport,
    Stdlib::Port $dirport,
    String $exit_policy,
    Array[String] $fingerprints,
) {

    if $name == 'default' {
        fail('The default name is reserved for /etc/tor/torrc')
    }

    $config = "/etc/tor/instances/${name}/torrc"

    exec { "tor-instance-${name}":
        command => "/usr/sbin/tor-instance-create ${name}",
        creates => $config,
        require => Package['tor'],
        before  => File[$config],
    }

    $family = join($fingerprints, ',')

    file { $config:
        ensure  => 'present',
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => template('tor/torrc.erb'),
        require => Package['tor'],
    }

    File[$config] ~> Exec['tor-systemd-reload'] ~> Service['tor']
}