Skip to content

Conversation

@drakkan
Copy link
Collaborator

@drakkan drakkan commented Dec 13, 2020

We implement the following custom FTP commands:

  • XCRC (requests CRC32 digest/checksum)
  • MD5/XMD5 (requests MD5 digest/checksum)
  • XSHA/XSHA1 (requests SHA1 digest/checksum)
  • XSHA256 (requests SHA256 digest/checksum)
  • XSHA512 (requests SHA512 digest/checksum)

and we also support the more modern HASH command

https://tools.ietf.org/html/draft-bryan-ftpext-hash-02

To support partial hash for the HASH command we should add support for RANG too.

This implementation is very similar to proftpd mod_digest

@codecov
Copy link

codecov bot commented Dec 13, 2020

Codecov Report

Merging #196 (c55f77c) into master (6f53c30) will increase coverage by 2.85%.
The diff coverage is 83.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #196      +/-   ##
==========================================
+ Coverage   64.25%   67.10%   +2.85%     
==========================================
  Files           9        9              
  Lines         870      979     +109     
==========================================
+ Hits          559      657      +98     
- Misses        235      239       +4     
- Partials       76       83       +7     
Impacted Files Coverage Δ
server.go 56.06% <ø> (ø)
handle_files.go 66.09% <74.02%> (+2.84%) ⬆️
client_handler.go 58.37% <100.00%> (+3.57%) ⬆️
handle_misc.go 92.17% <100.00%> (+8.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f53c30...c55f77c. Read the comment docs.

Copy link
Owner

@fclairamb fclairamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good.

I think it's reasonable to do not enable it by default, it's indeed a good way to attack a server by consuming its CPU & bandwidth.

I might add an FS extension later so that it can directly bind to the stored checksum on the final backend. For example, Google Drive implemented with afero-gdrive supports fetching the MD5 of the file. Here that means performing an API call instead of download the file and performing a checksum on it.

We implement the following custom FTP commands:

- XCRC (requests CRC32 digest/checksum)
- MD5/XMD5 (requests MD5 digest/checksum)
- XSHA/XSHA1 (requests SHA1 digest/checksum)
- XSHA256 (requests SHA256 digest/checksum)
- XSHA512 (requests SHA512 digest/checksum)

and we also support the more modern HASH command

https://tools.ietf.org/html/draft-bryan-ftpext-hash-02
@drakkan drakkan force-pushed the hash branch 2 times, most recently from c6bd7c9 to 83287a8 Compare December 16, 2020 08:26
@probot-auto-merge probot-auto-merge bot merged commit c16c83a into fclairamb:master Dec 16, 2020
@drakkan
Copy link
Collaborator Author

drakkan commented Dec 16, 2020

This is already disabled by default, I added the hasher interface too, thank you!

@drakkan drakkan deleted the hash branch February 3, 2021 15:56
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

Successfully merging this pull request may close these issues.

2 participants