]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blame - modules/base_configuration/manifests/init.pp
Add missing services
[perso/Immae/Projets/Puppet.git] / modules / base_configuration / manifests / init.pp
CommitLineData
f860f6d2
IB
1class base_configuration (
2 $hostname = undef,
3 $username = "immae",
4 $userid = 1000
5) {
87f0ebb7
IB
6 service { "sshd":
7 ensure => "running",
8 enable => true,
9 }
10 service { "systemd-networkd.socket":
11 ensure => "running",
12 enable => true,
13 }
14 service { "systemd-networkd":
15 ensure => "running",
16 enable => true,
17 }
18
f860f6d2
IB
19 unless empty($hostname) {
20 class { 'systemd::hostname':
21 hostname => $hostname
22 }
23 }
24
25 user { "${username}:${userid}":
26 name => $username,
27 uid => $userid,
28 ensure => "present",
29 groups => "wheel",
30 managehome => true,
31 notify => Exec["remove_password"]
32 }
33
34 exec { "remove_password":
35 command => "/usr/bin/chage -d 0 $username && /usr/bin/passwd -d $username",
36 refreshonly => true
37 }
38
39 ssh_authorized_key { $username:
40 name => "immae@immae.eu",
41 user => $username,
42 type => "ssh-rsa",
43 key => "AAAAB3NzaC1yc2EAAAADAQABAAABAQDi5PgLBwMRyRwzJPnSgUyRAuB9AAxMijsw1pR/t/wmxQne1O5fIPOleHx+D8dyZbwm+XkzlcJpgT0Qy3qC9J8BPhshJvO/tA/8CI/oS/FE0uWsyACH1DMO2dk4gRRZGSE9IuzDMRPlnfZ3n0tdsPzzv3GH4It/oPIgsvkTowKztGLQ7Xmjr5BxzAhXcIQymqA0U3XWHSdWvnSRDaOFG0PDoVMS85IdwlviVKLnV5Sstb4NC/P28LFfgvW8DO/XrOqujgDomqTmR41dK/AyrGGOb2cQUMO4l8Oa+74aOyKaB61rr/rJkr+wCbEttkTvgFa6zZygSk3edfiWE2rgn4+v"
44 }
45
46 class { 'sudo':
47 config_file_replace => false
48 }
49
50 sudo::conf { 'wheel':
51 priority => 10,
52 content => "%wheel ALL=(ALL) ALL"
53 }
54
55 class { 'ssh::server':
56 storeconfigs_enabled => false,
57 options => {
58 'AcceptEnv' => undef,
59 'X11Forwarding' => 'yes',
60 'PrintMotd' => 'no',
61 'ChallengeResponseAuthentication' => 'no',
62 'Subsystem' => 'sftp /usr/lib/openssh/sftp-server',
63 }
64 }
8ed6fb29
IB
65
66 class { 'pacman':
87f0ebb7
IB
67 color => true,
68 usesyslog => true,
8ed6fb29
IB
69 }
70
71 pacman::repo { 'multilib':
72 order => 15,
73 include => '/etc/pacman.d/mirrorlist'
74 }
a37e5d7a 75
91a2b30d
IB
76 class { '::logrotate':
77 manage_cron_daily => false,
78 config => {
79 rotate_every => 'week',
80 rotate => 4,
81 create => true,
82 compress => true,
83 olddir => '/var/log/old',
84 tabooext => "+ .pacorig .pacnew .pacsave",
85 }
86 }
87
88 logrotate::rule { 'wtmp':
89 path => '/var/log/wtmp',
90 rotate_every => 'month',
91 create => true,
92 create_mode => '0664',
93 create_owner => 'root',
94 create_group => 'utmp',
95 rotate => '1',
96 minsize => '1M',
97 }
98 logrotate::rule { 'btmp':
99 path => '/var/log/btmp',
100 missingok => true,
101 rotate_every => 'month',
102 create => true,
103 create_mode => '0600',
104 create_owner => 'root',
105 create_group => 'utmp',
106 rotate => '1',
107 }
108
a37e5d7a
IB
109 ensure_packages(["whois"], { 'install_options' => '--asdeps' })
110 class { 'fail2ban':
111 logtarget => 'SYSLOG',
112 backend => 'systemd'
113 }
114 fail2ban::jail { 'sshd':
115 backend => 'systemd',
116 port => 'ssh',
117 filter => 'sshd',
118 maxretry => 10,
119 bantime => 86400,
120 logpath => '',
121 order => 10
122 }
f860f6d2 123}