Skip to content

Commit 388f3a3

Browse files
authored
Merge pull request #2761 from testssl/mac_runner
PoC github action runner macos-14
2 parents 242256b + a76e06f commit 388f3a3

13 files changed

+676
-560
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: CI run MacOS
3+
4+
on:
5+
pull_request:
6+
paths-ignore:
7+
- 'utils/**'
8+
- 'doc/**'
9+
- 'bin/**'
10+
- '**.md'
11+
- '**.pem'
12+
- '**.pdf'
13+
- '**.html'
14+
- 'LICENSE'
15+
- 'Dockerfile'
16+
- 'Dockerfile.alpine'
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
build:
23+
runs-on: macos-14
24+
25+
name: PoC unit test on MacOS
26+
steps:
27+
- name: checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up system (perl, curl is installed already)
31+
run: |
32+
brew install socat jsonlint cpanminus
33+
printf "%s\n" "----------"
34+
mv -v /opt/homebrew/bin/openssl /opt/homebrew/bin/openssl.NOPE
35+
printf "%s\n" "----------"
36+
perl -V
37+
printf "%s\n" "----------"
38+
curl --version
39+
printf "%s\n" "----------"
40+
openssl version -a
41+
printf "%s\n" "----------"
42+
bash --version
43+
printf "%s\n" "----------"
44+
45+
- name: Install perl modules
46+
run: |
47+
cpanm --notest Test::More
48+
cpanm --notest Data::Dumper
49+
cpanm --notest JSON
50+
cpanm --notest Text::Diff
51+
52+
- name: run it
53+
run: |
54+
prove -v t

.github/workflows/unit_tests_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: testssl.sh CI with Ubuntu
2+
name: CI run Ubuntu
33

44
on:
55
pull_request:

