Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFTP WRQ not implemented yet #25

Closed
rADikal8e7 opened this issue Aug 7, 2019 · 11 comments
Closed

TFTP WRQ not implemented yet #25

rADikal8e7 opened this issue Aug 7, 2019 · 11 comments
Milestone

Comments

@rADikal8e7
Copy link

rADikal8e7 commented Aug 7, 2019

Hello @troglobit

First off amazingly simple tool!! I installed this on using linuxbrew/homebrew on my redhat machine and am serving files from my workspace. Get operations work seemlessly but somehow put operations do not work. I have tried giving full permissions to the folder and ensured selinux enforcements are disabled.

ls -ltra tftpboot
total 8
drwxr-xr-x 11 testuser eng 4096 Aug  6 16:50 ..
drwxrwxrwx  2 testuser eng 4096 Aug  6 18:02 .
-rwxrwxrwx  1 testuser eng   20 Aug  6 18:59 test
/tftpboot$uftpd -o tftp=45000 -n -l debug .
52236> Initializing ...
52236> Serving files as PID 52236 ...
52236> Starting services ...
52236> Not allowed to start FTP service.  Privileged port.
52236> Opened socket for port 45000
52236> Starting TFTP server on port 45000 ...
52236> Serving files from /ws/testuser-sjc/tftpboot ...
52236> Created new client session as PID 52513
52513> tftp RRQ test from 10.155.0.113:63562
52513> Compose path from cwd: /, arg: test
52513> Server path from CWD: /test
52513> Resulting non-chroot path: /ws/testuser-sjc/tftpboot/test
52513> tftp block 256 reading 512 bytes ...
52513> tftp sending 4 + 20 bytes ...
52513> tftp ACK, block # 1
52513> TFTP Client session ended.
52236> Previous TFTP session ended, restarting TFTP watcher ...
52236> Created new client session as PID 52555
52555> tftp opcode: 2
52555> tftp block#: 29797
52555> tftp opcode: 2
52555> tftp block#: 29797
52555> tftp opcode: 2
52555> tftp block#: 29797
52555> tftp opcode: 2
52555> tftp block#: 29797
52555> tftp opcode: 2
52555> tftp block#: 29797
laptop:~ testuser$ tftp 10.30.220.6 45000
tftp> get test
Received 20 bytes in 0.1 seconds
tftp>
tftp> quit
laptop:~ testuser$ tftp 10.30.220.6 45000
tftp> put test
Transfer timed out.

Am i missing some basic option like a -c flag according to 'in.tftpd' man page?
https://linux.die.net/man/8/in.tftpd


--create, -c
    Allow new files to be created. By default, tftpd will only allow upload of files that already exist. Files are created with default permissions allowing anyone to read or write them, unless the --permissive or --umask options are specified. 
@troglobit
Copy link
Owner

Thanks, great to hear other people like uftpd too :-)

The idea is to have the FTP/TFTP root directory read-only and then have an upload/ sub-directory with write permissions. Or create a world-writable file in the root directory.

I've reproduced your bug in my setup. I'll have a look at it later today.

@rADikal8e7
Copy link
Author

Thanks, great to hear other people like uftpd too :-)

The idea is to have the FTP/TFTP root directory read-only and then have an upload/ sub-directory with write permissions. Or create a world-writable file in the root directory.

I've reproduced your bug in my setup. I'll have a look at it later today.

Yes. Having such light weight apps like this is god sent especially when we dont have sudo permissions.

Hmm... I tried creating a world writable file and then performing a put operation but still get the same error. I see an-o writable flag but that is relevant only for FTP i presume.

@troglobit
Copy link
Owner

Oups! The root cause of the issue you've reported is that support for TFTP WRQ is not implemented yet.

I'm making this a feature request for the next release. Thank you for reporting this!

@troglobit troglobit changed the title Put operation fails with timeout error while get operation works as intended. TFTP PUT not implemented yet Aug 7, 2019
@troglobit troglobit added this to the v2.10 milestone Aug 7, 2019
@troglobit
Copy link
Owner

The -o writable flag is supposed to be for both FTP and TFTP.

@rADikal8e7
Copy link
Author

Oups! The root cause of the issue you've reported is that support for TFTP WRQ is not implemented yet.

