Skip to content

Commit 36bcfe2

Browse files
committed
provisioner: allow tftp access from admin network only (bsc#1019111)
The tftp server is for hosts on the admin network only. But it can be accessed from outside if the admin network is routable. This patch adds an iptables rule to prevent access from outside the admin network. (cherry picked from commit a699d6c)
1 parent 839a647 commit 36bcfe2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

chef/cookbooks/provisioner/recipes/setup_base_images.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@
299299
owner "root"
300300
group "root"
301301
mode "0644"
302-
variables(tftproot: tftproot, admin_ip: admin_ip)
302+
variables(tftproot: tftproot, admin_ip: admin_ip,
303+
admin_subnet: admin_net.subnet, admin_netmask: admin_net.netmask)
303304
end
304305

305306
service "tftp.service" do

chef/cookbooks/provisioner/templates/default/tftp.service.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ Description=Tftp Server
33

44
[Service]
55
Type=simple
6+
ExecStartPre=/usr/sbin/iptables -A INPUT -d <%= @admin_ip %> ! -s <%= @admin_subnet %>/<%= @admin_netmask %> -p udp -m udp --dport 69 -j DROP
67
ExecStart=/usr/sbin/in.tftpd -u tftp -s <%= @tftproot %> -m /etc/tftpd.conf -L -a <%= @admin_ip %> -B 1024 -v
8+
ExecStopPost=/usr/sbin/iptables -D INPUT -d <%= @admin_ip %> ! -s <%= @admin_subnet %>/<%= @admin_netmask %> -p udp -m udp --dport 69 -j DROP
79
Restart=on-failure

0 commit comments

Comments
 (0)