tftp mixed results

Issues related to applications and software problems
Post Reply
davama
Posts: 13
Joined: 2015/03/26 20:52:43

tftp mixed results

Post by davama » 2020/09/07 16:43:00

Hello,

I have centos 7 tftp server (yes, I can tftp inside the server itself with no issues...)

Code: Select all

> /usr/sbin/in.tftpd -V
tftp-hpa 5.2, with remap, with tcpwrappers

> tftp -V
tftp-hpa 5.2, with readline

getenforce 
Disabled

Code: Select all

systemctl cat tftp
# /usr/lib/systemd/system/tftp.service
[Unit]
Description=Tftp Server
Requires=tftp.socket
Documentation=man:in.tftpd

[Service]
ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot
StandardInput=socket

[Install]
Also=tftp.socket

# /etc/systemd/system/tftp.service.d/override.conf
[Service]
Restart=on-failure
RestartSec=5

Code: Select all

cat /etc/xinetd.d/tftp
service tftp
{
	socket_type		= dgram
	protocol		= udp
	wait			= yes
	user			= root
	server			= /usr/sbin/in.tftpd
	server_args		= -s /var/lib/tftpboot
	disable			= no
	per_source		= 11
	cps			= 100 2
	flags			= IPv4
}

Code: Select all

ll -al /var/lib/tftpboot
drwxrwxrwx   2 tftp tftp      140 Sep  7 15:48 ./
drwxr-xr-x. 44 root root     4096 Aug 31 17:56 ../
-rwxrwxrwx   1 tftp tftp 12001280 Jan  9  2018 ap1g2-k9w7-tar.153-3.JF1.tar*
-rwxrwxrwx   1 tftp tftp 10741760 Jan  9  2018 ap3g1-k9w7-tar.153-3.JD11.tar*
-rwxrwxrwx   1 tftp tftp       13 Sep  7 15:48 file1.txt*
-rwxrwxrwx   1 tftp tftp       13 Sep  7 15:48 file2.txt*
-rwxrwxrwx   1 tftp tftp       20 Sep  7 16:32 file3.txt*
-rwxrwxrwx   1 tftp tftp       58 Sep  7 15:48 test.tar*

 ll -al /var/lib/ | grep tftp
drwxrwxrwx   2 tftp          tftp            140 Sep  7 15:48 tftpboot/
from an arch linux client also tftp-hpa 5.2, with readline i am able to get a file called file3.txt and see on tcpdump (this is on another network from the server)

Code: Select all

tftp -v xxx -c get file3.txt 
Connected to xxx (xxx), port 69
getting from xxx:file3.txt to file3.txt [netascii]
Received 20 bytes in 0.8 seconds [189 bit/s]

cat file3.txt  < file gets created locally on the client with data
Hello file 3

tftp -v xxx -c put file3.txt 
Connected to xxx (xxx), port 69
putting file3.txt to xxx:file3.txt [netascii]
Sent 20 bytes in 1.7 seconds [95 bit/s]

# tcpdump on the server from the good client
16:01:41.732402 IP6 (class 0x40, flowlabel 0xd84dd, hlim 62, next-header UDP (17) payload length: 29) xxx.56050 > xxx.ip6.arpa.tftp: [udp sum ok]  21 RRQ "file3.txt" netascii
	0x0000:  640d 84dd 001d 113e 2607 2400 0009 2077  d......>&.$....w
	0x0010:  0000 0000 0000 000f 2a03 c9c0 0101 0036  ........*......6
	0x0020:  0000 0000 0000 0156 daf2 0045 001d 158b  .......V...E....
	0x0030:  0001 6669 6c65 332e 7478 7400 6e65 7461  ..file3.txt.neta
	0x0040:  7363 6969 00                             scii.
My issue comes when I try from another client that is centos 7 tftp-hpa 5.2, with readline (this is on the same LAN **driving me crazy**). I can see the tcpdump and i see a file3.txt get created. but that file3.txt is empty....

Code: Select all

tftp -v xxx -c get file3.txt 
Connected to xxx (xxx), port 69
getting from xxxt:file3.txt to file3.txt [netascii]
�/|��  < this is not a typo...this is actual output


cat file3.txt   < file gets created locally on the client but empty
<....nothing>

tftp -v xxx -c put file3.txt 
Connected to xxx (xxx), port 69
putting file3.txt to xxx:file3.txt [netascii]
client: timed out

# tcpdump on the server from the bad client
16:17:55.055495 IP6 (hlim 64, next-header UDP (17) payload length: 29) xxxx.ip6.arpa.55897 > xxx.ip6.arpa.tftp: [udp sum ok]  21 RRQ "file3.txt" netascii
	0x0000:  6000 0000 001d 1140 2a03 c9c0 0101 0036  `......@*......6
	0x0010:  0000 0000 0000 0012 2a03 c9c0 0101 0036  ........*......6
	0x0020:  0000 0000 0000 0156 da59 0045 001d 8bad  .......V.Y.E....
	0x0030:  0001 6669 6c65 332e 7478 7400 6e65 7461  ..file3.txt.neta
	0x0040:  7363 6969 00                             scii.
Can anyone kindly point me in the right direction?
tftp should be very simple... i suspect a client issue but not sure where else to check.


Thank you,
Dave

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: tftp mixed results

Post by TrevorH » 2020/09/07 16:47:40

How have you opened the firewall to tftp requests? If using firewalld then make sure you use --add-service=tftp not --add-port-69/udp as they do different things. Most notably, the /usr/lib/firewalld/services/tftp.xml includes

Code: Select all

  <module name="nf_conntrack_tftp"/>
as well as opening port 69/udp. If using iptables then you need to edit /etc/sysconfig/iptables-config and add that module to the list it loads when the service starts.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

davama
Posts: 13
Joined: 2015/03/26 20:52:43

Re: tftp mixed results

Post by davama » 2020/09/07 17:53:28

Thank you for the reply!

Yes firewalld has port open. (i was able to access it from a remote client (arch linux))

Code: Select all

firewall-cmd --list-all
...
  services: dhcpv6-client dns http https ldap mongodb ntp radius snmp squid ssh syslog tftp

davama
Posts: 13
Joined: 2015/03/26 20:52:43

Re: tftp mixed results

Post by davama » 2020/09/07 17:58:10

forgot to add:

Code: Select all

firewall-cmd --info-service=tftp
tftp
  ports: 69/udp
  protocols: 
  source-ports: 
  modules: tftp
  destination: 

Thanks again!!

davama
Posts: 13
Joined: 2015/03/26 20:52:43

Re: tftp mixed results

Post by davama » 2020/09/07 20:43:00

Asked a colleague to test from his debian box and he was able to `get` and `put` with no issues... :?

So it iis only a centos 7 client either on the local LAN or on a different network that is giving me issues...

Very confusing

Post Reply