I'm making this a feature request for the next release. Thank you for reporting this!

Cool!! looking forward to it.

@troglobit troglobit changed the title TFTP PUT not implemented yet TFTP WRQ not implemented yet Aug 12, 2019
@troglobit
Copy link
Owner

There, the latest code on master, unreleased but versioned v2.10-beta1, supports TFTP WRQ. I've tested it quite thoroughly:

  • Block size negotiation works, as for RRQ, verified with atftp
  • Same write semantics as for FTP (separate upload/ directory recommended), see man page

@troglobit
Copy link
Owner

@rADikal8e7 If you could give it a spin before I release the final version, that would be greatly appreciated! :-)

@rADikal8e7
Copy link
Author

@rADikal8e7 If you could give it a spin before I release the final version, that would be greatly appreciated! :-)

It is aliveeeee!!!!! it works as expected. I am going to try out a couple of different things but the base put functionality is validated. Thanks a ton on the amazing turnaround time @troglobit

tftp 10.30.220.6 45000
tftp> get test
tftp> put test1
Sent 8 bytes in 0.0 seconds
tftp> put test1
Sent 30 bytes in 0.0 seconds
uftpd -o tftp=45000 -n -l debug .
19262> Initializing ...                                                          
19262> Serving files as PID 19262 ...                                            
19262> Starting services ...                                                     
19262> Not allowed to start FTP service.  Privileged port.                       
19262> Opened socket for port 45000                                              
19262> Starting TFTP server on port 45000 ...                                    
19262> Serving files from /ws/test-sjc/tftpboot ...                          
19262> Created new client session as PID 19292                                   
19292> tftp RRQ test from 10.155.128.69:49422                                    
19292> Compose path from cwd: /, arg: test                                       
19292> Server path from CWD: /test                                               
19292> Resulting non-chroot path: /ws/test-sjc/tftpboot/test                 
19292> tftp block 256 reading 512 bytes ...                                      
19292> SND : header size: 4, data len: 0 ...                                     
19292> tftp ACK, block # 1                                                       
19292> TFTP Client session ended.                                                
19262> Previous TFTP session ended, restarting TFTP watcher ...                  
19262> Created new client session as PID 19301                                   
19301> tftp WRQ test1 from 10.155.128.69:49422                                   
19301> Compose path from cwd: /, arg: test1                                      
19301> Server path from CWD: /test1                                              
19301> Resulting non-chroot path: /ws/test-sjc/tftpboot/test1                
19301> ACK block 0                                                               
19301> SND : header size: 4, data len: 4 ...                                     
19301> tftp DATA  from 10.155.128.69:49422                                       
19301> tftp block 256 writing 8 bytes ...                                        
19301> ACK block 1                                                               
19301> SND : header size: 4, data len: 4 ...                                     
19301> TFTP Client session ended.                                                
19262> Previous TFTP session ended, restarting TFTP watcher ...                  
19262> Created new client session as PID 19811                                   
19811> tftp WRQ test1 from 10.155.128.69:49422                                   
19811> Compose path from cwd: /, arg: test1                                      
19811> Server path from CWD: /test1                                              
19811> Resulting non-chroot path: /ws/test-sjc/tftpboot/test1                
19811> ACK block 0                                                               
19811> SND : header size: 4, data len: 4 ...                                     
19811> tftp DATA  from 10.155.128.69:49422                                       
19811> tftp block 256 writing 30 bytes ...                                       
19811> ACK block 1                                                               
19811> SND : header size: 4, data len: 4 ...                                     
19811> TFTP Client session ended.

@troglobit
Copy link
Owner

Awesome, glad to hear it actually works! :-)

If you find something, whatever it may be, then just open a new issue in the tracker. Otherwise I'll push out the v2.10 GA later this week.

@troglobit
Copy link
Owner

Just released v2.10, so if you want to switch to the released version it's available here 👉 https://github.com/troglobit/uftpd/releases/tag/v2.10

@rADikal8e7
Copy link
Author

Just released v2.10, so if you want to switch to the released version it's available here 👉 https://github.com/troglobit/uftpd/releases/tag/v2.10

Done. v2.10 holds up good. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants