Skip to content

Commit 1fcf10f

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 44a89be commit 1fcf10f

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
@@ -304,7 +304,8 @@
304304
owner "root"
305305
group "root"
306306
mode "0644"
307-
variables(tftproot: tftproot, admin_ip: admin_ip)
307+
variables(tftproot: tftproot, admin_ip: admin_ip,
308+
admin_subnet: admin_net.subnet, admin_netmask: admin_net.netmask)
308309
end
309310

310311
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)