From e0a714c4184ba3b949dd122a86d80f1cf8f8e719 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Wed, 23 Oct 2013 17:10:21 +0100 Subject: [PATCH] Add tftp support for Fedora switch to installing tftpd-hpa on ubuntu so both ubuntu and fedora are using the same tftp implementation. Fixes two problems with tftp on Fedora tftp-server 5.2-9 o tftp needs to be run as root so that it can set its userid to nobody, as tftp by default downgrades to nobody it should be safe to run as root. Prevents this error "cannot set groups for user nobody" which was preventing tftp from working. o Add support for tftp requests that don't specify absolute paths, by remaping requests if they don't start in a /. I was seeing failed requests when they start in "pxelinux.cfg" i.e. don't start in "/tftpboot/", which was stalling the boot process. Change-Id: I7ce923bead605486c310b08697942f7f868709b0 --- elements/nova-baremetal/install.d/80-pxelinux | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/elements/nova-baremetal/install.d/80-pxelinux b/elements/nova-baremetal/install.d/80-pxelinux index a9a44953d..4d5dc232f 100755 --- a/elements/nova-baremetal/install.d/80-pxelinux +++ b/elements/nova-baremetal/install.d/80-pxelinux @@ -2,7 +2,7 @@ set -eux # syslinux is installed by nova-compute, which contains pxelinux.0 -install-packages atftpd xinetd +install-packages tftpd-hpa xinetd mkdir -p /tftpboot/pxelinux.cfg/ if [ -f /usr/lib/syslinux/pxelinux.0 ]; then @@ -14,6 +14,9 @@ else exit 1 fi +# Disable the tftp-hpa upstart job, we're using xinetd +[ -f /etc/init/tftpd-hpa.conf ] && echo "manual" > /etc/init/tftpd-hpa.override + cat > /etc/xinetd.d/tftp << EOF service tftp { @@ -21,9 +24,12 @@ service tftp port = 69 socket_type = dgram wait = yes - user = nobody + user = root server = /usr/sbin/in.tftpd - server_args = /tftpboot + server_args = --map-file /tftpboot/map-file /tftpboot disable = no } EOF + +# Adds support for tftp requests that don't include the directory name. +echo 'r ^([^/]) /tftpboot/\1' > /tftpboot/map-file