Skip to content

Commit 43072e6

Browse files
committed
Updated to Ubuntu 20.04 and new IP addressing
1 parent efd75a4 commit 43072e6

File tree

12 files changed

+194
-156
lines changed

12 files changed

+194
-156
lines changed

Proxmox/Ansible/roles/dc/tasks/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
when: res.reboot_required
1111

1212
- name: Set HostOnly IP Address
13-
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.38.102'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B1-C4'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.38.102 –PrefixLength 24 -DefaultGateway 192.168.38.1 } Else { Write-Host 'IP Address Already Created.' }"
13+
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.56.102'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B1-C4'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.56.102 –PrefixLength 24 -DefaultGateway 192.168.56.1 } Else { Write-Host 'IP Address Already Created.' }"
1414

1515
- name: Set DNS Address
1616
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B1-C4'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 127.0.0.1,8.8.8.8"

Proxmox/Ansible/roles/exchange/tasks/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
when: res.reboot_required
1111

1212
- name: Set HostOnly IP Address
13-
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.38.106'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C5'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.38.106 –PrefixLength 24 -DefaultGateway 192.168.38.1 } Else { Write-Host 'IP Address Already Created.' }"
13+
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.56.106'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C5'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.56.106 –PrefixLength 24 -DefaultGateway 192.168.56.1 } Else { Write-Host 'IP Address Already Created.' }"
1414

1515
- name: Set HostOnly DNS Address
16-
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C5'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.38.102,8.8.8.8"
16+
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C5'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.56.102,8.8.8.8"
1717

1818
- name: Install git
1919
win_chocolatey:

Proxmox/Ansible/roles/logger/tasks/main.yml

+34-26
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
become: yes
6363
shell: |
6464
echo "[$(date +%H:%M:%S)]: Running apt-fast install..."
65-
apt-fast -qq install -y jq whois build-essential git mysql-server redis-server python-pip unzip htop yq
65+
apt-fast -qq install -y jq whois build-essential git mysql-server redis-server python3-pip unzip htop yq libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev libssl-dev libvorbis-dev libwebp-dev tomcat9 tomcat9-admin tomcat9-user tomcat9-common
6666
register: apt_install_prerequisites
6767
failed_when: "'error' in apt_install_prerequisites.stderr"
6868

