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

feat(commands): implement RFC 7151 (File Transfer Protocol HOST Command for Virtual Hosts) #169

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lezsakdomi
Copy link

Fix #114

Todo:

  • Add handler for command
  • Add listener
  • Provide option for checking hostname just at login time
  • Checking for hostname (domain name / ip literal) syntax according to section 3.1, including port number persistence
  • Checking if IP address matches server IP (in case supplied) (section 3.1)
  • When TLS used, checking if supplied hostname matches with one from TLS (section 3.2.2)
  • CLI options (specifying a map between virtualhosts and user/pass/root combos)
  • Tests

This commits lets you pass an `anonymous` argument at `virtualhost` event accept
@lezsakdomi
Copy link
Author

[BUG] It looks like passing motd and/or anonymous has no effect :(

@trs
Copy link
Contributor

trs commented Aug 8, 2019

Thanks for the start of this PR! I'll take a look into giving you a hand with it when I get a chance. I'll read up on the HOST command first.

@lezsakdomi
Copy link
Author

lezsakdomi commented Aug 8, 2019

RFC 7151 TL;DR:

The parameter of a HOST command is the hostname as the server was accessed, obviously.
The hostname SHOULD NOT contain a port.
If it's an IPv6, the hostname SHOULD be encapsulated in []s. If an IPv4, it MAY be enclosed between brackets or provided in the IPv6 form.

According to the specs, the server should:

  • Validate the syntax (I was afraid to implement this, because validating IPv6 addresses is hard)
  • Validate hostname validity if possible
    • If it's a bare IP (the IP should be our public IP)
    • If TLS used and hostname was in certificate

@lezsakdomi
Copy link
Author

I think this project shouldn't be so strict about validation. If ever implemented, maybe it's a good idea to provide an option to turn validation off.

Okay, syntax check could come any time :)

@lezsakdomi
Copy link
Author

Oh, and I was able to test my program using WinSCP - the only client implementing HOST I found so far

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