-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix FTP/SSL data stream closure causing protocol violation in .NET 10 #123234
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
Draft
Copilot
wants to merge
19
commits into
main
Choose a base branch
from
copilot/fix-ftp-ssl-upload-download
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8eeaa9d
Initial plan
Copilot 91a0177
Fix FTP/SSL data stream closure to properly close SslStream before Ne…
Copilot 19f4cc2
Address code review feedback - add null check for stream
Copilot 094cd71
Add FTP/SSL enterprise test infrastructure with ProFTPD server
Copilot d110002
Fix enterprise test build issues and consolidate FTP server into apac…
Copilot 5aff1b4
Add System.Net.Requests enterprise tests to CI pipeline
Copilot 63937fe
Add certificate validation callback for self-signed certs in FTP tests
Copilot 0d4b633
Add pragma warnings to suppress SYSLIB0014 for obsolete WebRequest/Ft…
Copilot 2e9e411
Fix SSL stream closure: set leaveInnerStreamOpen=true and add baselin…
Copilot 86d4451
Remove Skip attributes from enterprise tests to fix xUnit1004 build e…
Copilot c547668
Fix ProFTPD configuration and startup issues
Copilot d5b7ff8
Fix: Only apply leaveInnerStreamOpen=true to data stream, not control…
Copilot 27543e1
update
wfurt c07d040
mod_tls
wfurt 6b39538
proftpd-mod-crypto
wfurt 478251d
udpate containers
wfurt 2b463a5
Merge branch 'copilot/fix-ftp-ssl-upload-download' of https://github.…
wfurt 3cc0922
mod_auth_ntlm_winbind
wfurt d005e55
config
wfurt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 29 additions & 5 deletions
34
src/libraries/Common/tests/System/Net/EnterpriseTests/setup/apacheweb/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,48 @@ | ||
| FROM mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04 | ||
| FROM mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-24.04 | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install Kerberos client, apache Negotiate auth plugin, and diagnostics | ||
| # Install Kerberos client, ProFTPD with SSL, and diagnostics | ||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends apache2 libapache2-mod-auth-kerb procps krb5-user iputils-ping dnsutils nano \ | ||
| libapache2-mod-auth-ntlm-winbind samba samba-dsdb-modules samba-vfs-modules | ||
| apt-get install -y --no-install-recommends apache2 procps krb5-user iputils-ping dnsutils nano \ | ||
| samba samba-dsdb-modules samba-vfs-modules \ | ||
| proftpd-basic proftpd-mod-crypto openssl \ | ||
| apache2-dev libapache2-mod-auth-gssapi samba-ad-provision winbind | ||
| WORKDIR /setup | ||
|
|
||
| COPY ./common/krb5.conf /etc/ | ||
| COPY ./apacheweb/apache2.conf /setup/apache2.conf | ||
| COPY ./apacheweb/*.sh ./ | ||
| COPY ./apacheweb/mod_auth_ntlm_winbind/mod_auth_ntlm_winbind.c /tmp | ||
| RUN chmod +x *.sh ; \ | ||
| mkdir -p /setup/htdocs/auth/ntlm /setup/altdocs/auth/ntlm /setup/htdocs/auth/kerberos /setup/altdocs/auth/kerberos /setup/htdocs/auth/digest ;\ | ||
| touch /setup/htdocs/index.html /setup/htdocs/auth/kerberos/index.html /setup/htdocs/auth/ntlm/index.html /setup/htdocs/auth/digest/index.html ;\ | ||
| touch /setup/altdocs/auth/kerberos/index.html /setup/altdocs/auth/ntlm/index.html ;\ | ||
| cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.ORIG ;\ | ||
| mv -f apache2.conf /etc/apache2/apache2.conf | ||
| mv -f apache2.conf /etc/apache2/apache2.conf ;\ | ||
| cd /tmp && apxs -DAPACHE2 -c -i mod_auth_ntlm_winbind.c | ||
|
|
||
| # Setup FTP user and directories | ||
| RUN useradd -m -s /bin/bash ftpuser && \ | ||
| echo "ftpuser:ftppass" | chpasswd && \ | ||
| mkdir -p /home/ftpuser/ftp && \ | ||
| chown ftpuser:ftpuser /home/ftpuser/ftp && \ | ||
| mkdir -p /var/log/proftpd && \ | ||
| chmod 755 /var/log/proftpd | ||
|
|
||
| # Generate self-signed certificate for FTP TLS | ||
| RUN mkdir -p /etc/proftpd/ssl && \ | ||
| openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ | ||
| -keyout /etc/proftpd/ssl/proftpd.key \ | ||
| -out /etc/proftpd/ssl/proftpd.crt \ | ||
| -subj "/C=US/ST=State/L=City/O=Test/CN=apacheweb.linux.contoso.com" | ||
|
|
||
| # Copy ProFTPD configuration | ||
| COPY ./apacheweb/proftpd.conf /etc/proftpd/proftpd.conf | ||
|
|
||
| EXPOSE 80/tcp | ||
| EXPOSE 8080/tcp | ||
| EXPOSE 21/tcp | ||
| EXPOSE 50000-50100/tcp | ||
|
|
||
| ENTRYPOINT ["/bin/bash", "/setup/run.sh"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...ries/Common/tests/System/Net/EnterpriseTests/setup/apacheweb/mod_auth_ntlm_winbind/README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| OVERVIEW | ||
|
|
||
| The mod_auth_ntlm_winbind module provides authentication and | ||
| authorisation over the web against a Microsoft Windows NT/2000/XP or | ||
| Samba Domain Controller using Samba's winbind daemon running on the | ||
| same machine Apache 1.x or 2.x is running on. | ||
|
|
||
| Used only by IE and newer versions of the Mozilla browser family, the | ||
| NTLM over HTTP protocol is completed undocumented by Microsoft but has | ||
| been reverse engineered and described at the following URL: | ||
|
|
||
| http://davenport.sf.net/ntlm.html | ||
|
|
||
|
|
||
| INSTALLATION | ||
|
|
||
| The configure.in script and Makefile are essentially wrappers around | ||
| apxs, which should be able to do all the work by itself. Having said | ||
| that, the build/install process should simply be a matter of: | ||
|
|
||
| $ autoconf | ||
| $ ./configure | ||
| $ make | ||
| $ sudo make install | ||
|
|
||
| The configure script will attempt to locate apxs and httpd. It will | ||
| prefer apxs2 to apxs, and will use the httpd it finds to determine | ||
| whether it is building for Apache 1 or Apache 2. You can override the | ||
| detected settings using --with-apxs=/path/to/apxs and | ||
| --with-httpd=/path/to/httpd | ||
|
|
||
| In the event that the configure/Make combination doesn't work, you | ||
| should be able to do: | ||
|
|
||
| [Apache 1.x] | ||
| $ apxs -c -i mod_auth_ntlm_winbind.c | ||
|
|
||
| [Apache 2.x] | ||
| $ apxs -DAPACHE2 -c -i mod_auth_ntlm_winbind.c | ||
| (substitute apxs2 as appropriate) | ||
|
|
||
|
|
||
| CONFIGURATION | ||
|
|
||
| mod_auth_ntlm_winbind uses the same ntlm_auth helper as the Squid | ||
| proxy, so the same setup applies as for Squid: the winbindd_privileged | ||
| directory must be accessible by the webserver userid. The | ||
| configuration directives added by this module are as follows: | ||
|
|
||
| NTLMAuth | ||
| set to 'on' to activate NTLM authentication | ||
| NegotiateAuth | ||
| set to 'on' to activate Negotiate authentication | ||
| NTLMBasicAuthoritative | ||
| set to 'off' to allow access control to be passed along to lower | ||
| modules if the UserID is not known to this module | ||
| NTLMBasicAuth | ||
| set to 'on' to activate Basic authentication (for non-NTLM browsers) | ||
| NTLMBasicRealm | ||
| Realm to use for Basic authentication | ||
| NTLMAuthHelper | ||
| Location and arguments to the Samba ntlm_auth utility for NTLM auth | ||
| NegotiateAuthHelper | ||
| Location and arguments to the Samba ntlm_auth utility for Negotiate auth | ||
| PlaintextAuthHelper | ||
| Location and arguments to the Samba ntlm_auth utility for Plaintext auth | ||
|
|
||
|
|
||
| The following httpd.conf configuration describes an example | ||
| configuration for this module: | ||
|
|
||
| NTLM authentication: | ||
|
|
||
| <Directory "/srv/www/auth"> | ||
| AuthName "NTLM Authentication thingy" | ||
| NTLMAuth on | ||
| NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" | ||
| NTLMBasicAuthoritative on | ||
| AuthType NTLM | ||
| require valid-user | ||
| </Directory> | ||
|
|
||
| or, to enable 'NTLM+Negotiate' authentication too: | ||
|
|
||
| <Directory "/srv/www/auth"> | ||
| AuthName "NTLM Authentication thingy" | ||
| NTLMAuth on | ||
| NegotiateAuth on | ||
| NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" | ||
| NegotiateAuthHelper "/usr/bin/ntlm_auth --helper-protocol=gss-spnego" | ||
| NTLMBasicAuthoritative on | ||
| AuthType NTLM | ||
| AuthType Negotiate | ||
| require valid-user | ||
| </Directory> | ||
|
|
||
|
|
||
| To debug what is going on, add the following line to your httpd.conf | ||
| to enable debug messages to be written to the apache error log file: | ||
|
|
||
| LogLevel debug |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.