Skip to content

Commit c8534a3

Browse files
authored
Merge 207728d into fe4e6fe
2 parents fe4e6fe + 207728d commit c8534a3

10 files changed

Lines changed: 226 additions & 25 deletions

File tree

‎UPGRADING.adoc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ The new `-A filename` option defaults to trying to use a `nutauth.conf` file
8888
but not failing if one is not usable; any specific values can require use
8989
of such a file or to not even try reading one ('none' as the legacy default).
9090
See the updated manual pages for more details. [issues #3329, #3411]
91+
+
92+
NOTE: In a future NUT release, the default `configure` script handling for the
93+
`--with-ssl-client-validation=auto` option may be changed from `no` to `yes`.
9194
9295
- The `upsmon` and `upsstats.cgi` clients capable of connections to multiple
9396
NUT data servers, potentially in separately managed security realms, now

‎ci_build.sh‎

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

‎conf/upsd.conf.sample‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@
206206
# See 'docs/security.txt' or the Security chapter of NUT user manual
207207
# for more information on the SSL support in NUT.
208208
#
209-
# WARNING: Until https://github.com/networkupstools/nut/issues/3329 is solved,
210-
# not all stock NUT clients even have a way to present some certain certificate.
209+
# NOTE: You may have to use linkman:nutauth.conf[5] for stock and modernized
210+
# third-party NUT clients to even have a way to present some certain certificate.
211211

212212
# =======================================================================
213213
# DISABLE_WEAK_SSL <Boolean>

‎configure.ac‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ nut_ssl_lib=""
29152915
NUT_ARG_WITH([ssl], [enable SSL support (either NSS or OpenSSL)], [auto])
29162916
NUT_ARG_WITH([nss], [enable SSL support using Mozilla NSS], [auto])
29172917
NUT_ARG_WITH([openssl], [enable SSL support using OpenSSL], [auto])
2918-
NUT_ARG_WITH([ssl-client-validation], [enable SSL client certificate validation ability (currently requires NSS, beware issue #3329)], [auto])
2918+
NUT_ARG_WITH([ssl-client-validation], [enable SSL client certificate validation ability], [auto])
29192919

29202920
dnl Optionally reset/initialize the cache values shared by several backends
29212921
dnl if the check methods below never ran for all active code paths (one or more):
@@ -3001,7 +3001,8 @@ AS_CASE([${nut_with_ssl_client_validation}],
30013001
[yes|""], [nut_with_ssl_client_validation="yes"],
30023002
dnl TOTHINK: reject if openssl/none build?
30033003
[auto|*], [nut_with_ssl_client_validation="no"]
3004-
dnl Until #3329 is solved, auto==no
3004+
dnl Although #3329 is solved with NUT v2.8.5, for now keep auto==no
3005+
dnl TODO: Flip in a later release, e.g. v2.9.0?
30053006
)
30063007
NUT_REPORT_FEATURE([enable SSL client certificate validation],
30073008
[${nut_with_ssl_client_validation}], [],

‎docs/configure.txt‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,8 @@ Enable the `upsd` server-side ability to set up `CERTREQUEST` directive in
803803
`upsd.conf`, which lets the server reject clients which do not present a
804804
certificate.
805805

806-
WARNING: Until link:https://github.com/networkupstools/nut/issues/3329[issue
807-
#3329] is solved, not all stock NUT clients may even have a way to present
808-
some certain certificate.
806+
NOTE: You may have to use linkman:nutauth.conf[5] for stock and modernized
807+
third-party NUT clients to even have a way to present some certain certificate.
809808

810809
Read link:docs/security.txt[] for instructions on practical setup of SSL
811810
support.

‎docs/man/upsd.conf.txt‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,8 @@ by default, see `docs/security.txt` in NUT sources), you can specify whether
233233
Up until NUT release v2.8.5 this was a no-op when built with OpenSSL.
234234
Now this feature is supported with both OpenSSL and NSS backends.
235235
+
236-
WARNING: Until link:https://github.com/networkupstools/nut/issues/3329[issue
237-
#3329] is solved, not all stock NUT clients may even have a way to present
238-
some certain certificate.
236+
NOTE: You may have to use linkman:nutauth.conf[5] for stock and modernized
237+
third-party NUT clients to even have a way to present some certain certificate.
239238
+
240239
Possible values are:
241240
+

‎docs/security.txt‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,8 @@ NOTE: If the client does not send *any* certificate, the connection is closed.
620620
Like CA certificates, you can add many "trusted" client and CA certificates
621621
in server's certificate databases.
622622

623-
WARNING: Until link:https://github.com/networkupstools/nut/issues/3329[issue
624-
#3329] is solved, not all stock NUT clients may even have a way to present
625-
some certain certificate.
623+
NOTE: You may have to use linkman:nutauth.conf[5] for stock and modernized
624+
third-party NUT clients to even have a way to present some certain certificate.
626625

627626
upsmon (required): upsd authentication
628627
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎server/conf.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ static int parse_upsd_conf_args(size_t numargs, char **arg)
317317
# ifdef WITH_CLIENT_CERTIFICATE_VALIDATION
318318
/* CERTREQUEST (0 | 1 | 2) */
319319
if (!strcmp(arg[0], "CERTREQUEST")) {
320-
if (starts_with_digit && str_to_int(arg[1], &n, 10)) {
320+
if (starts_with_digit && str_to_int(arg[1], &n, 10)
321+
&& n >= NETSSL_CERTREQ_MIN && n <= NETSSL_CERTREQ_MAX
322+
) {
321323
certrequest = n;
322324
return 1;
323325
}

‎server/netssl.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ extern int certrequest;
4545
/* Required (cnx failed if no certificate or invalid CA chain) */
4646
#define NETSSL_CERTREQ_REQUIRE 2
4747

48+
/* For range-checks */
49+
#define NETSSL_CERTREQ_MIN NETSSL_CERTREQ_NO
50+
#define NETSSL_CERTREQ_MAX NETSSL_CERTREQ_REQUIRE
51+
4852
/* Similar to upscli_ssl_caps_descr() for client library,
4953
* but with more bells and whistles */
5054
const char *net_ssl_caps_descr(void);

‎tests/test_upsdconf.c‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static void check_value(const char *option, const char *value, int accepted, uin
104104
maxage = tracking_delay = 17;
105105
maxconn = 17;
106106
#ifdef WITH_CLIENT_CERTIFICATE_VALIDATION
107+
/* valid assignments are 0,1,2; if invalid remain what it was */
107108
certrequest = 2;
108109
#endif
109110
args[0] = xstrdup(option);
@@ -182,13 +183,16 @@ int main(void)
182183
printf("Widths: int=%" PRIuSIZE ", long=%" PRIuSIZE ", nfds_t=%" PRIuSIZE "\n",
183184
sizeof(int), sizeof(long), sizeof(nfds_t));
184185
for (i = 0; i < sizeof(options) / sizeof(options[0]); i++) {
186+
limit = !strcmp(options[i], "CERTREQUEST") ? NETSSL_CERTREQ_MAX : 0;
185187
previous = !strcmp(options[i], "CERTREQUEST") ? 2 : 17;
188+
#define EXPSET(x, y) (limit == 0 || limit >= x ? y : 0)
189+
#define EXPLIM(x) (limit == 0 || limit >= x ? x : previous)
186190
check_value(options[i], "0", 1, 0);
187-
check_value(options[i], "1", 1, 1);
188-
check_value(options[i], "2", 1, 2);
189-
check_value(options[i], "00015", 1, 15);
190-
check_value(options[i], "32 \t", 1, 32);
191-
check_value(options[i], "3600", 1, 3600);
191+
check_value(options[i], "1", EXPSET(1, 1), EXPLIM(1));
192+
check_value(options[i], "2", EXPSET(2, 1), EXPLIM(2));
193+
check_value(options[i], "00015", EXPSET(15, 1), EXPLIM(15));
194+
check_value(options[i], "32 \t", EXPSET(32, 1), EXPLIM(32));
195+
check_value(options[i], "3600", EXPSET(3600, 1), EXPLIM(3600));
192196
for (j = 0; j < sizeof(invalid) / sizeof(invalid[0]); j++)
193197
check_value(options[i], invalid[j], 0, previous);
194198

@@ -197,6 +201,9 @@ int main(void)
197201
limit = (uintmax_t)((nfds_t)-1);
198202
if (limit > (uintmax_t)LONG_MAX) limit = (uintmax_t)LONG_MAX;
199203
}
204+
else if (!strcmp(options[i], "CERTREQUEST")) {
205+
limit = (uintmax_t)(NETSSL_CERTREQ_MAX);
206+
}
200207
snprintf(number, sizeof(number), "%" PRIuMAX, limit - 1);
201208
check_value(options[i], number, 1, limit - 1);
202209
snprintf(number, sizeof(number), "%" PRIuMAX, limit);
@@ -212,7 +219,8 @@ int main(void)
212219
check_value("CERTREQUEST", "REQUIRE", 1, 2);
213220
check_value("CERTREQUEST", "require", 0, 2);
214221
/* ssl_init still owns the 0..2 domain check and its fatal error policy. */
215-
check_value("CERTREQUEST", "3", 1, 3);
222+
/*check_value("CERTREQUEST", "3", 1, 3);*/
223+
check_value("CERTREQUEST", "3", 0, 2);
216224
#endif
217225

218226
f = fopen(config_file, "w");

0 commit comments

Comments
 (0)