-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment-server.ntlm.pp
468 lines (394 loc) · 15.2 KB
/
deployment-server.ntlm.pp
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# manifest for Debian deployment server
# Suppression des accents pour simplification conversion d'encodage
# Convertion (ISO-8859-1) -> (UTF-8)
# Inutile - Réalisé par défaut dans l'image debian/bullseye64
# Raccourcissement du timeout de GRUB
#exec { 'update-grub':
# command => '/usr/sbin/update-grub',
# refreshonly => true
#}
#file_line { 'reduce_grub_timeout':
# path => '/etc/default/grub',
# line => 'GRUB_TIMEOUT=1',
# match => 'GRUB_TIMEOUT',
# notify => Exec['update-grub'],
#}
# Inutile - Réalisé par défaut dans l'image debian/bullseye64
# Conservervation du nommage des interfaces à l'ancienne type "eth0": net.ifnames=0
#file_line { 'ifnames':
# path => '/etc/default/grub',
# line => 'GRUB_CMDLINE_LINUX="net.ifnames=0"',
# match => 'GRUB_CMDLINE_LINUX=',
# notify => Exec['update-grub'],
#}
# Network tools
package { 'net-tools': ensure => 'latest' } # netstat
package { 'iftop': ensure => 'latest' }
# System tools
package { 'htop': ensure => 'latest' }
# NTLM proxy
package { 'cntlm': ensure => 'latest' }
exec { 'cntlm-restart':
command => '/bin/systemctl restart cntlm.service',
refreshonly => true
}
# cntlm pour authentification proxy externe
#
# 1) Proxy MyFuckingProxy.local:8080
# 2) Only for user 'MyAccount', domain 'MyDomain' (à reprendre)
# PassLM 1XXXXF6F2E01598405B94E52DC3F363F
# PassNT 2XXXX73431190218ABF2E2F0859710C0
# PassNTLMv2 3XXXX99FF59506E8F62FD48521BD44BF
# 3) Gateway yes
$cntlm_content = "#
# Cntlm Authentication Proxy Configuration
#
# NOTE: all values are parsed literally, do NOT escape spaces,
# do not quote. Use 0600 perms if you use plaintext password.
#
Username MyAccount
Domain MyDomain
#Password password
# NOTE: Use plaintext password only at your own risk
# Use hashes instead. You can use a \"cntlm -M\" and \"cntlm -H\"
# command sequence to get the right config for your environment.
# See cntlm man page
# Example secure config shown below.
PassLM 11A0CF6F2E0159845269D21060F49ECE
PassNT Q4A48F6950834B3D65003C158BAACA50
PassNTLMv2 6DA919CC1EFE5BC1FD26945525F63F12 # Only for user 'MyAccount', domain 'MyDomain'
# Specify the netbios hostname cntlm will send to the parent
# proxies. Normally the value is auto-guessed.
#
# Workstation netbios_hostname
# List of parent proxies to use. More proxies can be defined
# one per line in format <proxy_ip>:<proxy_port>
#
Proxy MyFuckingProxy.local:8080
# List addresses you do not want to pass to parent proxies
# * and ? wildcards can be used
#
NoProxy localhost, 127.0.0.*, 10.*, 192.168.*, *.MyCompagny.com
# Specify the port cntlm will listen on
# You can bind cntlm to specific interface by specifying
# the appropriate IP address also in format <local_ip>:<local_port>
# Cntlm listens on 127.0.0.1:3128 by default
#
Listen 3128
# If you wish to use the SOCKS5 proxy feature as well, uncomment
# the following option. It can be used several times
# to have SOCKS5 on more than one port or on different network
# interfaces (specify explicit source address for that).
#
# WARNING: The service accepts all requests, unless you use
# SOCKS5User and make authentication mandatory. SOCKS5User
# can be used repeatedly for a whole bunch of individual accounts.
#
#SOCKS5Proxy 8010
#SOCKS5User dave:password
# Use -M first to detect the best NTLM settings for your proxy.
# Default is to use the only secure hash, NTLMv2, but it is not
# as available as the older stuff.
#
# This example is the most universal setup known to man, but it
# uses the weakest hash ever. I won't have it's usage on my
# conscience. :) Really, try -M first.
#
#Auth LM
#Flags 0x06820000
# Enable to allow access from other computers
#
Gateway yes
# Useful in Gateway mode to allow/restrict certain IPs
# Specifiy individual IPs or subnets one rule per line.
#
#Allow 127.0.0.1
#Deny 0/0
# GFI WebMonitor-handling plugin parameters, disabled by default
#
#ISAScannerSize 1024
#ISAScannerAgent Wget/
#ISAScannerAgent APT-HTTP/
#ISAScannerAgent Yum/
# Headers which should be replaced if present in the request
#
#Header User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
# Tunnels mapping local port to a machine behind the proxy.
# The format is <local_port>:<remote_host>:<remote_port>
#
#Tunnel 11443:remote.com:443
"
file { 'cntlm_conf':
path => '/etc/cntlm.conf',
ensure => present,
group => root,
owner => root,
mode => "0600",
content => $cntlm_content,
require => Package['cntlm'],
notify => Exec['cntlm-restart'],
}
# Suppression du package network-manager (configuration reseau graphique)
package { 'network-manager': ensure => 'absent' }
# DHCP + DNS
package { 'dnsmasq': ensure => 'latest' }
package { 'resolvconf': ensure => 'latest' }
# Http server
package { 'apache2': ensure => 'latest' }
# Caching Proxy for Debian Packages
package { 'apt-cacher-ng': ensure => 'latest' }
# TODO - cf. https://binfalse.de/2019/05/13/apt-cacher-ng-vs-apt-transport-https/
#package { 'apt-transport-https': ensure => 'latest' }
# todo - puppetmaster
# package { 'puppetmaster': ensure => 'latest' }
# Debian installer
package { 'debian-installer-11-netboot-amd64': ensure => 'latest' }
exec { 'networking-restart':
command => '/bin/systemctl restart networking.service',
refreshonly => true
}
exec { 'dnsmasq-restart':
command => '/bin/systemctl restart dnsmasq.service',
refreshonly => true
}
exec { 'apt-cacher-restart':
command => '/bin/systemctl restart apt-cacher-ng.service',
refreshonly => true
}
# TODO - Reprendre le proxy de /etc/apt/apt.conf positionné par le fichier preseed.cfg
# Nécessite que apt-cacher-ng soit en place ainsi que la résolution du nom apt-cacher.nursery.net
# Acquire::http::Proxy "http://apt-cacher.nursery.net:3142";
# TODO - Resoudre le problème de nommage des interfaces eth0 et eth1
$interfaces_content = "# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface (always required)
auto lo
iface lo inet loopback
# Get our IP address from any DHCP server
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
# Assign a static IP for this DHCP server through eth1:
auto eth1
allow-hotplug eth1
iface eth1 inet static
address 192.168.1.100
netmask 255.255.255.0
broadcast 192.168.1.255
"
file { 'interfaces':
path => '/etc/network/interfaces',
ensure => present,
group => root,
owner => root,
mode => "0644",
content => $interfaces_content,
notify => Exec['networking-restart'],
}
# TODO - Resoudre le problème de nommage des interfaces eth0 et eth1
$firewall_content = "#!/bin/sh
PATH=/usr/sbin:/sbin:/bin:/usr/bin
# Delete all existing rules.
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT
# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
# Masquerade.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Don't forward from the outside to the inside.
iptables -A FORWARD -i eth0 -o eth1 -j REJECT
# Enable forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward
"
file { 'firewall':
path => '/etc/network/if-up.d/00-firewall',
ensure => present,
group => root,
owner => root,
mode => "0755",
content => $firewall_content,
notify => Exec['networking-restart'],
}
file_line { 'deb-proxy puppetmaster host entry':
ensure => present,
path => '/etc/hosts',
line => '192.168.1.100 gateway deb-proxy pxe puppetmaster',
}
$dhcp_content = "# Specifies the interface to serve. - line 90
interface=eth1
# Range of IP addresses, leases - line 141
dhcp-range=192.168.1.200,192.168.1.250,24h
# Network mask
dhcp-option=1,255.255.255.0
# Gateway
dhcp-option=3,192.168.1.100
# DNS
dhcp-option=6,192.168.1.100
# Broadcast
dhcp-option=28,192.168.1.255
# Should be set when dnsmasq is definitely the only DHCP server on a network - line 515
dhcp-authoritative
"
file { 'dnsmasq_dhcp_conf':
path => '/etc/dnsmasq.d/dhcp.conf',
ensure => present,
group => root,
owner => root,
mode => "0644",
content => $dhcp_content,
require => Package['dnsmasq'],
notify => Exec['dnsmasq-restart'],
}
$dns_content = "# Tells dnsmasq to never forward A or AAAA queries for plain names,
# without dots or domain parts, to upstream nameservers. - line 19
domain-needed
# Bogus private reverse lookups.
bogus-priv
# Add the domain to simple names (without a period) in /etc/hosts
# in the same way as for DHCP-derived names. - line 119
expand-hosts
# Specifies DNS domains for the DHCP server. - line 128
domain=nursery.net
# Enable and set the size of dnsmasq's cache. - line 524
cache-size=256
"
file { 'dnsmasq_dns_conf':
path => '/etc/dnsmasq.d/dns.conf',
ensure => present,
group => root,
owner => root,
mode => "0644",
content => $dns_content,
require => Package['dnsmasq'],
notify => Exec['dnsmasq-restart'],
}
$tftp_content = "# This specifies a boot option which may appear in a PXE boot menu. - line 450
pxe-service=x86PC, \"Debian Install\", pxelinux
# Enable the TFTP server function. - line 469
enable-tftp
# Look for files to transfer using TFTP relative to the given directory.
# The directory is only used for TFTP requests via that interface eth1
tftp-root=/var/lib/tftpboot, eth1
"
file { 'dnsmasq_tftp_conf':
path => '/etc/dnsmasq.d/tftp.conf',
ensure => present,
group => root,
owner => root,
mode => "0644",
content => $tftp_content,
require => [Package['dnsmasq'], File['/var/lib/tftpboot']],
notify => Exec['dnsmasq-restart'],
}
# tftp server
file { ['/var/lib/tftpboot',
'/var/lib/tftpboot/pxelinux.cfg']:
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0755',
require => Package['debian-installer-11-netboot-amd64'],
}
file { '/var/lib/tftpboot/debian-installer':
ensure => 'link',
target => '/usr/lib/debian-installer',
require => Package['debian-installer-11-netboot-amd64'],
}
file { '/var/lib/tftpboot/ldlinux.c32':
ensure => 'link',
target => '/usr/lib/debian-installer/images/11/amd64/text/ldlinux.c32',
require => Package['debian-installer-11-netboot-amd64'],
}
file { '/var/lib/tftpboot/pxelinux.0':
ensure => 'link',
target => '/usr/lib/debian-installer/images/11/amd64/text/debian-installer/amd64/pxelinux.0',
require => Package['debian-installer-11-netboot-amd64'],
}
$default_content = "PATH debian-installer/images/11/amd64/text/debian-installer/amd64/boot-screens/
DEFAULT debian-installer/images/11/amd64/text/debian-installer/amd64/boot-screens/vesamenu.c32
PROMPT 0
# Avoid an installation if nothing is specified at startup
TIMEOUT 40
ONTIMEOUT localhost
LABEL localhost
MENU LABEL ^Local boot
LOCALBOOT 0
LABEL Debian-amd64
MENU LABEL ^Install Debian Bullseye (amd64)
KERNEL debian-installer/images/11/amd64/text/debian-installer/amd64/linux
APPEND vga=normal initrd=debian-installer/images/11/amd64/text/debian-installer/amd64/initrd.gz --quiet
TEXT HELP
Installation de Debian Bullseye amd64 standard
ENDTEXT
LABEL Debian-preseed-amd64 deployment
MENU LABEL Install Debian Bullseye deployment (amd64)
KERNEL debian-installer/images/11/amd64/text/debian-installer/amd64/linux
APPEND vga=normal initrd=debian-installer/images/11/amd64/text/debian-installer/amd64/initrd.gz languagechooser/language-name=French locale=fr_FR.UTF-8 keyboard-configuration/xkb-keymap=fr-latin9 netcfg/wireless_wep= netcfg/choose_interface=auto domain=nursery.net netcfg/get_hostname=deployment preseed/url=http://pxe.nursery.net/preseed-dep.cfg --
TEXT HELP
Installation de Debian Bullseye deploiement amd64 avec fichier preseed
ENDTEXT
LABEL Debian-preseed-amd64 development
MENU LABEL Install Debian Bullseye development (amd64)
KERNEL debian-installer/images/11/amd64/text/debian-installer/amd64/linux
APPEND vga=normal initrd=debian-installer/images/11/amd64/text/debian-installer/amd64/initrd.gz languagechooser/language-name=French locale=fr_FR.UTF-8 keyboard-configuration/xkb-keymap=fr-latin9 netcfg/wireless_wep= netcfg/choose_interface=auto domain=nursery.net netcfg/get_hostname=development preseed/url=http://pxe.nursery.net/preseed-dev.cfg --
TEXT HELP
Installation de Debian Bullseye développement amd64 avec fichier preseed
ENDTEXT
LABEL Debian-preseed-amd64 kvm server
MENU LABEL Install Debian Bullseye kvm server (amd64)
KERNEL debian-installer/images/11/amd64/text/debian-installer/amd64/linux
APPEND vga=normal initrd=debian-installer/images/11/amd64/text/debian-installer/amd64/initrd.gz languagechooser/language-name=French locale=fr_FR.UTF-8 keyboard-configuration/xkb-keymap=fr-latin9 netcfg/wireless_wep= netcfg/choose_interface=auto domain=nursery.net netcfg/get_hostname=kvmserver preseed/url=http://pxe.nursery.net/preseed-kvm-server.cfg --
TEXT HELP
Installation de Debian Bullseye kvm serveur amd64 avec fichier preseed
ENDTEXT
LABEL Debian-preseed-amd64 jitsi-meet server
MENU LABEL Install Debian Bullseye jitsi-meet server (amd64)
KERNEL debian-installer/images/11/amd64/text/debian-installer/amd64/linux
APPEND vga=normal initrd=debian-installer/images/11/amd64/text/debian-installer/amd64/initrd.gz languagechooser/language-name=French locale=fr_FR.UTF-8 keyboard-configuration/xkb-keymap=fr-latin9 netcfg/wireless_wep= netcfg/choose_interface=auto domain=nursery.net netcfg/get_hostname=jitsiserver preseed/url=http://pxe.nursery.net/preseed-jitsi-server.cfg --
TEXT HELP
Installation de Debian Bullseye jitsi-meet serveur amd64 avec fichier preseed
ENDTEXT
"
file { 'pxelinux_default':
path => '/var/lib/tftpboot/pxelinux.cfg/default',
ensure => present,
group => root,
owner => root,
mode => "0644",
content => $default_content,
}
file_line { 'apt-cacher_bind':
ensure => present,
path => '/etc/apt-cacher-ng/acng.conf',
line => 'BindAddress: localhost 192.168.1.100',
require => Package['apt-cacher-ng'],
notify => Exec['apt-cacher-restart'],
}
file_line { 'apt-cacher_proxy':
ensure => present,
path => '/etc/apt-cacher-ng/acng.conf',
line => 'Proxy: http://localhost:3128',
require => Package['apt-cacher-ng'],
notify => Exec['apt-cacher-restart'],
}
# Remap https pour jitsi et docker
# Conflict TLS encrypted traffic apt-transport-https and apt-cacher-ng
# cf. https://binfalse.de/2019/05/13/apt-cacher-ng-vs-apt-transport-https/
file_line { 'jitsi remap':
ensure => present,
path => '/etc/apt-cacher-ng/acng.conf',
line => 'Remap-jitsiorg: http://download.jitsi.org /jitsi ; https://download.jitsi.org # Jitsi Archives',
}
file_line { 'docker remap':
ensure => present,
path => '/etc/apt-cacher-ng/acng.conf',
line => 'Remap-dockercom: http://download.docker.com /docker ; https://download.docker.com # Docker Archives',
}