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

Multiplex HTTPS, IMAP and SMTP on port 443 #357

Merged
merged 1 commit into from
Jul 11, 2024
Merged

Conversation

link2xt
Copy link
Contributor

@link2xt link2xt commented Jul 11, 2024

Services are distinguished based on ALPN.
For example,
openssl s_client -connect example.org:443 -alpn smtp
gives SMTP connection and
openssl s_client -connect example.org:443 -alpn imap
gives IMAP connection.

@link2xt
Copy link
Contributor Author

link2xt commented Jul 11, 2024

Related Delta Chat core PR making it request imap APLN: deltachat/deltachat-core-rust#5767
Need to make Delta Chat use smtp ALPN too (edit: deltachat/deltachat-core-rust#5769), then we can add port 443 with implicit TLS as a fallback third option into autoconfig.

@link2xt link2xt force-pushed the link2xt/stream-alpn-proxy branch 3 times, most recently from 13fec29 to b5cd2ac Compare July 11, 2024 05:59
@link2xt link2xt marked this pull request as ready for review July 11, 2024 07:10
map $ssl_preread_alpn_protocols $proxy {
default 127.0.0.1:8443;
~\bsmtp\b 127.0.0.1:465;
~\bimap\b 127.0.0.1:993;
Copy link
Contributor

Choose a reason for hiding this comment

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

does this mean that establishing SSL is done by imap/postfix still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is controlled by proxy_ssl which is off by default. Passing to plaintext port would not work, I think postfix and dovecot would not be happy about authentication before STARTTLS.

Comment on lines 16 to 17
~\bsmtp\b 127.0.0.1:465;
~\bimap\b 127.0.0.1:993;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use the /etc/service names of "imaps" and "smtps" here? i'd prefer that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to work

Copy link
Contributor

@hpk42 hpk42 left a comment

Choose a reason for hiding this comment

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

very nice!

Services are distinguished based on ALPN.
For example,
    openssl s_client -connect example.org:443 -alpn smtp
gives SMTP connection and
    openssl s_client -connect example.org:443 -alpn imap
gives IMAP connection.
@link2xt link2xt merged commit 283045d into main Jul 11, 2024
4 of 5 checks passed
@link2xt link2xt deleted the link2xt/stream-alpn-proxy branch July 11, 2024 10:30
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