Skip to content

GHA/macos: enable HTTPS tests with stunnel #14486

Closed
AkiSakurai wants to merge 5 commits intocurl:masterfrom
AkiSakurai:macos
Closed

GHA/macos: enable HTTPS tests with stunnel #14486
AkiSakurai wants to merge 5 commits intocurl:masterfrom
AkiSakurai:macos

Conversation

@AkiSakurai
Copy link
Contributor

  • Install Stunnel.

  • Regenerate Certificates (as SecureTransport requires a validity period less than 398 days).

  • Restart Server if It Is Unresponsive.

  • Do Not Hardcode the SHA-256 Base64 Public Pinned Key.

  • Ignore test 313 as SecureTransport does not support crl file.

  • Ignore tests 1631 and 1632 as SecureTransport is not yet able to shut down FTP over HTTPS gracefully.

  • Add a CMake Target for generating certificates.

@github-actions github-actions bot added tests CI Continuous Integration labels Aug 11, 2024
@vszakats
Copy link
Member

Thank you @AkiSakurai for your updates!

I left one change suggestion regarding Makefile.inc and two tiny ones.

There were these test failures, then gone after a restart:
FAIL 2041: 'simple HTTPS GET with base64-sha256 public key pinning' HTTPS, HTTP GET, PEM certificate
https://github.com/curl/curl/actions/runs/10355416534/job/28663015869?pr=14486#step:15:4340

FAIL 515: 'make a POSTFIELDS set to NULL with POSTFIELDSIZE set to zero' HTTP, HTTP POST
https://github.com/curl/curl/actions/runs/10355416534/job/28663047488?pr=14486

FAIL 2037: 'simple HTTPS GET with PEM public key pinning' HTTPS, HTTP GET, PEM certificate
https://github.com/curl/curl/actions/runs/10355416534/job/28663025351?pr=14486#step:12:3828

FAIL 1429: 'HTTP GET with 999 response code' HTTP, HTTP GET, HTTP/0.9
https://github.com/curl/curl/actions/runs/10355416534/job/28663040268?pr=14486#step:12:3647

@dfandrich
Copy link
Contributor

dfandrich commented Aug 12, 2024 via email

@vszakats
Copy link
Member

We can do the regeneration on each run, for Secure Transport jobs.
And keep the original long-running certs in repo.

@AkiSakurai AkiSakurai changed the title tests: Enable HTTPS CI Test on macOS GHA/macos: enable HTTPS tests with stunnel Aug 14, 2024
AkiSakurai and others added 5 commits August 17, 2024 13:35
- Install Stunnel.

- Regenerate Certificates (as SecureTransport requires a validity period less than 398 days).

- Restart Server if It Is Unresponsive.

- Do Not Hardcode the SHA-256 Base64 Public Pinned Key.

- Ignore test 313 as SecureTransport does not support crl file.

- Ignore tests 1631 and 1632 as SecureTransport is not yet able to shut down FTP over HTTPS gracefully.

- Add a CMake Target for generating certificates.
@vszakats vszakats added the appleOS specific to an Apple operating system label Aug 20, 2024
@vszakats vszakats closed this in fa461b4 Aug 23, 2024
@vszakats
Copy link
Member

Thank you @AkiSakurai, merged!

vszakats added a commit to vszakats/curl that referenced this pull request Oct 2, 2024
Fixes intermittend CI failure because the shell-based random generator
generated the same number twice:
```
$ openssl ca -config EdelCurlRoot-ca.cnf -revoke Server-localhost0h-sv.crt
Using configuration from EdelCurlRoot-ca.cnf
ERROR:Already revoked, serial number 66FDB23A
make: *** [../../../tests/certs/Server-localhost0h-sv.pem] Error 1
```
https://github.com/curl/curl/actions/runs/11151401083/job/30994755798?pr=15128#step:10:498

Follow-up to fa461b4 curl#14486
Follow-up to fa69b41 curl#13307
vszakats added a commit that referenced this pull request Oct 2, 2024
Generate the certificate serial numbers automatically instead of doing
from shell (or Perl earlier).

Fixes intermittent CI failures due to the shell-based random generator
generating the same serial number twice:
```
$ openssl ca -config EdelCurlRoot-ca.cnf -revoke Server-localhost0h-sv.crt
Using configuration from EdelCurlRoot-ca.cnf
ERROR:Already revoked, serial number 66FDB23A
make: *** [../../../tests/certs/Server-localhost0h-sv.pem] Error 1
```
https://github.com/curl/curl/actions/runs/11151401083/job/30994755798?pr=15128#step:10:498

Follow-up to fa461b4 #14486
Follow-up to fa69b41 #13307
Closes #15129
vszakats added a commit that referenced this pull request Mar 27, 2025
Before this patch the curl repository and source tarball distribution
contained test certificates as binary blobs. Used by runtests.

Drop these certificates in favor of generating them dynamically as
part of the build process. Both via autotools and CMake.

As part of this, improve certificates, the generator script and process,
file layout, and fix any issue to make it work fast and smooth both in
CI and local builds.

Note, cert generator scripts require OpenSSL >=1.0.2
(or LibreSSL >=3.1.0). Generation requires POSIX shell, also with CMake.
Without a POSIX shell tests relying on TLS (and stunnel) will fail.

