Skip to content

Commit 47e68ca

Browse files
authored
Merge pull request php-http#54 from flavioheleno/fix/ssl-macos
Added instructions for generating ssl files on macOS
2 parents 5591086 + 35338fc commit 47e68ca

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ $ ./vendor/bin/http_test_server > /dev/null 2>&1 &
3131
Then generate ssh certificates:
3232

3333
```bash
34-
$ cd ./tests/server/ssl
34+
$ cd ./tests/server/ssl
3535
$ ./generate.sh
36-
$ cd ../../../
36+
$ cd ../../../
3737
```
3838

39+
Note: If you are running this on macOS and get the following error: "Error opening CA Private Key privkey.pem", check [this](ssl-macOS.md) file.
40+
3941
Now run the test suite:
4042

4143
``` bash

ssl-macOS.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Generating SSL Certificates on macOS
2+
3+
When generating SSL Certificates on macOS, you must ensure that you're using brew's openssl binary and not the one provided by the OS.
4+
5+
To do that, find out where your openssl is installed by running:
6+
7+
```bash
8+
$ brew info openssl
9+
```
10+
11+
You should see something like this:
12+
13+
```
14+
[email protected]: stable 1.1.1i (bottled) [keg-only]
15+
Cryptography and SSL/TLS Toolkit
16+
https://openssl.org/
17+
/usr/local/Cellar/[email protected]/1.1.1i (8,067 files, 18.5MB)
18+
Poured from bottle on 2020-12-11 at 11:31:46
19+
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
20+
License: OpenSSL
21+
==> Caveats
22+
A CA file has been bootstrapped using certificates from the system
23+
keychain. To add additional certificates, place .pem files in
24+
/usr/local/etc/[email protected]/certs
25+
26+
and run
27+
/usr/local/opt/[email protected]/bin/c_rehash
28+
29+
[email protected] is keg-only, which means it was not symlinked into /usr/local,
30+
because macOS provides LibreSSL.
31+
32+
If you need to have [email protected] first in your PATH run:
33+
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> /Users/flavio/.bash_profile
34+
35+
For compilers to find [email protected] you may need to set:
36+
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
37+
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
38+
39+
For pkg-config to find [email protected] you may need to set:
40+
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
41+
42+
==> Analytics
43+
install: 855,315 (30 days), 2,356,331 (90 days), 7,826,269 (365 days)
44+
install-on-request: 139,236 (30 days), 373,801 (90 days), 1,120,685 (365 days)
45+
build-error: 0 (30 days)
46+
```
47+
48+
The important part is this:
49+
50+
> echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> /Users/flavio/.bash_profile
51+
52+
Instead of running `./tests/server/ssl/generate.sh`, you should instead run:
53+
54+
```bash
55+
$ PATH="/usr/local/opt/[email protected]/bin ./tests/server/ssl/generate.sh
56+
```
57+
58+
You should now be good to go.

0 commit comments

Comments
 (0)