@@ -88,7 +88,7 @@
8888
executable: /bin/bash
8989
become: yes
9090
shell: |
91-
for package in jq whois build-essential git unzip yq mysql-server redis-server python-pip; do
91+
for package in jq whois build-essential git unzip yq mysql-server redis-server python3-pip; do
9292
echo "[$(date +%H:%M:%S)]: [TEST] Validating that $package is correctly installed..."
9393
# Loop through each package using dpkg
9494
if ! dpkg -S $package >/dev/null; then
@@ -128,20 +128,20 @@
128128
if ! grep 'interface "eth1"' /etc/dhcp/dhclient.conf; then
129129
echo -e 'interface "eth1" {
130130
send host-name = gethostname();
131-
send dhcp-requested-address 192.168.38.105;
131+
send dhcp-requested-address 192.168.56.105;
132132
}' >>/etc/dhcp/dhclient.conf
133133
netplan apply
134134
fi
135135
# Fix eth1 if the IP isn't set correctly
136136
ETH1_IP=$(ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
137-
if [ "$ETH1_IP" != "192.168.38.105" ]; then
137+
if [ "$ETH1_IP" != "192.168.56.105" ]; then
138138
echo "Incorrect IP Address settings detected. Attempting to fix."
139139
ifdown eth1
140140
ip addr flush dev eth1
141141
ifup eth1
142142
ETH1_IP=$(ifconfig eth1 | grep 'inet addr' | cut -d ':' -f 2 | cut -d ' ' -f 1)
143-
if [ "$ETH1_IP" == "192.168.38.105" ]; then
144-
echo "[$(date +%H:%M:%S)]: The static IP has been fixed and set to 192.168.38.105"
143+
if [ "$ETH1_IP" == "192.168.56.105" ]; then
144+
echo "[$(date +%H:%M:%S)]: The static IP has been fixed and set to 192.168.56.105"
145145
else
146146
echo "[$(date +%H:%M:%S)]: Failed to fix the broken static IP for eth1. Exiting because this will cause problems with other VMs."
147147
exit 1
@@ -471,8 +471,8 @@
471471
cd /opt || exit 1
472472
git clone https://github.com/OISF/suricata-update.git
473473
cd /opt/suricata-update || exit 1
474-
pip install pyyaml
475-
python setup.py install
474+
pip3 install pyyaml
475+
python3 setup.py install
476476
477477
cp /vagrant/resources/suricata/suricata.yaml /etc/suricata/suricata.yaml
478478
crudini --set --format=sh /etc/default/suricata '' iface eth1
@@ -530,15 +530,15 @@
530530
shell: |
531531
echo "[$(date +%H:%M:%S)]: Installing Zeek..."
532532
if ! grep 'zeek' /etc/apt/sources.list.d/security:zeek.list; then
533-
sh -c "echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/security:zeek.list"
533+
sh -c "echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/security:zeek.list"
534534
fi
535-
wget -nv https://download.opensuse.org/repositories/security:zeek/xUbuntu_18.04/Release.key -O /tmp/Release.key
535+
wget -nv https://download.opensuse.org/repositories/security:zeek/xUbuntu_20.04/Release.key -O /tmp/Release.key
536536
apt-key add - </tmp/Release.key &>/dev/null
537537
538538
- name: Install Zeek Packages
539539
become: yes
540540
apt:
541-
name: ['zeek', 'crudini', 'python-pip']
541+
name: ['zeek', 'crudini', 'python3-pip']
542542
update_cache: yes
543543

544544
- name: Install Zeek Continued
@@ -549,7 +549,7 @@
549549
# Environment variables
550550
NODECFG=/opt/zeek/etc/node.cfg
551551
export PATH=$PATH:/opt/zeek/bin
552-
pip install zkg==2.1.1
552+
pip3 install zkg
553553
zkg refresh
554554
zkg autoconfig
555555
zkg install --force salesforce/ja3
@@ -617,28 +617,36 @@
617617
executable: /bin/bash
618618
become: yes
619619
shell: |
620-
echo "[$(date +%H:%M:%S)]: Installing Guacamole..."
621-
cd /opt
622-
apt-get -qq install -y libcairo2-dev libjpeg62-dev libpng-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libssh-dev tomcat8 tomcat8-admin tomcat8-user
623-
wget --progress=bar:force "http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/1.0.0/source/guacamole-server-1.0.0.tar.gz" -O guacamole-server-1.0.0.tar.gz
624-
tar -xf guacamole-server-1.0.0.tar.gz && cd guacamole-server-1.0.0
625-
./configure &>/dev/null && make --quiet &>/dev/null && make --quiet install &>/dev/null || echo "[-] An error occurred while installing Guacamole."
620+
echo "[$(date +%H:%M:%S)]: Setting up Guacamole..."
621+
cd /opt || exit 1
622+
echo "[$(date +%H:%M:%S)]: Downloading Guacamole..."
623+
wget --progress=bar:force "https://apache.org/dyn/closer.lua/guacamole/1.3.0/source/guacamole-server-1.3.0.tar.gz?action=download" -O guacamole-server-1.3.0.tar.gz
624+
tar -xf guacamole-server-1.3.0.tar.gz && cd guacamole-server-1.3.0 || echo "[-] Unable to find the Guacamole folder."
625+
echo "[$(date +%H:%M:%S)]: Configuring Guacamole and running 'make' and 'make install'..."
626+
./configure --with-init-dir=/etc/init.d && make --quiet &>/dev/null && make --quiet install &>/dev/null || echo "[-] An error occurred while installing Guacamole."
626627
ldconfig
627-
cd /var/lib/tomcat8/webapps
628-
wget --progress=bar:force "http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/1.0.0/binary/guacamole-1.0.0.war" -O guacamole.war
628+
cd /var/lib/tomcat9/webapps || echo "[-] Unable to find the tomcat9/webapps folder."
629+
wget --progress=bar:force "https://apache.org/dyn/closer.lua/guacamole/1.3.0/binary/guacamole-1.3.0.war?action=download" -O guacamole.war
629630
mkdir /etc/guacamole
630-
mkdir /usr/share/tomcat8/.guacamole
631+
mkdir /etc/guacamole/shares
632+
sudo chmod 777 /etc/guacamole/shares
633+
mkdir /usr/share/tomcat9/.guacamole
631634
cp /vagrant/resources/guacamole/user-mapping.xml /etc/guacamole/
632635
cp /vagrant/resources/guacamole/guacamole.properties /etc/guacamole/
633636
cp /vagrant/resources/guacamole/guacd.service /lib/systemd/system
634-
sudo ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat8/.guacamole/
635-
sudo ln -s /etc/guacamole/user-mapping.xml /usr/share/tomcat8/.guacamole/
637+
sudo ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat9/.guacamole/
638+
sudo ln -s /etc/guacamole/user-mapping.xml /usr/share/tomcat9/.guacamole/
639+
# Thank you Kifarunix: https://kifarunix.com/install-guacamole-on-debian-11/
640+
useradd -M -d /var/lib/guacd/ -r -s /sbin/nologin -c "Guacd User" guacd
641+
mkdir /var/lib/guacd
642+
chown -R guacd: /var/lib/guacd
643+
systemctl daemon-reload
636644
systemctl enable guacd
637-
systemctl enable tomcat8
645+
systemctl enable tomcat9
638646
systemctl start guacd
639-
systemctl start tomcat8
647+
systemctl start tomcat9
648+
echo "[$(date +%H:%M:%S)]: Guacamole installation complete!"
640649
register: install_guacamole
641-
failed_when: "'error' in install_guacamole.stderr"
642650

643651
- name: Postinstall Tasks
644652
args:

Proxmox/Ansible/roles/wef/tasks/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
# This needs to be made idempodent
1313
- name: Set HostOnly IP Address
14-
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.38.103'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C4'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.38.103 –PrefixLength 24 -DefaultGateway 192.168.38.1 } Else { Write-Host 'IP Address Already Created.' }"
14+
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.56.103'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C4'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.56.103 –PrefixLength 24 -DefaultGateway 192.168.56.1 } Else { Write-Host 'IP Address Already Created.' }"
1515

