summaryrefslogtreecommitdiff
path: root/puppet/modules/obfsproxy/manifests/init.pp
blob: c15a0dc8dda9f5711f1cb0f4ce13751f8c503291 (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
65
66
67
68
69
70
71
72
73
74
class obfsproxy (
  $transport,
  $port,
  $param,
  $dest_ip,
  $dest_port
){

  $user = 'obfsproxy'
  $conf = '/etc/obfsproxy/obfsproxy.conf'

  user { $user:
    ensure => present,
    system => true,
    gid    => $user,
  }

  group { $user:
    ensure => present,
    system => true,
  }

#  file { '/etc/default/obfsproxy':
#    path    => '/etc/default/obfsproxy',
#    owner   => 'root',
#    group   => 'root',
#    mode    => '0750',
#    content => template('obfsproxy/etc_default_conf.erb'),
#  }

  file { '/etc/init.d/obfsproxy':
    path      => '/etc/init.d/obfsproxy',
    ensure    => present,
    source    => 'puppet:///modules/obfsproxy/obfsproxy_daemon',
    owner     => 'root',
    group     => 'root',
    mode      => '0750',
    require   => File[$conf],
    subscribe => File[$conf],
  }

  file { $conf :
    path    => $conf,
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0600',
    content => template('obfsproxy/etc_conf.erb'),
    require => File['/etc/obfsproxy'],
  }

  file { '/etc/obfsproxy':
    ensure => directory,
    owner  => $user,
    group  => $user,
    mode   => '0700',
  }

  package { "obfsproxy":
    ensure => present,
  }

  service { "obfsproxy":
    ensure  => running,
    status  => '/usr/sbin/service obfsproxy status
                | grep "is running"',
    require => [
      Package["obfsproxy"],
      File["/etc/init.d/obfsproxy"] ]
  }


}