2016-10-17 04:05:49 +02:00
|
|
|
class zulip_ops::base {
|
2013-11-01 20:28:03 +01:00
|
|
|
include zulip::base
|
2016-10-17 04:17:45 +02:00
|
|
|
include zulip::apt_repository
|
2013-10-29 23:53:04 +01:00
|
|
|
|
2013-11-08 20:58:48 +01:00
|
|
|
$org_base_packages = [# Management for our systems
|
|
|
|
"openssh-server",
|
|
|
|
"mosh",
|
2016-07-23 00:46:00 +02:00
|
|
|
# package management
|
|
|
|
"aptitude",
|
2016-07-22 01:10:03 +02:00
|
|
|
# SSL Certificates
|
|
|
|
"letsencrypt",
|
2013-11-08 20:58:48 +01:00
|
|
|
# Monitoring
|
|
|
|
"munin-node",
|
|
|
|
"munin-plugins-extra" ,
|
|
|
|
# Security
|
|
|
|
"iptables-persistent",
|
|
|
|
# For managing our current Debian packages
|
|
|
|
"debian-goodies",
|
2016-08-13 02:18:02 +02:00
|
|
|
# Needed for zulip-ec2-configure-network-interfaces
|
2017-08-04 02:00:13 +02:00
|
|
|
"python3-six",
|
2016-08-13 02:18:02 +02:00
|
|
|
"python-six",
|
2017-08-04 02:00:13 +02:00
|
|
|
# "python3-boto", # missing on trusty
|
2017-08-11 01:29:47 +02:00
|
|
|
"python-boto", # needed for postgres_common too
|
2017-08-04 02:00:13 +02:00
|
|
|
"python3-netifaces",
|
2013-11-08 20:58:48 +01:00
|
|
|
"python-netifaces",
|
2015-12-26 05:31:06 +01:00
|
|
|
# Popular editors
|
|
|
|
"vim",
|
2016-07-19 03:31:34 +02:00
|
|
|
"emacs-nox",
|
2015-12-26 05:31:06 +01:00
|
|
|
"puppet-el",
|
|
|
|
# Prevent accidental reboots
|
|
|
|
"molly-guard",
|
|
|
|
# Useful tools in a production environment
|
|
|
|
"screen",
|
|
|
|
"strace",
|
|
|
|
"host",
|
|
|
|
"git",
|
2016-08-01 01:46:58 +02:00
|
|
|
"nagios-plugins-contrib",
|
2013-11-07 23:51:05 +01:00
|
|
|
]
|
2013-10-29 23:53:04 +01:00
|
|
|
package { $org_base_packages: ensure => "installed" }
|
|
|
|
|
2016-07-21 07:56:00 +02:00
|
|
|
# Add system users here
|
|
|
|
$users = []
|
|
|
|
|
2016-08-03 21:53:03 +02:00
|
|
|
# Add hosts to monitor here
|
|
|
|
$hosts = []
|
|
|
|
|
2013-11-10 15:32:54 +01:00
|
|
|
file { '/etc/apt/apt.conf.d/02periodic':
|
|
|
|
ensure => file,
|
|
|
|
mode => 644,
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/apt/apt.conf.d/02periodic',
|
2013-11-10 15:32:54 +01:00
|
|
|
}
|
|
|
|
|
2016-08-19 17:27:17 +02:00
|
|
|
file { '/etc/apt/apt.conf.d/50unattended-upgrades':
|
|
|
|
ensure => file,
|
|
|
|
mode => 644,
|
|
|
|
source => 'puppet:///modules/zulip_ops/apt/apt.conf.d/50unattended-upgrades',
|
|
|
|
}
|
|
|
|
|
2013-10-29 23:53:04 +01:00
|
|
|
file { '/home/zulip/.ssh/authorized_keys':
|
|
|
|
ensure => file,
|
|
|
|
require => File['/home/zulip/.ssh'],
|
|
|
|
mode => 600,
|
|
|
|
owner => "zulip",
|
|
|
|
group => "zulip",
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/authorized_keys',
|
2013-10-29 23:53:04 +01:00
|
|
|
}
|
|
|
|
file { '/home/zulip/.ssh':
|
|
|
|
ensure => directory,
|
|
|
|
require => User['zulip'],
|
|
|
|
owner => "zulip",
|
|
|
|
group => "zulip",
|
|
|
|
mode => 600,
|
|
|
|
}
|
|
|
|
|
2016-09-26 19:22:45 +02:00
|
|
|
file { '/etc/pam.d/common-session':
|
|
|
|
require => Package['openssh-server'],
|
|
|
|
ensure => file,
|
|
|
|
source => 'puppet:///modules/zulip_ops/common-session',
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => 644,
|
|
|
|
}
|
|
|
|
|
2013-11-07 23:45:07 +01:00
|
|
|
file { '/etc/ssh/sshd_config':
|
|
|
|
require => Package['openssh-server'],
|
|
|
|
ensure => file,
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/sshd_config',
|
2013-11-07 23:45:07 +01:00
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => 644,
|
|
|
|
}
|
|
|
|
|
|
|
|
service { 'ssh':
|
|
|
|
ensure => running,
|
|
|
|
subscribe => File['/etc/ssh/sshd_config'],
|
|
|
|
}
|
|
|
|
|
2016-07-31 05:45:09 +02:00
|
|
|
file { '/root/.emacs':
|
|
|
|
ensure => file,
|
|
|
|
mode => 600,
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
|
|
|
source => 'puppet:///modules/zulip_ops/dot_emacs.el',
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/home/zulip/.emacs':
|
|
|
|
ensure => file,
|
|
|
|
mode => 600,
|
|
|
|
owner => "zulip",
|
|
|
|
group => "zulip",
|
|
|
|
source => 'puppet:///modules/zulip_ops/dot_emacs.el',
|
|
|
|
require => User['zulip'],
|
|
|
|
}
|
|
|
|
|
2013-10-29 23:53:04 +01:00
|
|
|
file { '/root/.ssh/authorized_keys':
|
|
|
|
ensure => file,
|
|
|
|
mode => 600,
|
|
|
|
owner => "root",
|
|
|
|
group => "root",
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/root_authorized_keys',
|
2013-10-29 23:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/usr/local/sbin/zulip-ec2-configure-interfaces':
|
|
|
|
ensure => file,
|
|
|
|
mode => 755,
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/zulip-ec2-configure-interfaces',
|
2013-10-29 23:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/network/if-up.d/zulip-ec2-configure-interfaces_if-up.d.sh':
|
|
|
|
ensure => file,
|
|
|
|
mode => 755,
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/zulip-ec2-configure-interfaces_if-up.d.sh',
|
2013-10-29 23:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
group { 'nagios':
|
|
|
|
ensure => present,
|
|
|
|
gid => '1050',
|
|
|
|
}
|
|
|
|
user { 'nagios':
|
|
|
|
ensure => present,
|
|
|
|
uid => '1050',
|
|
|
|
gid => '1050',
|
|
|
|
shell => '/bin/bash',
|
|
|
|
home => '/var/lib/nagios',
|
|
|
|
managehome => true,
|
|
|
|
}
|
|
|
|
file { '/var/lib/nagios/':
|
|
|
|
ensure => directory,
|
|
|
|
require => User['nagios'],
|
|
|
|
owner => "nagios",
|
|
|
|
group => "nagios",
|
|
|
|
mode => 600,
|
|
|
|
}
|
|
|
|
file { '/var/lib/nagios/.ssh':
|
|
|
|
ensure => directory,
|
|
|
|
require => File['/var/lib/nagios/'],
|
|
|
|
owner => "nagios",
|
|
|
|
group => "nagios",
|
|
|
|
mode => 600,
|
|
|
|
}
|
|
|
|
file { '/var/lib/nagios/.ssh/authorized_keys':
|
|
|
|
ensure => file,
|
|
|
|
require => File['/var/lib/nagios/.ssh'],
|
|
|
|
mode => 600,
|
|
|
|
owner => "nagios",
|
|
|
|
group => "nagios",
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/nagios_authorized_keys',
|
2013-10-29 23:53:04 +01:00
|
|
|
}
|
|
|
|
file { '/home/nagios':
|
|
|
|
ensure => absent,
|
|
|
|
force => true,
|
|
|
|
recurse => true,
|
|
|
|
}
|
2013-11-22 23:25:34 +01:00
|
|
|
file { '/etc/iptables/rules.v4':
|
2013-11-07 23:47:23 +01:00
|
|
|
ensure => file,
|
|
|
|
mode => 600,
|
2016-10-17 04:05:49 +02:00
|
|
|
content => template('zulip_ops/iptables/rules.v4.erb'),
|
2013-11-07 23:47:23 +01:00
|
|
|
require => Package['iptables-persistent'],
|
|
|
|
}
|
2016-07-19 03:41:27 +02:00
|
|
|
service { 'netfilter-persistent':
|
2013-11-07 23:47:23 +01:00
|
|
|
ensure => running,
|
|
|
|
|
|
|
|
# Because there is no running process for this service, the normal status
|
|
|
|
# checks fail. Because puppet then thinks the service has been manually
|
|
|
|
# stopped, it won't restart it. This fake status command will trick puppet
|
|
|
|
# into thinking the service is *always* running (which in a way it is, as
|
|
|
|
# iptables is part of the kernel.)
|
|
|
|
hasstatus => true,
|
|
|
|
status => "/bin/true",
|
|
|
|
|
|
|
|
# Under Debian, the "restart" parameter does not reload the rules, so tell
|
|
|
|
# Puppet to fall back to stop/start, which does work.
|
|
|
|
hasrestart => false,
|
|
|
|
|
2016-07-19 03:41:27 +02:00
|
|
|
require => Package['iptables-persistent'],
|
2013-11-22 23:25:34 +01:00
|
|
|
subscribe => File['/etc/iptables/rules.v4'],
|
2013-11-07 23:47:23 +01:00
|
|
|
}
|
2013-10-29 23:53:04 +01:00
|
|
|
}
|