Details:

- build: generate certs as part of the test run process.
- build, tests: generate certs in the build directory.
- binarycheck: drop concept of known binary files with hashes.
- binarycheck: move binary check logic into spacecheck and drop this
  separate checker tool.
- build: fix to clean all cert files.
- autotools: fix to not run leaf cert generators in parallel. To avoid
  confusion when updating the revocation database and counter.
- scripts: drop `scripts` subdir, merge two scripts into one,
  auto-generate root cert, allow generating multiple leafs at once.
- scripts: switch to EC-256 keys (was: RSA-2048). For key size and perf.
- scripts: drop `-x` echo, text dumps, most other output. To avoid log
  noise and make it quicker in CI.
- scripts: make it non-RSA-specific.
- scripts: delete unused code.
- scripts: use POSIX shell shebang. Some envs don't have bash (Alpine).
- scripts: pass test pseudo-secrets via the command-line. To avoid:
  ```
  + openssl genrsa -out test-ca.key -passout fd:0 2048
  Invalid password argument, starting with "fd:"
  ```
- cmake: fix to launch generator scripts via the detected POSIX shell.
- cmake: fix `build-certs` rule to not depend on `SRPFILES`
  (`srp-verifier-*`).
- cmake: drop `EXCLUDE_FROM_ALL` for the cert subdir. It makes
  the Visual Studio generator miss to create the `clean-certs`,
  `build-certs` targets. No target depend on them, so they don't execute
  implicitly anyway. Fixes:
  ```
  MSBUILD : error MSB1009: Project file does not exist.
  Switch: clean-certs.vcxproj
  ```
- cmake: add `VERBATIM USES_TERMINAL` to `build-certs` target.
- GHA/linux: install openssl on Alpine, for the cert generator scripts.

Follow-up to 556f722 #16593
Follow-up to fa461b4 #14486

Closes #16824
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Generate the certificate serial numbers automatically instead of doing
from shell (or Perl earlier).

Fixes intermittent CI failures due to the shell-based random generator
generating the same serial number twice:
```
$ openssl ca -config EdelCurlRoot-ca.cnf -revoke Server-localhost0h-sv.crt
Using configuration from EdelCurlRoot-ca.cnf
ERROR:Already revoked, serial number 66FDB23A
make: *** [../../../tests/certs/Server-localhost0h-sv.pem] Error 1
```
https://github.com/curl/curl/actions/runs/11151401083/job/30994755798?pr=15128#step:10:498

Follow-up to fa461b4 curl#14486
Follow-up to fa69b41 curl#13307
Closes curl#15129
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Before this patch the curl repository and source tarball distribution
contained test certificates as binary blobs. Used by runtests.

Drop these certificates in favor of generating them dynamically as
part of the build process. Both via autotools and CMake.

As part of this, improve certificates, the generator script and process,
file layout, and fix any issue to make it work fast and smooth both in
CI and local builds.

Note, cert generator scripts require OpenSSL >=1.0.2
(or LibreSSL >=3.1.0). Generation requires POSIX shell, also with CMake.
Without a POSIX shell tests relying on TLS (and stunnel) will fail.

Details:

- build: generate certs as part of the test run process.
- build, tests: generate certs in the build directory.
- binarycheck: drop concept of known binary files with hashes.
- binarycheck: move binary check logic into spacecheck and drop this
  separate checker tool.
- build: fix to clean all cert files.
- autotools: fix to not run leaf cert generators in parallel. To avoid
  confusion when updating the revocation database and counter.
- scripts: drop `scripts` subdir, merge two scripts into one,
  auto-generate root cert, allow generating multiple leafs at once.
- scripts: switch to EC-256 keys (was: RSA-2048). For key size and perf.
- scripts: drop `-x` echo, text dumps, most other output. To avoid log
  noise and make it quicker in CI.
- scripts: make it non-RSA-specific.
- scripts: delete unused code.
- scripts: use POSIX shell shebang. Some envs don't have bash (Alpine).
- scripts: pass test pseudo-secrets via the command-line. To avoid:
  ```
  + openssl genrsa -out test-ca.key -passout fd:0 2048
  Invalid password argument, starting with "fd:"
  ```
- cmake: fix to launch generator scripts via the detected POSIX shell.
- cmake: fix `build-certs` rule to not depend on `SRPFILES`
  (`srp-verifier-*`).
- cmake: drop `EXCLUDE_FROM_ALL` for the cert subdir. It makes
  the Visual Studio generator miss to create the `clean-certs`,
  `build-certs` targets. No target depend on them, so they don't execute
  implicitly anyway. Fixes:
  ```
  MSBUILD : error MSB1009: Project file does not exist.
  Switch: clean-certs.vcxproj
  ```
- cmake: add `VERBATIM USES_TERMINAL` to `build-certs` target.
- GHA/linux: install openssl on Alpine, for the cert generator scripts.

Follow-up to 556f722 curl#16593
Follow-up to fa461b4 curl#14486

Closes curl#16824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appleOS specific to an Apple operating system CI Continuous Integration tests

Development

Successfully merging this pull request may close these issues.

3 participants