Readme.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
## Intro
33
![GitHub Tag](https://img.shields.io/github/v/tag/testssl/testssl.sh)
44
![Static Badge](https://img.shields.io/badge/%2Fbin%2Fbash_-blue)
5-
![Static Badge](https://img.shields.io/badge/OpenSSL_-blue)
5+
![Static Badge](https://img.shields.io/badge/Libre+OpenSSL_-blue)
66
[![License](https://img.shields.io/github/license/testssl/testssl.sh)](https://github.com/testssl/testssl.sh/LICENSE)
77
![GitHub Created At](https://img.shields.io/github/created-at/testssl/testssl.sh)
88
![GitHub last commit](https://img.shields.io/github/last-commit/testssl/testssl.sh)
99
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/testssl/testssl.sh)
10-
[![CI tests](https://github.com/testssl/testssl.sh/actions/workflows/unit_tests_ubuntu.yml/badge.svg)](https://github.com/testssl/testssl.sh/actions/workflows/unit_tests_ubuntu.yml)
10+
[![CI test Ubuntu](https://github.com/testssl/testssl.sh/actions/workflows/unit_tests_ubuntu.yml/badge.svg)](https://github.com/testssl/testssl.sh/actions/workflows/unit_tests_ubuntu.yml)
11+
[![CI test MacOS](https://github.com/testssl/testssl.sh/actions/workflows/unit_tests_macos.yml/badge.svg)](https://github.com/testssl/testssl.sh/actions/workflows/unit_tests_macos.yml)
1112
[![Docker](https://img.shields.io/docker/pulls/drwetter/testssl.sh)](https://github.com/testssl/testssl.sh/blob/3.2/Dockerfile.md)
1213
![Mastodon Follow](https://img.shields.io/mastodon/follow/109319848143024146?domain=infosec.exchange)
1314
[![Bluesky](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpublic.api.bsky.app%2Fxrpc%2Fapp.bsky.actor.getProfile%2F%3Factor%3Dtestssl.bsky.social&query=%24.followersCount&style=social&logo=bluesky&label=Follow%20%40testssl.sh)
@@ -30,6 +31,7 @@ cryptographic flaws.
3031
* Privacy: It's only you who sees the result, not a third party.
3132
* Freedom: It's 100% open source. You can look at the code, see what's going on.
3233
* The development is free and open @ GitHub and participation is welcome.
34+
* Unit tests ensure maturity (output is consistent, JSON is valid, runs under Linux+MacOS etc)
3335

3436
### License
3537

@@ -52,7 +54,7 @@ but you can also use any LibreSSL or OpenSSL version.
5254
(silent) check for binaries is done when you start testssl.sh . System V needs probably
5355
to have GNU grep installed. Windows (using MSYS2, Cygwin or WSL) work too.
5456

55-
Update notification here or @ [mastodon](https://infosec.exchange/@testssl) or [bluesky](https://bsky.app/profile/testssl.bsky.social). [twitter](https://twitter.com/drwetter) is not being used anymore.
57+
Update notification can be found here or most important ones @ [mastodon](https://infosec.exchange/@testssl) or [bluesky](https://bsky.app/profile/testssl.bsky.social). [twitter](https://twitter.com/drwetter) is not being used anymore.
5658

5759
### Installation
5860

etc/ca_hashes.txt

Lines changed: 518 additions & 518 deletions
Large diffs are not rendered by default.

t/00_testssl_help.t

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,42 @@ printf "\n%s\n", "Testing whether just calling \"./testssl.sh\" produces no erro
2424
my $info = stat($prg);
2525
my $retMode = $info->mode;
2626

27+
#1
2728
is($retMode & 0400, 0400, "Checking \"./testssl.sh\" for read permission");
2829
$tests++;
2930

31+
#2
3032
is($retMode & 0100, 0100, "Checking \"./testssl.sh\" for execute permission");
3133
$tests++;
3234

33-
$fileout = `timeout 10 bash $prg 2>&1`;
35+
$fileout = `bash $prg 2>&1`;
3436
my $retval=$?;
3537

38+
#3
3639
unlike($fileout, qr/$error_regexp1/, "regex 1");
3740
$tests++;
3841

42+
#4
3943
unlike($fileout, qr/$error_regexp2/, "regex 2");
4044
$tests++;
4145

46+
#5
4247
unlike($fileout, qr/$error_regexp3/, "regex 3");
4348
$tests++;
4449

50+
#6
4551
unlike($fileout, qr/$error_regexp4/, "regex 4");
4652
$tests++;
4753

54+
#7
4855
unlike($fileout, qr/$error_regexp5/, "regex 5");
4956
$tests++;
5057

58+
#8
5159
is($retval, 0, "return value should be equal zero: \"$retval\"");
5260
$tests++;
5361

62+
#9
5463
$out=`grep -E "$debug_regexp" $prg`;
5564
unlike($out, qr/$debug_regexp/, "Debug RegEx");
5665
$tests++;

t/01_testssl_banner.t

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,34 @@ my $error_regexp5='(syntax error|unexpected token)';
1717
my $good_regexp='free software([\s\S]*)USAGE w/o ANY WARRANTY([\s\S]*)OWN RISK([\s\S]*)Using([\s\S]*)ciphers([\s\S]*)built([\s\S]*)platform';
1818

1919
printf "\n%s\n", "Testing whether just calling \"./testssl.sh --banner\" produces no error ...";
20-
$fileout = `timeout 10 bash ./testssl.sh --banner 2>&1`;
20+
$fileout = `bash ./testssl.sh --banner 2>&1`;
2121
my $retval=$?;
2222

23+
#1
2324
unlike($fileout, qr/$error_regexp1/, "regex 1");
2425
$tests++;
2526

27+
#2
2628
unlike($fileout, qr/$error_regexp2/, "regex 2");
2729
$tests++;
2830

31+
#3
2932
unlike($fileout, qr/$error_regexp3/, "regex 3");
3033
$tests++;
3134

35+
#4
3236
unlike($fileout, qr/$error_regexp4/, "regex 4");
3337
$tests++;
3438

39+
#5
3540
unlike($fileout, qr/$error_regexp5/, "regex 5");
3641
$tests++;
3742

43+
#6
3844
like($fileout, qr/$good_regexp/, "regex positive");
3945
$tests++;
4046

47+
#7
4148
is($retval, 0, "return value should be equal zero: \"$retval\"");
4249
$tests++;
4350

t/02_clientsim_txt_parsable.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ my $error_regexp2='client-simulation.txt:';
1414

1515
printf "\n%s\n", "Testing whether \"~/etc/client-simulation.txt\" isn't broken ...";
1616
$fileout = `bash ./etc/client-simulation.txt 2>&1`;
17+
18+
#1
1719
unlike($fileout, qr/$error_regexp1/, "regex 1");
1820
$tests++;
1921

22+
#2
2023
unlike($fileout, qr/$error_regexp2/, "regex 2");
2124
$tests++;
2225

t/05_ca_hashes_up_to_date.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
use strict;
44
use Test::More;
55

6-
printf "\n%s\n", "Testing whether CA certificates are newer their SPKI hashes \"~/etc/ca_hashes.txt\" ...";
6+
printf "\n%s\n", "Make sure CA certificate stores are older than their SPKI hashes \"~/etc/ca_hashes.txt\" ...";
77

88
my $newer_bundles=`find etc/*.pem -newer etc/ca_hashes.txt`;
9-
is($newer_bundles,"","Checking if there's an output with a *.pem file run \"~/utils/create_ca_hashes.sh\"");
9+
10+
#1
11+
is($newer_bundles,"","Checking if there's an output with a *.pem file. If so: run \"~/utils/create_ca_hashes.sh\"");
1012

1113
printf "\n";
1214
done_testing;

t/10_baseline_ipv4_http.t

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ my $socket_out="";
2222
my $openssl_out="";
2323
my $socket_json="";
2424
my $openssl_json="";
25-
#FIXME: Blacklists we use to trigger an error, but likely we can skip that and instead we should?/could use
25+
#FIXME: Pattern we use to trigger an error, but likely we can skip that and instead we should?/could use the following??
2626
# @args="$prg $check2run $uri >/dev/null";
2727
# system("@args") == 0
2828
# or die ("FAILED: \"@args\" ");
@@ -38,23 +38,26 @@ unlink $tmp_json;
3838

3939
# Title
4040
printf "\n%s\n", "Baseline unit test IPv4 against \"$uri\"";
41-
42-
#1
4341
$socket_out = `$prg $check2run $uri 2>&1`;
4442
$socket_json = json($tmp_json);
43+
44+
#1
4545
unlike($socket_out, qr/$socket_errors/, "via sockets, checking terminal output");
4646
$tests++;
47+
48+
#2
4749
unlike($socket_json, qr/$json_errors/, "via sockets checking JSON output");
4850
$tests++;
4951

5052
unlink $tmp_json;
5153

52-
53-
#2
54+
#3
5455
$openssl_out = `$prg --ssl-native $check2run $uri 2>&1`;
5556
$openssl_json = json($tmp_json);
5657
unlike($openssl_out, qr/$openssl_errors/, "via (builtin) OpenSSL, checking terminal output");
5758
$tests++;
59+
60+
#4
5861
unlike($openssl_json, qr/$json_errors/, "via OpenSSL (builtin) checking JSON output");
5962
$tests++;
6063

t/21_baseline_starttls.t

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,66 +35,71 @@ die "Unable to open $prg" unless -f $prg;
3535

3636
$uri="smtp-relay.gmail.com:587";
3737

38-
# we will have client simulations later, so we don't need to run everything again:
38+
39+
#1
3940
# unlink "tmp.json";
41+
# we will have client simulations later, so we don't need to run everything again:
4042
printf "\n%s\n", "STARTTLS SMTP unit test via sockets --> $uri ...";
4143
$socket_out = `./testssl.sh $check2run_smtp -t smtp $uri 2>&1`;
4244
# $socket_json = json('tmp.json');
4345
unlike($socket_out, qr/$socket_regex_bl/, "");
4446
$tests++;
4547

48+
#2
4649
# unlink "tmp.json";
4750
printf "\n%s\n", "STARTTLS SMTP unit tests via OpenSSL --> $uri ...";
4851
$openssl_out = `./testssl.sh --ssl-native $check2run_smtp -t smtp $uri 2>&1`;
4952
# $openssl_json = json('tmp.json');
5053
unlike($openssl_out, qr/$openssl_regex_bl/, "");
5154
$tests++;
5255

53-
5456
$uri="pop.gmx.net:110";
5557

58+
#3
5659
# unlink "tmp.json";
5760
printf "\n%s\n", "STARTTLS POP3 unit tests via sockets --> $uri ...";
5861
$socket_out = `./testssl.sh $check2run -t pop3 $uri 2>&1`;
5962
# $socket_json = json('tmp.json');
6063
unlike($socket_out, qr/$socket_regex_bl/, "");
6164
$tests++;
6265

66+
#4
6367
printf "\n%s\n", "STARTTLS POP3 unit tests via OpenSSL --> $uri ...";
6468
$openssl_out = `./testssl.sh --ssl-native $check2run -t pop3 $uri 2>&1`;
6569
# $openssl_json = json('tmp.json');
6670
unlike($openssl_out, qr/$openssl_regex_bl/, "");
6771
$tests++;
6872

69-
7073
$uri="imap.gmx.net:143";
7174

75+
#5
7276
# unlink "tmp.json";
7377
printf "\n%s\n", "STARTTLS IMAP unit tests via sockets --> $uri ...";
7478
$socket_out = `./testssl.sh $check2run -t imap $uri 2>&1`;
7579
# $socket_json = json('tmp.json');
7680
unlike($socket_out, qr/$socket_regex_bl/, "");
7781
$tests++;
7882

83+
#6
7984
printf "\n%s\n", "STARTTLS IMAP unit tests via OpenSSL --> $uri ...";
8085
$openssl_out = `./testssl.sh --ssl-native $check2run -t imap $uri 2>&1`;
8186
# $openssl_json = json('tmp.json');
8287
unlike($openssl_out, qr/$openssl_regex_bl/, "");
8388
$tests++;
8489

85-
8690
$uri="mail.tigertech.net:4190";
8791

92+
#7
8893
# unlink "tmp.json";
8994
printf "\n%s\n", "STARTTLS MANAGE(SIEVE) unit tests via sockets --> $uri ...";
9095
$socket_out = `./testssl.sh $check2run -t sieve $uri 2>&1`;
9196
# $socket_json = json('tmp.json');
9297
unlike($openssl_out, qr/$openssl_regex_bl/, "");
9398
$tests++;
9499

95-
96100
$uri="jabber.org:5222";
97101

102+
#8
98103
# unlink "tmp.json";
99104
printf "\n%s\n", "STARTTLS XMPP unit tests via sockets --> $uri ...";
100105
$socket_out = `./testssl.sh $check2run -t xmpp $uri 2>&1`;
@@ -120,6 +125,7 @@ $tests++;
120125

121126
$uri="ldap.uni-rostock.de:21";
122127

128+
#9
123129
# unlink "tmp.json";
124130
printf "\n%s\n", "STARTTLS FTP unit tests via sockets --> $uri ...";
125131
$socket_out = `./testssl.sh $check2run -t ftp $uri 2>&1`;
@@ -143,12 +149,14 @@ $tests++;
143149
# https://ldapwiki.com/wiki/Public%20LDAP%20Servers
144150
$uri="db.debian.org:389";
145151

152+
#10
146153
printf "\n%s\n", "STARTTLS LDAP unit tests via sockets --> $uri ...";
147154
$socket_out = `./testssl.sh $check2run -t ldap $uri 2>&1`;
148155
# $socket_json = json('tmp.json');
149156
unlike($socket_out, qr/$socket_regex_bl/, "");
150157
$tests++;
151158

159+
#11
152160
printf "\n%s\n", "STARTTLS LDAP unit tests via OpenSSL --> $uri ...";
153161
$openssl_out = `./testssl.sh --ssl-native $check2run -t ldap $uri 2>&1`;
154162
# $openssl_json = json('tmp.json');
@@ -172,12 +180,10 @@ $tests++;
172180
#unlike($openssl_out, qr/$openssl_regex_bl/, "");
173181
#$tests++;
174182

175-
176183
# IRC: missing
177184
# LTMP, mysql, postgres
178185

179186

180-
181187
done_testing($tests);
182188
# unlink "tmp.json";
183189

0 commit comments

Comments
 (0)