
Run it whenever there is a change to the YAML channel config. The script will ensure everyone listed in global has those perms and anyone else found with access on a channel will be left as-is except that their access will be limited to the relevant mask. Move it and the previous change to add a permission checking script into a new module, 'accessbot'. Support SSL in both scripts. Add a 1 second sleep in the check script to avoid flood protection. Add all known channels to the channel config. Closes-Bug: 1190296 Change-Id: I5072cb56ae83a70f4fa955362b8db909b2956d70
75 lines
1.8 KiB
Puppet
75 lines
1.8 KiB
Puppet
# == Class: accessbot
|
|
#
|
|
class accessbot(
|
|
$nick = '',
|
|
$password = '',
|
|
$server = '',
|
|
$channel_file = '',
|
|
) {
|
|
|
|
user { 'accessbot':
|
|
ensure => present,
|
|
home => '/home/accessbot',
|
|
shell => '/bin/bash',
|
|
gid => 'accessbot',
|
|
managehome => true,
|
|
require => Group['accessbot'],
|
|
}
|
|
|
|
group { 'accessbot':
|
|
ensure => present,
|
|
}
|
|
|
|
exec { 'run_accessbot' :
|
|
command => '/usr/local/bin/accessbot -c /etc/accessbot/accessbot.config -l /etc/accessbot/channels.yaml >> /var/log/accessbot/accessbot.log 2>&1',
|
|
path => '/usr/local/bin:/usr/bin:/bin/',
|
|
refreshonly => true,
|
|
subscribe => File['/etc/accessbot/channels.yaml'],
|
|
require => [File['/etc/accessbot/channels.yaml'],
|
|
File['/etc/accessbot/accessbot.config'],
|
|
File['/usr/local/bin/accessbot']],
|
|
}
|
|
|
|
file { '/etc/accessbot':
|
|
ensure => directory,
|
|
}
|
|
|
|
file { '/var/log/accessbot':
|
|
ensure => directory,
|
|
owner => 'accessbot',
|
|
group => 'accessbot',
|
|
mode => '0775',
|
|
require => User['accessbot'],
|
|
}
|
|
|
|
file { '/etc/accessbot/accessbot.config':
|
|
ensure => present,
|
|
content => template('accessbot/accessbot.config.erb'),
|
|
group => 'accessbot',
|
|
mode => '0440',
|
|
owner => 'root',
|
|
replace => true,
|
|
require => User['accessbot'],
|
|
}
|
|
|
|
file { '/etc/accessbot/channels.yaml':
|
|
ensure => present,
|
|
source => $channel_file,
|
|
group => 'accessbot',
|
|
mode => '0440',
|
|
owner => 'root',
|
|
replace => true,
|
|
require => User['accessbot'],
|
|
}
|
|
|
|
file { '/usr/local/bin/accessbot':
|
|
ensure => present,
|
|
source => 'puppet:///modules/accessbot/files/accessbot.py',
|
|
group => 'accessbot',
|
|
mode => '0440',
|
|
owner => 'root',
|
|
replace => true,
|
|
require => User['accessbot'],
|
|
}
|
|
}
|