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
This commit is contained in:
Derek Higgins 2013-10-23 17:10:21 +01:00
parent a751f2e30f
commit e0a714c418
1 changed files with 9 additions and 3 deletions

View File

@ -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