1616
# This needs to be made idempodent
1717
- name: Set HostOnly DNS Address
18-
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C4'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.38.102,8.8.8.8"
18+
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A1-B4-C4'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.56.102,8.8.8.8"
1919

2020
- name: Install git
2121
win_chocolatey:

Proxmox/Ansible/roles/win10/tasks/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
when: res.reboot_required
1111

1212
- name: Set HostOnly IP Address
13-
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.38.104'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A2-B1-C4'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.38.104 –PrefixLength 24 -DefaultGateway 192.168.38.1 } Else { Write-Host 'IP Address Already Created.' }"
13+
win_shell: "If (-not(get-netipaddress | where {$_.IPAddress -eq '192.168.56.104'})) {$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A2-B1-C4'}).Name; New-NetIPAddress –InterfaceAlias $adapter –AddressFamily IPv4 -IPAddress 192.168.56.104 –PrefixLength 24 -DefaultGateway 192.168.56.1 } Else { Write-Host 'IP Address Already Created.' }"
1414

1515
- name: Set HostOnly DNS Address
16-
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A2-B1-C4'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.38.102,8.8.8.8"
16+
win_shell: "$adapter = (get-netadapter | where {$_.MacAddress -eq '00-50-56-A2-B1-C4'}).Name; Set-DnsClientServerAddress -InterfaceAlias $adapter -ServerAddresses 192.168.56.102,8.8.8.8"
1717

1818
- name: Install git
1919
win_chocolatey:

Proxmox/Packer/http/preseed.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ d-i pkgsel/upgrade select full-upgrade
3232
d-i time/zone string UTC
3333
d-i user-setup/allow-password-weak boolean true
3434
d-i user-setup/encrypt-home boolean false
35-
tasksel tasksel/first multiselect standard, server
35+
tasksel tasksel/first multiselect standard, server

Proxmox/Packer/scripts/cleanup.sh

+43-23
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,101 @@
11
#!/bin/sh -eux
22

3-
# Delete all Linux headers
3+
echo "remove linux-headers"
44
dpkg --list \
55
| awk '{ print $2 }' \
66
| grep 'linux-headers' \
77
| xargs apt-get -y purge;
88

9-
# Remove specific Linux kernels, such as linux-image-3.11.0-15-generic but
10-
# keeps the current kernel and does not touch the virtual packages,
11-
# e.g. 'linux-image-generic', etc.
9+
echo "remove specific Linux kernels, such as linux-image-3.11.0-15-generic but keeps the current kernel and does not touch the virtual packages"
1210
dpkg --list \
1311
| awk '{ print $2 }' \
1412
| grep 'linux-image-.*-generic' \
15-
| grep -v "$(uname -r)" \
13+
| grep -v `uname -r` \
1614
| xargs apt-get -y purge;
1715

