-
Notifications
You must be signed in to change notification settings - Fork 38
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
MS Windows native TLS (via Schannel SSP), IDN, and DNS SRV handling. GitHub releases for binaries. #163
base: master
Are you sure you want to change the base?
Conversation
Otherwise we need -Wno-incompatible-pointer-types at least with GCC 14.2 on MSYS2/UCRT64
# Conflicts: # configure.ac
The Windows platform is already supported out of the box, and up-to-date binary packages exist: https://packages.msys2.org/packages/mingw-w64-x86_64-msmtp?repo=mingw64 Why add more than 1000 lines of code that do not benefit any other platform, when that platform is already supported by code shared across all platforms? If the only benefits are avoiding dependencies on free libraries or reducing the binary size, then I don't think it's worth it. |
Indeed, the proposed changes do not benefit users of other platforms GitHub Actions aside. I think it is worth adding build tests for Linux and MacOS while at it unless you test it elsewhere (but I haven't seen anything mentioned on your web site or GH repo). However, I would like to make a case for Windows users.
I did not mean to drop a code bomb. It is just after Schannel it was only logical to use native implementation for the rest. I am willing to split PRs. |
I still see some need for discussions. Regarding your points:
|
I guess it is a faux pas to talk about file sizes in 2024🤷That is true static linking is a thing. However, I see no point to compile and link in something having functionality already provided by OS. Until "recently", there were too many ways to build stuff on Windows that were not ABI compatible. That is if you want Visual Studio and all, you'd have to build dependencies with MS compiler especially if it comes to C++. Definitely, UCRT64 (environment of MSYS2) and vcpkg make it easier to build 3rd party libraries and link now. Also Windows users aren't particularly inclined to deal with PEM files. Certificates and revocations should be handled by OS updates automagically. That is my main concern as it is very tempting to just set things once and never look back.
That is a can of There are also other use cases like https://portableapps.com/ to make it possible to run things without proper "installation". Which brings another issue.. fallback check for msmtp configuration file next to EXE but that is not urgent.
Why not both? I am in the more the better camp. Although not relevant for other platform, some might find it useful on Windows. In the end, it is just a file sitting in a repo that won't have any security implications for users of other platforms.
That was news to me (Apparently I didn't read news). I just had an impression the discouragement came from the tainted reputation from a while ago. It looks like quite a few API functions could be used but they aren't: time conversion (ASN1_TIME_to_tm), SNI host set up (SSL_set_tlsext_host_name), restricting cipher suites, and verification (using X509_VERIFY_PARAM). Also looks like newer version are automatically initialized and random seeded (I'm not sure if there is an easy way to check if it was explicitly disable during the build) and reseeded. Most of the grievances you brought up seem to be obsolete. If you have a personal issue with OpenSSL, I probably can take a stab at removing old code and using appropriate API while dropping old OpenSSL compatibility. I have a rather dumb question regarding restricting ciphers. What is the point to go into details with priorities and bits? It seems like every library has the capability to use only strong (whatever that means at a given instant) cryptography, e.g. set_security_level to 5. |
The point would be to avoid using system-specific libraries and give the existing portable code a wider exposure. Fixing a bug or implementing an improvement would then benefit all platforms, and could be done collaboratively by users on all platforms. That's an important point for small projects that lack resources.
With static binaries, there's no need for ABI compatibility.
GnuTLS already uses the Windows system default trust store when msmtp is used with
Seems like a shortcoming of Chocolatey to me ;)
Yes, it has an impact: it reduces the exposure of the portable code, and reduces the number of people that can work on fixing bugs or implementing improvements. In this sense a fourth TLS implementation amounts to Technical Debt; it is a liability rather than an asset.
Yes, there are many ways to improve the existing OpenSSL code, and for someone familiar with OpenSSL it's probably easy to do. I am personally frustrated with OpenSSL (and it shows in the news entry I wrote; sorry for that) and I just don't have the time to deal with a frustrating library when the alternatives are (in my personal view) far better, but of course I would be happy to accept any patches by others. Unfortunately the OpenSSL code in msmtp will not simply go away, as there are special purpose Linux distributions that depend on it and cannot currently use GnuTLS or libretls. So in effect we already experience technical debt and code as a liability. I don't want to add to the problem: once Windows users use an Schannel msmtp version, we cannot simply remove the code when nobody steps up to implement necessary improvements, and we get the same problem all over again.
There's always someone who wants full control, but you can still use simple presets. For example, with GnuTLS, you can use keywords such as "NORMAL" or "SECURE192" instead of fiddling with details. OpenSSL may be different; I did not look. |
What I meant is the way to build it, not run it. I'm not sure how you acquire Windows users and contributors. It is appealing when one can simply open Visual Studio and hit F5 to start debugging in a cozy and familiar IDE. However that route involves building of all underlying dependencies using MS tools. vcpkg project helps with those, but (base) PS C:\dev> vcpkg install libgnutls
Computing installation plan...
libgnutls is only supported on '!windows | mingw', which does not match x64-windows. This usually means that there are known build failures, or runtime problems, when building other platforms. To ignore this and attempt to build libgnutls anyway, rerun vcpkg with `--allow-unsupported`.
Apparently it is the case with OpenSSL 3.2+ as well, but for root certificates only. 😞
The main benefit is the ease of getting updates on that platform from diverse sources. So, yeah, no place for dependencies. It just seems "wrong" to pull dependencies from msys2 just to repack.
I am hesitating between dropping msmtp from Chocolatey completely or keeping a derivative patched up version with a clear indication of that for as long as it lasts 🤔 What somewhat bothers me about msys2 is the lack of "portability" in a sense of dropping necessary small stuff on a USB flash drive and run from there.
I don't mind to learn that library/suffer but it is a work in progress.
I didn't know that.
Understandable.
I am leaning toward using SSL_CONF_cmd in place of priorities besides using msmtp section in openssl.cnf. What is you take on testing? I am about to open PR on IDN while using |
Catering to the shortcomings of proprietary IDEs does not help to improve the quality of any software in my experience. That problem is better addressed with opening a feature or support request at your IDE vendor.
And it probably is. I recommend using MXE to build a cross-compiler and the required libraries, and then simply build a Windows static executable from a Linux system, so things can be scripted and automated. Something similar is probably also possible on Windows, it should even be simpler since there is no cross-compilation involved.
Thanks for that; it's merged :) |
Let's have an option to build msmtp using libraries provided by MS Windows. The produced portable executable is just 190kb with no external dependencies. It would be also nice to automatically upload a binary to GitHub Releases whenever a new version is tagged. I believe it should "just work" if merged.
Ultimately, I would like to have msmtp available via Chocolatey. I "packaged" it a while ago when it was hosted on SF but it needs an update badly.
There is some hiccup with IDN/locale when built with NLS/gettext. I have no idea what is causing it and why
_create_locale(LC_ALL, "")
works whilesetlocale(LC_ALL, "")
does not. My main use-case is with Emacs so I personally don't need NLS much.I can clean up/split/rebase commits as necessary.
Upddate: It looks like the implications of ENABLE_NLS affect console output only somehow. I suggest to
remove that conditional code completelycommit as is with broken output as long as IDN resolution works and wait until someone complains. It is impossible to test it properly on GitHub because if stdout/stderr are redirected it is "almost" not noticeable. Here is what I get on my local machine from NLS-enabled build with enabled UTF-8.Click me
Command Prompt
MSYS2
PowerShell