| LEFT | RIGHT |
| 1 class filtermaster { | 1 class filtermaster { |
| 2 Cron { | 2 Cron { |
| 3 #TODO: Change The MAILTO to the correct paramater befor commiting | 3 #TODO change email |
| 4 environment => ['MAILTO=ROOT', 'PYTHONPATH=/opt/sitescripts'], | 4 environment => ['MAILTO=root', 'PYTHONPATH=/opt/sitescripts'], |
| 5 } | 5 } |
| 6 » | 6 |
| 7 class {'ssh': | 7 class {'ssh': |
| 8 custom_configuration => 'Match User rsync | 8 custom_configuration => 'Match User rsync |
| 9 AllowTcpForwarding no | 9 AllowTcpForwarding no |
| 10 X11Forwarding no | 10 X11Forwarding no |
| 11 AllowAgentForwarding no | 11 AllowAgentForwarding no |
| 12 GatewayPorts no | 12 GatewayPorts no |
| 13 ForceCommand rsync --server --sender -vltprz --delete-excluded . /home/rsync
/subscriptions/files/subscriptions' | 13 ForceCommand rsync --server --sender -vltprz --delete-excluded . /home/rsync
/generated/data/' |
| 14 } | 14 } |
| 15 | 15 |
| 16 user {'rsync': | 16 user {'rsync': |
| 17 ensure => present, | 17 ensure => present, |
| 18 comment => 'Filter list mirror user', | 18 comment => 'Filter list mirror user', |
| 19 home => '/home/rsync', | 19 home => '/home/rsync', |
| 20 managehome => true | 20 managehome => true |
| 21 } | 21 } |
| 22 » | 22 |
| 23 file {'/home/rsync/update_repos.sh': |
| 24 ensure => file, |
| 25 owner => rsync, |
| 26 mode => 0700, |
| 27 source => 'puppet:///modules/filtermaster/update_repos.sh' |
| 28 } |
| 29 |
| 30 file {'/home/rsync/subscription': |
| 31 ensure => directory, |
| 32 owner => rsync |
| 33 } |
| 34 |
| 35 file {'/home/rsync/generated': |
| 36 ensure => directory, |
| 37 owner => rsync |
| 38 } |
| 39 |
| 23 file {'/home/rsync/.ssh': | 40 file {'/home/rsync/.ssh': |
| 24 ensure => directory, | 41 ensure => directory, |
| 25 require => User['rsync'], | |
| 26 owner => rsync, | 42 owner => rsync, |
| 27 mode => 0600 | 43 mode => 0600 |
| 28 } | 44 } |
| 29 » | 45 |
| 30 file {'/home/rsync/.ssh/authorized_keys': | 46 file {'/home/rsync/.ssh/authorized_keys': |
| 31 ensure => file, | 47 ensure => file, |
| 32 require => [ | |
| 33 File['/home/rsync/.ssh'], | |
| 34 User['rsync'] | |
| 35 ], | |
| 36 owner => rsync, | 48 owner => rsync, |
| 37 mode => 0600, | 49 mode => 0600, |
| 38 source => 'puppet:///modules/filtermaster/authorized_keys' | 50 source => 'puppet:///modules/private/rsync@easylist-downloads.adblockplus.or
g.pub' |
| 39 } | 51 } |
| 40 | 52 |
| 41 define repo_download( ) { | 53 file {'/etc/ssh/ssh_host_rsa_key': |
| 42 exec { "fetch_${title}": | 54 require => Package['openssh-server'], |
| 43 command => "hg clone https://hg.adblockplus.org/${title} /home/rsync/subs
cription/${title}", | 55 notify => Service['ssh'], |
| 56 ensure => file, |
| 57 owner => root, |
| 58 group => root, |
| 59 source => 'puppet:///modules/private/filtermaster.adblockplus.org_ssh.key' |
| 60 } |
| 61 |
| 62 file {'/etc/ssh/ssh_host_rsa_key.pub': |
| 63 require => Package['openssh-server'], |
| 64 notify => Service['ssh'], |
| 65 ensure => file, |
| 66 owner => root, |
| 67 group => root, |
| 68 source => 'puppet:///modules/private/filtermaster.adblockplus.org_ssh.pub' |
| 69 } |
| 70 |
| 71 package {['p7zip-full']:} |
| 72 |
| 73 define repo_download() { |
| 74 exec {"fetch_${title}": |
| 75 command => "hg clone https://hg.adblockplus.org/${title} /home/rsync/subsc
ription/${title}", |
| 44 path => ["/usr/bin/", "/bin/"], | 76 path => ["/usr/bin/", "/bin/"], |
| 45 require => Package['mercurial'], | 77 require => Package['mercurial'], |
| 46 user => rsync, | 78 user => rsync, |
| 47 timeout => 0, | 79 timeout => 0, |
| 48 onlyif => "test ! -d /home/rsync/subscription/${title}" | 80 onlyif => "test ! -d /home/rsync/subscription/${title}" |
| 49 } | 81 } |
| 50 } | 82 } |
| 51 | 83 |
| 52 repo_download {['easylist', | 84 repo_download {['easylist', |
| 53 » » 'easylistgermany', | 85 'easylistgermany', |
| 54 » » 'easylistitaly', | 86 'easylistitaly', |
| 55 » » 'easylistcombinations', | 87 'easylistcombinations', |
| 56 » » 'malwaredomains', | 88 'malwaredomains', |
| 57 » » 'ruadlist', | 89 'ruadlist', |
| 58 » » 'listefr', | 90 'listefr', |
| 59 » » 'exceptionrules', | 91 'exceptionrules', |
| 60 » » 'easylistdutch', | 92 'easylistdutch', |
| 61 » » 'facebookfilters', | 93 'facebookfilters', |
| 62 » » 'antiadblockfilters' | 94 'antiadblockfilters' |
| 63 » » ]: | 95 ]: |
| 64 } | 96 } |
| 65 | 97 |
| 66 cron {'update_subscription': | 98 cron {'update_subscription': |
| 67 ensure => present, | 99 ensure => present, |
| 68 command => "python -m sitescripts.subscriptions.bin.updateSubscriptionDownlo
ads 3>&1 1>/dev/null 2>&3 | perl -pe 's/^/\"[\" . scalar localtime() . \"] \"/e'
>> /tmp/subscription_errors && chmod 666 /tmp/subscription_errors 2>/dev/null", | 100 command => "python -m sitescripts.subscriptions.bin.updateSubscriptionDownlo
ads 3>&1 1>/dev/null 2>&3 | perl -pe 's/^/\"[\" . scalar localtime() . \"] \"/e'
>> /tmp/subscription_errors && chmod 666 /tmp/subscription_errors 2>/dev/null", |
| 69 user => rsync, | 101 user => rsync, |
| 70 require => [ | 102 require => User['rsync'], |
| 71 User['rsync'] | 103 minute => '*/10' |
| 72 ], | |
| 73 minute => '*/10' | |
| 74 } | 104 } |
| 75 » » | 105 |
| 76 cron {'update_malware': | 106 cron {'update_malware': |
| 77 ensure => present, | 107 ensure => present, |
| 78 command => "python -m sitescripts.subscriptions.bin.updateMalwareDomainsList
", | 108 command => "python -m sitescripts.subscriptions.bin.updateMalwareDomainsList
", |
| 79 user => rsync, | 109 user => rsync, |
| 110 require => User['rsync'], |
| 111 hour => '*/6', |
| 112 minute => 15 |
| 113 } |
| 114 |
| 115 cron {'update_repos': |
| 116 ensure => present, |
| 117 command => "/home/rsync/update_repos.sh", |
| 118 user => rsync, |
| 80 require => [ | 119 require => [ |
| 81 User['rsync'] | 120 User['rsync'], |
| 121 File['/home/rsync/update_repos.sh'] |
| 82 ], | 122 ], |
| 83 hour => '*/6', | 123 minute => '8-58/10' |
| 84 minute => 15 | |
| 85 } | 124 } |
| 86 | 125 |
| 87 class {'sitescripts': | 126 class {'sitescripts': |
| 88 sitescriptsini_source => 'puppet:///modules/filtermaster/sitescripts' | 127 sitescriptsini_source => 'puppet:///modules/filtermaster/sitescripts' |
| 89 } | 128 } |
| 90 }» | 129 } |
| LEFT | RIGHT |