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 4
4
setcode do
5
5
if Facter ::Util ::Resolution . which ( 'openssl' )
6
6
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 )
8
8
matches [ 1 ] if matches
9
9
end
10
10
end
Original file line number Diff line number Diff line change 45
45
end
46
46
47
47
it {
48
- expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.0.1e-fips ' )
48
+ expect ( Facter . value ( :openssl_version ) ) . to eq ( '1.0.1e' )
49
49
}
50
50
end
51
51
end
88
88
}
89
89
end
90
90
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
91
143
end
92
144
end
93
145
end
You can’t perform that action at this time.
0 commit comments