18-
# Delete Linux source
16+
echo "remove old kernel modules packages"
17+
dpkg --list \
18+
| awk '{ print $2 }' \
19+
| grep 'linux-modules-.*-generic' \
20+
| grep -v `uname -r` \
21+
| xargs apt-get -y purge;
22+
23+
echo "remove linux-source package"
1924
dpkg --list \
2025
| awk '{ print $2 }' \
2126
| grep linux-source \
2227
| xargs apt-get -y purge;
2328

24-
# Delete development packages
29+
echo "remove all development packages"
2530
dpkg --list \
2631
| awk '{ print $2 }' \
27-
| grep -- '-dev$' \
32+
| grep -- '-dev\(:[a-z0-9]\+\)\?$' \
2833
| xargs apt-get -y purge;
2934

30-
# delete docs packages
35+
echo "remove docs packages"
3136
dpkg --list \
3237
| awk '{ print $2 }' \
3338
| grep -- '-doc$' \
3439
| xargs apt-get -y purge;
3540

36-
# Delete X11 libraries
41+
echo "remove X11 libraries"
3742
apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6;
3843

39-
# Delete obsolete networking
44+
echo "remove obsolete networking packages"
4045
apt-get -y purge ppp pppconfig pppoeconf;
4146

42-
# Delete oddities
43-
apt-get -y purge popularity-contest installation-report command-not-found friendly-recovery bash-completion fonts-ubuntu-font-family-console laptop-detect;
47+
echo "remove packages we don't need"
48+
apt-get -y purge popularity-contest command-not-found friendly-recovery bash-completion fonts-ubuntu-font-family-console laptop-detect motd-news-config usbutils grub-legacy-ec2
4449

50+
# 21.04+ don't have this
51+
echo "remove the installation-report"
52+
apt-get -y purge popularity-contest installation-report || true;
53+
54+
echo "remove the console font"
55+
apt-get -y purge fonts-ubuntu-console || true;
56+
57+
echo "removing command-not-found-data"
4558
# 19.10+ don't have this package so fail gracefully
4659
apt-get -y purge command-not-found-data || true;
4760

48-
# Exlude the files we don't need w/o uninstalling linux-firmware
49-
echo "==> Setup dpkg excludes for linux-firmware"
61+
# Exclude the files we don't need w/o uninstalling linux-firmware
62+
echo "Setup dpkg excludes for linux-firmware"
5063
cat <<_EOF_ | cat >> /etc/dpkg/dpkg.cfg.d/excludes
5164
#BENTO-BEGIN
5265
path-exclude=/lib/firmware/*
5366
path-exclude=/usr/share/doc/linux-firmware/*
5467
#BENTO-END
5568
_EOF_
5669

57-
# Delete the massive firmware packages
70+
echo "delete the massive firmware files"
5871
rm -rf /lib/firmware/*
5972
rm -rf /usr/share/doc/linux-firmware/*
6073

74+
echo "autoremoving packages and cleaning apt data"
6175
apt-get -y autoremove;
6276
apt-get -y clean;
6377

64-
# Remove docs
78+
echo "remove /usr/share/doc/"
6579
rm -rf /usr/share/doc/*
6680

67-
# Remove caches
81+
echo "remove /var/cache"
6882
find /var/cache -type f -exec rm -rf {} \;
6983

70-
# truncate any logs that have built up during the install
84+
echo "truncate any logs that have built up during the install"
7185
find /var/log -type f -exec truncate --size=0 {} \;
7286

73-
# Blank netplan machine-id (DUID) so machines get unique ID generated on boot.
87+
echo "blank netplan machine-id (DUID) so machines get unique ID generated on boot"
7488
truncate -s 0 /etc/machine-id
7589

76-
# remove the contents of /tmp and /var/tmp
90+
echo "remove the contents of /tmp and /var/tmp"
7791
rm -rf /tmp/* /var/tmp/*
7892

79-
# clear the history so our install isn't there
93+
echo "force a new random seed to be generated"
94+
rm -f /var/lib/systemd/random-seed
95+
96+
echo "clear the history so our install isn't there"
97+
rm -f /root/.wget-hsts
8098
export HISTSIZE=0
81-
rm -f /root/.wget-hsts
99+
100+
echo "Remove the cdrom"
101+
eject -v /dev/cdrom || true

0 commit comments

Comments
 (0)