File tree Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Original file line number Diff line number Diff line change 44 setcode do
55 if Facter ::Util ::Resolution . which ( 'openssl' )
66 openssl_version = Facter ::Util ::Resolution . exec ( 'openssl version 2>&1' )
7- matches = %r{^OpenSSL ([\w .- ]+)( \s + FIPS)?( +) ([\d .]+)( +) ([\w .]+)( +) ([\d .]+)} . match ( openssl_version )
7+ matches = %r{^OpenSSL ([\w .]+)[ -]*(fips| FIPS)? + ([\d .]+) + ([\w .]+) + ([\d .]+) *( \( [ \w :. ]+ \) )? } . match ( openssl_version )
88 matches [ 1 ] if matches
99 end
1010 end
Original file line number Diff line number Diff line change 4545 end
4646
4747 it {
48- expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.0.1e-fips ' )
48+ expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.0.1e' )
4949 }
5050 end
5151 end
8888 }
8989 end
9090 end
91+
92+ describe 'openssl_version oracle7' do
93+ context 'with value' do
94+ before do
95+ allow ( Facter ::Util ::Resolution ) . to receive ( :which ) . with ( 'openssl' ) . and_return ( true )
96+ allow ( Facter ::Util ::Resolution ) . to receive ( :exec ) . with ( 'openssl version 2>&1' ) . and_return ( 'OpenSSL 1.0.2k-fips 26 Jan 2017' )
97+ end
98+
99+ it {
100+ expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.0.2k' )
101+ }
102+ end
103+ end
104+
105+ describe 'openssl_version oracle8' do
106+ context 'with value' do
107+ before do
108+ allow ( Facter ::Util ::Resolution ) . to receive ( :which ) . with ( 'openssl' ) . and_return ( true )
109+ allow ( Facter ::Util ::Resolution ) . to receive ( :exec ) . with ( 'openssl version 2>&1' ) . and_return ( 'OpenSSL 1.1.1k FIPS 25 Mar 2021' )
110+ end
111+
112+ it {
113+ expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.1.1k' )
114+ }
115+ end
116+ end
117+
118+ describe 'openssl_version debian11' do
119+ context 'with value' do
120+ before do
121+ allow ( Facter ::Util ::Resolution ) . to receive ( :which ) . with ( 'openssl' ) . and_return ( true )
122+ allow ( Facter ::Util ::Resolution ) . to receive ( :exec ) . with ( 'openssl version 2>&1' ) . and_return ( 'OpenSSL 1.1.1w 11 Sep 2023' )
123+ end
124+
125+ it {
126+ expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.1.1w' )
127+ }
128+ end
129+ end
130+
131+ describe 'openssl_version debian12' do
132+ context 'with value' do
133+ before do
134+ allow ( Facter ::Util ::Resolution ) . to receive ( :which ) . with ( 'openssl' ) . and_return ( true )
135+ allow ( Facter ::Util ::Resolution ) . to receive ( :exec ) . with ( 'openssl version 2>&1' ) . and_return ( 'OpenSSL 3.0.15 3 Sep 2024 (Library: OpenSSL 3.0.15 3 Sep 2024)' )
136+ end
137+
138+ it {
139+ expect ( Facter . value ( :openssl_version ) ) . to eq ( '3.0.15' )
140+ }
141+ end
142+ end
91143 end
92144 end
93145end
You can’t perform that action at this time.
0 commit comments