@@ -22,9 +22,11 @@ my $check2run="-q --ip=one --color 0";
2222my $uri =" " ;
2323my $socket_out =" " ;
2424my $openssl_out =" " ;
25- # Blacklists we use to trigger an error:
25+ # Patterns used to trigger an error:
2626my $socket_regex_bl =' (e|E)rror|\.\/testssl\.sh: line |(f|F)atal|(c|C)ommand not found' ;
2727my $openssl_regex_bl =' (e|E)rror|(f|F)atal|\.\/testssl\.sh: line |Oops|s_client connect problem|(c|C)ommand not found' ;
28+ my $openssl_fallback_cmd =" " ; # empty for Linux
29+ my $os =" $^O" ;
2830
2931# useful against "failed to flush stdout" messages
3032STDOUT -> autoflush(1);
@@ -36,10 +38,26 @@ STDOUT->autoflush(1);
3638
3739die " Unable to open $prg " unless -f $prg ;
3840
39- $uri =" smtp-relay.gmail.com:587" ;
41+ if ( $os eq " darwin" ){
42+ # MacOS silicon doesn't have ~/bin/openssl.Darwin.arm64 binary so we use the
43+ # homebrew version which was moved to /opt/homebrew/bin/openssl.NOPE in
44+ # .github/workflows/unit_tests_macos.yml . The LibreSSL version from MacOS
45+ # sometimes have problems to finish the run, thus we use homebrew's version
46+ # as fallback.
47+ # If this will be run outside GH actions, i.e. locally, we provide a fallback to
48+ # /opt/homebrew/bin/openssl or just leave this thing
49+ if ( -x " /opt/homebrew/bin/openssl.NOPE" ) {
50+ $openssl_fallback_cmd =" --openssl /opt/homebrew/bin/openssl.NOPE" ;
51+ }
52+ elsif ( -x " /opt/homebrew/bin/openssl" ) {
53+ $openssl_fallback_cmd =" --openssl /opt/homebrew/bin/openssl" ;
54+ }
55+ }
4056
57+ $check2run_smtp =" $check2run_smtp $openssl_fallback_cmd " ;
4158
4259# 1
60+ $uri =" smtp-relay.gmail.com:587" ;
4361# unlink "tmp.json";
4462# we will have client simulations later, so we don't need to run everything again:
4563printf " \n %s \n " , " STARTTLS SMTP unit test via sockets --> $uri ..." ;
@@ -49,60 +67,34 @@ unlike($socket_out, qr/$socket_regex_bl/, "");
4967$tests ++;
5068
5169# 2
52- # unlink "tmp.json";
53- printf " \n %s \n " , " STARTTLS SMTP unit tests via OpenSSL --> $uri ..." ;
54- $openssl_out = ` $prg --ssl-native $check2run_smtp -t smtp $uri 2>&1` ;
55- # $openssl_json = json('tmp.json');
56- unlike($openssl_out , qr /$openssl_regex_bl / , " " );
57- $tests ++;
58-
5970$uri =" pop.gmx.net:110" ;
60-
61- # 3
6271# unlink "tmp.json";
6372printf " \n %s \n " , " STARTTLS POP3 unit tests via sockets --> $uri ..." ;
6473$socket_out = ` $prg $check2run -t pop3 $uri 2>&1` ;
6574# $socket_json = json('tmp.json');
6675unlike($socket_out , qr /$socket_regex_bl / , " " );
6776$tests ++;
6877
69- # 4
70- printf " \n %s \n " , " STARTTLS POP3 unit tests via OpenSSL --> $uri ..." ;
71- $openssl_out = ` $prg --ssl-native $check2run -t pop3 $uri 2>&1` ;
72- # $openssl_json = json('tmp.json');
73- unlike($openssl_out , qr /$openssl_regex_bl / , " " );
74- $tests ++;
75-
78+ # 3
7679$uri =" imap.gmx.net:143" ;
77-
78- # 5
7980# unlink "tmp.json";
8081printf " \n %s \n " , " STARTTLS IMAP unit tests via sockets --> $uri ..." ;
8182$socket_out = ` $prg $check2run -t imap $uri 2>&1` ;
8283# $socket_json = json('tmp.json');
8384unlike($socket_out , qr /$socket_regex_bl / , " " );
8485$tests ++;
8586
86- # 6
87- printf " \n %s \n " , " STARTTLS IMAP unit tests via OpenSSL --> $uri ..." ;
88- $openssl_out = ` $prg --ssl-native $check2run -t imap $uri 2>&1` ;
89- # $openssl_json = json('tmp.json');
90- unlike($openssl_out , qr /$openssl_regex_bl / , " " );
91- $tests ++;
92-
87+ # 4
9388$uri =" mail.tigertech.net:4190" ;
94-
95- # 7
9689# unlink "tmp.json";
9790printf " \n %s \n " , " STARTTLS MANAGE(SIEVE) unit tests via sockets --> $uri ..." ;
9891$socket_out = ` $prg $check2run -t sieve $uri 2>&1` ;
9992# $socket_json = json('tmp.json');
10093unlike($openssl_out , qr /$openssl_regex_bl / , " " );
10194$tests ++;
10295
96+ # 5
10397$uri =" jabber.org:5222" ;
104-
105- # 8
10698# unlink "tmp.json";
10799printf " \n %s \n " , " STARTTLS XMPP unit tests via sockets --> $uri ..." ;
108100$socket_out = ` $prg $check2run -t xmpp $uri 2>&1` ;
@@ -112,23 +104,15 @@ $tests++;
112104
113105# commented out, bc of travis' limits
114106#
115- # printf "\n%s\n", "STARTTLS XMPP unit tests via OpenSSL --> $uri ...";
116- # $openssl_out = `$prg --ssl-native $check2run -t xmpp $uri 2>&1`;
117- # $openssl_json = json('tmp.json');
118- # unlike($openssl_out, qr/$openssl_regex_bl/, "");
119- # $tests++;
120-
121107# $uri="jabber.ccc.de:5269";
122108# printf "\n%s\n", "Quick STARTTLS XMPP S2S unit tests via sockets --> $uri ...";
123109# $openssl_out = `$prg --openssl=/usr/bin/openssl -p $check2run -t xmpp-server $uri 2>&1`;
124110# # $openssl_json = json('tmp.json');
125111# unlike($openssl_out, qr/$openssl_regex_bl/, "");
126112# $tests++;
127113
128-
114+ # 6
129115$uri =" ldap.uni-rostock.de:21" ;
130-
131- # 9
132116# unlink "tmp.json";
133117printf " \n %s \n " , " STARTTLS FTP unit tests via sockets --> $uri ..." ;
134118$socket_out = ` $prg $check2run -t ftp $uri 2>&1` ;
@@ -138,50 +122,23 @@ $socket_out =~ s/ error querying OCSP responder .*\n//g;
138122unlike($socket_out , qr /$socket_regex_bl / , " " );
139123$tests ++;
140124
141- # commented out, bc of travis' limits
142- #
143- # printf "\n%s\n", "STARTTLS FTP unit tests via OpenSSL --> $uri ...";
144- # $openssl_out = `$prg --ssl-native $check2run -t ftp $uri 2>&1`;
145- # $openssl_json = json('tmp.json');
146- # OCSP stapling fails sometimes with: 'offered, error querying OCSP responder (ERROR: No Status found)'
147- # $openssl_out =~ s/ error querying OCSP responder .*\n//g;
148- # unlike($openssl_out, qr/$openssl_regex_bl/, "");
149- # $tests++;
150-
151-
125+ # 7
152126# https://ldapwiki.com/wiki/Public%20LDAP%20Servers
153127$uri =" db.debian.org:389" ;
154-
155- # 10
156128printf " \n %s \n " , " STARTTLS LDAP unit tests via sockets --> $uri ..." ;
157129$socket_out = ` $prg $check2run -t ldap $uri 2>&1` ;
158130# $socket_json = json('tmp.json');
159131unlike($socket_out , qr /$socket_regex_bl / , " " );
160132$tests ++;
161133
162- # 11
163- printf " \n %s \n " , " STARTTLS LDAP unit tests via OpenSSL --> $uri ..." ;
164- $openssl_out = ` $prg --ssl-native $check2run -t ldap $uri 2>&1` ;
165- # $openssl_json = json('tmp.json');
166- unlike($openssl_out , qr /$openssl_regex_bl / , " " );
167- $tests ++;
168-
169-
170134# For NNTP there doesn't seem to be reliable host out there
171135# $uri="144.76.182.167:119";
172136
173137# printf "\n%s\n", "STARTTLS NNTP unit tests via sockets --> $uri ...";
174138# $socket_out = `$prg $check2run -t nntp $uri 2>&1`;
175139# unlike($socket_out, qr/$socket_regex_bl/, "");
176140# $tests++;
177-
178- # commented out, bc of travis' limits
179- #
180- # printf "\n%s\n", "STARTTLS NNTP unit tests via OpenSSL --> $uri ...";
181- # $openssl_out = `$prg --ssl-native $check2run -t nntp $uri 2>&1`;
182- # $openssl_json = json('tmp.json');
183- # unlike($openssl_out, qr/$openssl_regex_bl/, "");
184- # $tests++;
141+ # also: commented out, bc of travis' limits
185142
186143# IRC: missing
187144# LTMP, mysql, postgres
0 commit comments