Skip to content

Commit 236b558

Browse files
authored
Merge pull request #3435 from jimklimov/issue-3329
Introduce NUT "authconf" file support [#3329, #3411]
2 parents e837af2 + 3a7d4bb commit 236b558

79 files changed

Lines changed: 7396 additions & 590 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEWS.adoc

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ https://github.com/networkupstools/nut/milestone/13
5858
attempts on timeout errors, simplifying error recovery. [PR #3414]
5959
* Increased default TCP response timeout to 2000 ms. [PR #3418]
6060

61+
- `dummy-ups` driver updates:
62+
* Added `authconf` driver parameter for repeater mode to control
63+
authentication configuration discovery. It accepts `default`, `none`,
64+
or a specific authconf file path. [issue #3329]
65+
6166
- `nutdrv_qx` driver updates:
6267
* Only claim a USB device as "supported" during discovery out of the box
6368
if `subdriver_command` was assigned (`1A86:7523` is used by CH340/341
@@ -174,6 +179,8 @@ https://github.com/networkupstools/nut/milestone/13
174179
allows to pass the `certfile` argument needed for OpenSSL builds. [#3331]
175180
* The `libupsclient` (C) and `libnutclient` (C++) API were updated to
176181
report the ability to check `CERTIDENT` information. [#3331]
182+
* Introduced support for "authconf" files to store and convey NUT client
183+
authentication details. [issue #3329]
177184

178185
- Various clients:
179186
* Flush standard output and error buffers before handling clean exit
@@ -184,6 +191,29 @@ https://github.com/networkupstools/nut/milestone/13
184191
* Adjust scaling for small (single-digit) value ranges to avoid division
185192
by zero and not rendering anything. [issue #3469]
186193

194+
- `upsc`, `upscmd`, `upsrw` command-line client updates:
195+
* Enabled support for `nutauth.conf` files to provide credentials and/or
196+
SSL settings in the client which previously only did best-effort attempts
197+
at secure communications without an individual certificate, and only
198+
anonymously for reading. The new `-A filename` option defaults to trying
199+
to use a `nutauth.conf` file (if found in one of the default locations)
200+
but not failing if one is not usable; specific values can require use of
201+
such a file (`default`) or to not even try reading one (`none`).
202+
[issues #3329, #3411]
203+
204+
- `upslog` client/tool updates:
205+
* Added support for best-effort use of `nutauth.conf` files from default
206+
locations or via `-A` option, as described above. Since this client
207+
can establish multiple connections, keep in mind that currently it
208+
can only identify itself with some one (first seen) client certificate,
209+
if `CERTIDENT` settings are used. Multiple `CERTHOST` directives for
210+
specially trusted servers can be used. [#3329]
211+
212+
- `upsstats`, `upsset`, `upsimage` CGI client updates:
213+
* Added support for best-effort use of `nutauth.conf` files from default
214+
locations described above (no way to choose the location, other than
215+
by web-server environment variables for CGI calls). [#3329]
216+
187217
- `upsmon` client updates:
188218
* Introduced support for `CERTFILE` option, so the client can identify
189219
itself to the data server also in OpenSSL builds. [issue #3331]
@@ -229,6 +259,9 @@ https://github.com/networkupstools/nut/milestone/13
229259
much later (tell the sysadmin to increase `ulimit` or set up a more
230260
conservative `MAXCONN`). If there is a separate soft and hard limit,
231261
and `MAXCONN` exceeds the soft limit, try to raise the bar. [issue #3365]
262+
* If SSL configuration was provided, but the server failed to apply some
263+
aspect of that, it should now abort with an explanation (and not proceed
264+
with insecure start-up like it could do before). [issue #3331, PR #3435]
232265

233266
- Recipes, CI and helper script updates not classified above:
234267
* Introduced `ci_build.sh` settings and respective CI workflow settings
@@ -237,7 +270,9 @@ https://github.com/networkupstools/nut/milestone/13
237270
files. Both can be enabled by `export DO_USE_NUTCI_CACHE=yes` and would
238271
store data under a `${CI_CACHE_NUT_BASEDIR}` directory (defaults to
239272
`~/.cache/nut-ci`); more fine-tuning environment variables are provided.
240-
[issues #3108, #3390, #1711, PR #3109]
273+
Directory names are based on hashes of strings that identify the content,
274+
which are size-limited to some 8 characters.
275+
[issues #3108, #3390, #1711, #3526, PR #3109]
241276
* Rearranged the GHA job to prepare Dist and Docs Tarballs. [PR #3460]
242277
* Updated `scripts/Windows/dllldd.sh` helper script to better detect DLL
243278
names not exposed with dynamic linking metadata (e.g. some Mozilla NSS

UPGRADING.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ Changes from 2.8.5 to 2.8.6
5757
scriptlet, as far as specifying command arguments is concerned, but it also
5858
newly supports parsing multiple tokens as additional arguments. [PR #3499]
5959
60+
- Potentially a breaking change for existing deployments with some flaw in
61+
configuration of the `upsd` data server: If SSL configuration was provided,
62+
but the server failed to apply some aspect of that, it should now abort
63+
with an explanation (and not proceed with insecure start-up like it could
64+
do before). [issue #3331, PR #3435]
65+
66+
- Enabled support for `nutauth.conf` files to provide credentials and/or
67+
SSL settings in clients which previously only did best-effort attempts at
68+
secure communications without an individual certificate, and only anonymously
69+
for reading like `upsc`.
70+
+
71+
The new `-A filename` option defaults to trying to use a `nutauth.conf` file
72+
(if found in one of the default locations) but not failing if one is not
73+
usable; specific values can require use of such a file or to not even try
74+
reading one ('none' as the legacy default). See the updated manual pages
75+
for more details. [issues #3329, #3411]
76+
6077
Changes from 2.8.4 to 2.8.5
6178
---------------------------
6279

ci_build.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,10 +1149,14 @@ do_autogen_get_CONFIGURE_SCRIPT() {
11491149
}
11501150
11511151
discover_somehash_filter() {
1152+
# First, constrain hash string lengths for shorter logs and path lookups.
1153+
# KEEP IN SYNC WITH tests/NIT/nit.sh SCRIPT!
1154+
cut_filter() { sed -e 's,^\(....\).*\(....\)$,\1\2,'; }
1155+
11521156
for HASH_CMD in md5sum sha1sum sha256sum shasum cksum md5; do
11531157
if (command -v "$HASH_CMD") >/dev/null 2>/dev/null ; then
11541158
somehash_filter() {
1155-
"$HASH_CMD" | awk '{print $1}'
1159+
"$HASH_CMD" | awk '{print $1}' | cut_filter
11561160
}
11571161
return
11581162
fi
@@ -1165,15 +1169,15 @@ discover_somehash_filter() {
11651169
case "$OUT" in
11661170
*stdin*)
11671171
somehash_filter() {
1168-
openssl "$HASH_CMD" | awk '{print $NF}'
1172+
openssl "$HASH_CMD" | awk '{print $NF}' | cut_filter
11691173
}
11701174
return
11711175
;;
11721176
esac
11731177
done
11741178
fi
11751179
1176-
# Worst-case: use data size?
1180+
# Worst-case: use data size? Do not cut_filter here!
11771181
somehash_filter() {
11781182
wc -c
11791183
}
@@ -2817,7 +2821,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
28172821
FAILED+=("TESTCOMBO=${TESTCOMBO}[configure]")
28182822
# TOTHINK: Do we want to try clean-up if we likely have no Makefile?
28192823
if [ "$CI_FAILFAST" = true ]; then
2820-
echo "===== Aborting because CI_FAILFAST=$CI_FAILFAST" >&2
2824+
echo "===== [Matrix] Error: Aborting because CI_FAILFAST=$CI_FAILFAST" >&2
28212825
break
28222826
fi
28232827
BUILDSTODO="`expr $BUILDSTODO - 1`" || [ "$BUILDSTODO" = "0" ] || break
@@ -2833,7 +2837,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
28332837
RES_ALLERRORS=$?
28342838
FAILED+=("TESTCOMBO=${TESTCOMBO}[build]")
28352839
# Help find end of build (before cleanup noise) in logs:
2836-
echo "=== FAILED 'TESTCOMBO=${TESTCOMBO}' build"
2840+
echo "=== [Matrix] Error: FAILED 'TESTCOMBO=${TESTCOMBO}' build"
28372841
if [ "$CI_FAILFAST" = true ]; then
28382842
echo "===== Aborting because CI_FAILFAST=$CI_FAILFAST" >&2
28392843
break
@@ -2846,7 +2850,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
28462850
RES_ALLERRORS=$?
28472851
FAILED+=("TESTCOMBO=${TESTCOMBO}[check]")
28482852
# Help find end of build (before cleanup noise) in logs:
2849-
echo "=== FAILED 'TESTCOMBO=${TESTCOMBO}' check"
2853+
echo "=== [Matrix] Error: FAILED 'TESTCOMBO=${TESTCOMBO}' check"
28502854
if [ "$CI_FAILFAST" = true ]; then
28512855
echo "===== Aborting because CI_FAILFAST=$CI_FAILFAST" >&2
28522856
break
@@ -2874,7 +2878,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
28742878
RES_ALLERRORS=$?
28752879
FAILED+=("TESTCOMBO=${TESTCOMBO}[check-parallel-builds]")
28762880
# Help find end of build (before cleanup noise) in logs:
2877-
echo "=== FAILED 'TESTCOMBO=${TESTCOMBO}' check-parallel-builds"
2881+
echo "=== [Matrix] Error: FAILED 'TESTCOMBO=${TESTCOMBO}' check-parallel-builds"
28782882
if [ "$CI_FAILFAST" = true ]; then
28792883
echo "===== Aborting because CI_FAILFAST=$CI_FAILFAST" >&2
28802884
break
@@ -2948,7 +2952,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
29482952
29492953
if [ "$RES_ALLERRORS" != 0 ]; then
29502954
# Leading space is included in FAILED
2951-
echo "FAILED ${#FAILED[@]} build(s) with code ${RES_ALLERRORS}: ${FAILED[*]}" >&2
2955+
echo "[Matrix] Error: FAILED ${#FAILED[@]} build(s) with code ${RES_ALLERRORS}: ${FAILED[*]}" >&2
29522956
else
29532957
echo "(and no build scenarios had failed)" >&2
29542958
fi

clients/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ endif HAVE_CXX11
110110

111111
# Optionally deliverable as part of NUT public API:
112112
if WITH_DEV
113-
include_HEADERS = upsclient.h
113+
include_HEADERS = upsclient.h authconf.h
114114
if HAVE_CXX11
115115
include_HEADERS += nutclient.h nutclientmem.h
116116
else !HAVE_CXX11
@@ -170,7 +170,7 @@ upsstats_cgi_LDADD = $(LDADD_CLIENT) $(top_builddir)/common/libcommonstrjson.la
170170
# but it needs nut_version.h made before the rest of build,
171171
# to include it into upsclient.c (without an explicit link,
172172
# this target is sometimes missed in parallel builds):
173-
libupsclient_la_SOURCES = upsclient.c upsclient.h
173+
libupsclient_la_SOURCES = upsclient.c upsclient.h authconf.c authconf.h
174174

175175
# See comments for similar trick in common/Makefile.am for common-nut_version.c
176176
if BUILDING_IN_TREE
@@ -205,6 +205,7 @@ if WITH_SSL
205205
endif WITH_SSL
206206

207207
# Below we set API versions of public libraries
208+
# This includes changes to method signatures and struct content/sizes!
208209
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
209210
# Note that changes here may have to be reflected in packaging (the shared
210211
# object .so names would differ)

0 commit comments

Comments
 (0)