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
|
# extend basic tor things with a snippet based daemon configuration
class tor::daemon::base inherits tor::base {
include ::tor::daemon::params
if $tor::daemon::params::manage_user {
group { $tor::daemon::params::group:
ensure => present,
allowdupe => false,
}
user { $tor::daemon::params::user:
ensure => present,
allowdupe => false,
comment => 'tor user,,,',
home => $tor::daemon::data_dir,
shell => '/bin/false',
gid => $tor::daemon::params::group,
require => Group[$tor::daemon::params::group],
}
}
# directories
file { $tor::daemon::data_dir:
ensure => directory,
mode => $tor::daemon::params::data_dir_mode,
owner => $tor::daemon::params::user,
group => 'root',
require => Package['tor'],
}
file { '/etc/tor':
ensure => directory,
mode => '0755',
owner => 'root',
group => 'root',
require => Package['tor'],
}
# tor configuration file
concat { $tor::daemon::config_file:
mode => '0640',
owner => 'root',
group => $tor::daemon::params::group,
require => Package['tor'],
notify => Service['tor'],
}
# config file headers
concat::fragment { '00.header':
ensure => present,
content => template('tor/torrc.header.erb'),
order => '00',
target => $tor::daemon::config_file,
}
# global configurations
concat::fragment { '01.global':
content => template('tor/torrc.global.erb'),
order => '01',
target => $tor::daemon::config_file,
}
}
|