Skip to content
Snippets Groups Projects
Commit 4d23845f authored by Jan Vykopal's avatar Jan Vykopal
Browse files

Merge branch '1-the-second-network-interface-is-not-configured-by-cloud-init' into 'master'

QEMU Resolve "The second network interface is not configured by cloud-init"

Closes #1

See merge request !1
parents 7fa1a57c 7ca078e4
No related branches found
No related tags found
1 merge request!1QEMU Resolve "The second network interface is not configured by cloud-init"
Pipeline #83397 passed with stages
in 33 minutes and 13 seconds
# Changelog
## [qemu-0.1.0], [vbox-0.1.0] - 2020-11-8
## [qemu-0.1.0] - 2021-05-05
### Fixed
- Disabled `root` login
- [Issue #1](https://gitlab.ics.muni.cz/muni-kypo-images/ubuntu-14.04/-/issues/1) of network interfaces not being configured
## [qemu-0.1.0] - 2021-01-07
### Added
- First version
[qemu-0.1.0]: https://gitlab.ics.muni.cz/muni-kypo-images/kali-2019.4/-/tree/qemu-0.1.0
[vbox-0.1.0]: https://gitlab.ics.muni.cz/muni-kypo-images/kali-2019.4/-/tree/vbox-0.1.0
[qemu-0.1.0]: https://gitlab.ics.muni.cz/muni-kypo-images/ubuntu-14.04/-/tree/qemu-0.1.0
[qemu-0.2.0]: https://gitlab.ics.muni.cz/muni-kypo-images/ubuntu-14.04/-/tree/qemu-0.2.0
......@@ -16,7 +16,3 @@
debug:
msg: "Hello World"
# - name: Check that chrony is running
# assert:
# that:
# - ansible_facts.services.chrony.state == "running"
......@@ -4,14 +4,31 @@
sudo sed -i "s/^GRUB_TIMEOUT=[0-9]*/GRUB_TIMEOUT=0/" /etc/default/grub
sudo update-grub
# disable ssh root login using password
sed -i 's/#\?PermitRootLogin.*/PermitRootLogin without-password/g' /etc/ssh/sshd_config
# disable root login using password
sudo passwd -l root
# install resolvconf
apt-get -y install resolvconf
# install and configure chrony
#apt-get -y install chrony
#sed -i 's/pool .*/pool 0.pool.ntp.org iburst/' /etc/chrony/chrony.conf
#systemctl enable chrony
#systemctl start chrony
# fix #1
cat > /root/multinic.sh<< 'EOF'
#!/bin/bash
hname=$(hostname)
cat /etc/hosts | grep $hname >> /dev/null
if [ $? -ne 0 ];then
sudo bash -c "echo '127.0.0.1 $hname' >> /etc/hosts"
fi
netfile=$(cat /etc/network/interfaces)
for interface in $(ls -1 /sys/class/net) ;do
echo $netfile | grep $interface >> /dev/null
if [ $? -ne 0 ];then
sudo bash -c "echo 'auto $interface' >> /etc/network/interfaces"
sudo bash -c "echo 'iface $interface inet dhcp' >> /etc/network/interfaces"
sudo ifup $interface
fi
done
EOF
echo '@reboot /root/multinic.sh' >> /var/spool/cron/crontabs/root
chmod +x /root/multinic.sh
chown root:crontab /var/spool/cron/crontabs/root
chmod 600 /var/spool/cron/crontabs/root
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment