startnat.sh doesn't use correct net devices
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
maas-cert-server |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
While watching the debug session with Michael and Cisco today we noticed that NAT wasn't happening.
This is the startnat.sh script currently:
bladernr@
#!/bin/sh
INTERNAL_NET=eth0
EXTERNAL_NET=eth1
if [ -f /etc/maas-
. /etc/maas-
fi
echo 1 > /proc/sys/
/sbin/iptables -t nat -A POSTROUTING -o $EXTERNAL_NET -j MASQUERADE
/sbin/iptables -A FORWARD -i $EXTERNAL_NET -o $INTERNAL_NET -m state \
/sbin/iptables -A FORWARD -i $INTERNAL_NET -o $EXTERNAL_NET -j ACCEPT
And this is grepping startnat.sh through the entire codebase:
bladernr@
debian/changelog: * Move startnat.sh and flushnat.sh scripts from root of project to
debian/changelog: * Update startnat.sh to pull internal & external ports from config file
debian/
debian/postinst:# startnat.sh command in /etc/rc.local and, if it's present, configure systemd
lib/systemd/
At no point do the INTERNAL_NET and EXTERNAL_NET settings from the config file get placed into startnat.sh, so no matter what you set INTERNAL_NET and EXTERNAL_NET to in the config file, startnat.sh always uses eth0 and eth1.
Changed in maas-cert-server: | |
status: | New → Confirmed |
Before running modified maniacs-setup ubuntu- s-2vcpu- 4gb-nyc3- 01:~$ cat /usr/sbin/ startnat. sh
ubuntu@
#!/bin/sh
INTERNAL_NET=eth0 ubuntu- s-2vcpu- 4gb-nyc3- 01:~$ grep _NET /etc/maas- cert-server/ config
EXTERNAL_NET=eth1
ubuntu@
INTERNAL_NET=eth1
EXTERNAL_NET=eth0
ubuntu@ ubuntu- s-2vcpu- 4gb-nyc3- 01:~$ sudo ./maniacs-setup
Running modified maniacs-setup ******* ******* ******* ******* ******* ******* ******* ******* ******* *****
*******
* Identified networks:
* INTERNAL: 10.132.47.193 on eth1
* EXTERNAL: 159.203.72.148
10.17.0.5 on eth0
*
* Is this correct (Y/n)? y
* Do you want to set up this computer to automatically start NAT (Y/n)? y system/ multi-user. target. wants/certifica tion-nat. service → /lib/systemd/ system/ certification- nat.service.
Created symlink /etc/systemd/
ubuntu@ ubuntu- s-2vcpu- 4gb-nyc3- 01:~$ cat /usr/sbin/ startnat. sh
#!/bin/sh
INTERNAL_NET=eth1
INTERNAL_NET=eth0
ethernet