Browse code

Insert required iptables rules for Ironic

Devstack gate slaves have locked down local iptables firewalls.
Ironic nodes boot on an 'external' network and require TFTP
and Ironic API access back to the node via its HOST_IP. This inserts
the required rules to the top of the INPUT chain.

Change-Id: I2e5dfa2346d45fdd549a3a3fbc255f190195cdd6

Adam Gandelman authored on 2014/04/15 05:21:22
Showing 3 changed files
... ...
@@ -1,3 +1,4 @@
1
+iptables
1 2
 libguestfs0
2 3
 libvirt-bin
3 4
 openssh-client
... ...
@@ -1,6 +1,8 @@
1
+iptables
1 2
 libguestfs
2 3
 libvirt
3 4
 libvirt-python
5
+net-tools
4 6
 openssh-clients
5 7
 openvswitch
6 8
 python-libguestfs
... ...
@@ -379,11 +379,16 @@ function enroll_vms {
379 379
     neutron port-delete $PORT_ID
380 380
 }
381 381
 
382
-function configure_tftpd {
383
-    # enable tftp natting for allowing connections to SERVICE_HOST's tftp server
382
+function configure_iptables {
383
+    # enable tftp natting for allowing connections to HOST_IP's tftp server
384 384
     sudo modprobe nf_conntrack_tftp
385 385
     sudo modprobe nf_nat_tftp
386
+    # nodes boot from TFTP and callback to the API server listening on $HOST_IP
387
+    sudo iptables -I INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
388
+    sudo iptables -I INPUT -d $HOST_IP -p tcp --dport 6385 -j ACCEPT || true
389
+}
386 390
 
391
+function configure_tftpd {
387 392
     if is_ubuntu; then
388 393
         PXEBIN=/usr/lib/syslinux/pxelinux.0
389 394
     elif is_fedora; then
... ...
@@ -527,6 +532,7 @@ function prepare_baremetal_basic_ops {
527 527
     create_bridge_and_vms
528 528
     enroll_vms
529 529
     configure_tftpd
530
+    configure_iptables
530 531
 
531 532
     # restart nova-compute to ensure its resource tracking is up to
532 533
     # date with newly enrolled nodes
... ...
@@ -546,6 +552,10 @@ function cleanup_baremetal_basic_ops {
546 546
     sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/cleanup-nodes $IRONIC_VM_COUNT $IRONIC_VM_NETWORK_BRIDGE"
547 547
     sudo rm -rf /etc/xinetd.d/tftp /etc/init/tftpd-hpa.override
548 548
     restart_service xinetd
549
+    sudo iptables -D INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
550
+    sudo iptables -D INPUT -d $HOST_IP -p tcp --dport 6385 -j ACCEPT || true
551
+    sudo rmmod nf_conntrack_tftp || true
552
+    sudo rmmod nf_nat_tftp || true
549 553
 }
550 554
 
551 555
 # Restore xtrace + pipefail