Commit Graph

7322 Commits

Author SHA1 Message Date
rillig 29f817563f mount_cd9660: remove unhandled option -i from getopt
Found by lint. While here, fix the other lint warning as well, as lint
still doesn't know that exit(3) doesn't return normally.
2022-10-16 16:26:35 +00:00
andvar c3ad0bdd7e fix various typos in documentation and comments.
mainly in words functionality, functional, function.
2022-10-15 21:53:21 +00:00
riastradh 811e9ec794 wdogctl(8): Minor tweak suggested by a passing umarell.
Plus another wording improvement.
2022-09-23 12:35:00 +00:00
uwe 7bdf691e15 wdogctl(8): fix -width in previous 2022-09-22 21:40:42 +00:00
riastradh 30c75eaa64 wdogctl(8): Rework prose and markup in man page.
No functional change.
2022-09-22 14:02:45 +00:00
riastradh 9b5a6c4d5c cgdconfig(8): Restore loop for password re-entry for non-shared keys.
Fixes mistake in previous which changed the semantics in the case
where _no_ keys are shared.
2022-09-13 10:14:32 +00:00
riastradh 4b3ee8b4fa cgdconfig(8): Gracefully handle failed verification with shared keys.
The first time each key is verified, if verification fails, we chuck
the failed key and try again with passphrase re-entry.

But if a key has already been verified, and verification fails,
assume something is wrong with the disk and fail.
2022-08-30 08:48:41 +00:00
mlelstv 1736420841 fix 32bit builds 2022-08-28 11:32:19 +00:00
hgutch ec184f3bfb Change back various occurrences of \*[Le], \*[Ge] (less/greater equal)
and \*(ua (upwards arrow) to literal "<=", ">=" and "^" whenever
appropriate (e.g., in code examples).
2022-08-28 10:48:15 +00:00
mlelstv c6dcfc105b Fix writing of corrected fsinfo.
Continue when fsinfo has been rewritten.
2022-08-28 10:20:25 +00:00
mlelstv 100b2229a1 Add REPORT_LUNS command. 2022-08-21 12:44:16 +00:00
mlelstv 657333c966 When extracting properties, don't bail for non-existent or invalid path
elements, but continue with next properry.
2022-08-21 07:51:30 +00:00
nat 5fc22d500a Revert to previous as the atf tests are still failing. 2022-08-17 23:36:48 +00:00
nat 5f38985994 Use existing address when setting parameters.
No need to specify address every time when setting broadcast address or
netmask.

Hopefully successfully re addresses PR bin/10911.
2022-08-17 12:35:10 +00:00
nat 2d7b3c2cc9 Revert to previous as atf tests were failing. 2022-08-16 22:31:24 +00:00
nat 728612bd0e No need address every time to specify broadcast and netmask.
Previously ifconfig would fail silently.

Addresses PR bin/10911.
2022-08-16 10:47:10 +00:00
riastradh 7605cff464 cgdconfig(8): Handle -P/-S for shared keys with -G too.
This way you can convert an existing parameters file to one that is
derived from a shared key, and derive other subkeys for other disks
from the same shared key.

	cgdconfig -G -S -o /etc/cgd/wd0.shared /etc/cgd/wd0
	cgdconfig -G -S -o /etc/cgd/wd1.shared \
		-P /etc/cgd/wd0.shared /etc/cgd/wd1

This way, if you enter the same new password both times, wd0.shared
and wd1.shared generate the same keys as wd0 and wd1, but only need
one password entry with `cgdconfig -C'.
2022-08-12 10:49:47 +00:00
riastradh 3adc7246cf cgdconfig(8): Add support for generating shared-key parameters files.
Usage model:

- Generate a parameters file that supports sharing its main key:

	cgdconfig -g -S -o /etc/cgd/wd0e -V gpt adiantum

- Make another parameters file that uses the same shared main key but
  derives an independent subkey from it:

	cgdconfig -g -S -P /etc/cgd/wd0e -o /etc/cgd/ld1e \
	    -V disklabel aes-cbc 256
2022-08-12 10:49:35 +00:00
riastradh 920e28df65 cgdconfig(8): Add support for shared keys.
New clause `shared <id> algorithm <alg> subkey <info>' in a keygen
block enables `cgdconfig -C' to reuse a key between different params
files, so you can, e.g., use a single password for multiple disks.
This is better than simply caching the password itself because:

- Hashing the password is expensive, so it should only be done once.

  Suppose your budget is time t before you get bored, and you
  calibrate password hash parameters to unlock n disks before you get
  bored waiting for `cgdconfig -C'.

  . With n password hashings the adversary's cost goes up only by a
    factor of t/n.
  . With one password hashing and n subkeys the adversary's cost goes
    up by a factor of n.

  And if you ever add a disk, rehashing it will make `cgdconfig -C'
  go over budget, whereas another subkey adds negligible cost to you.

- Subkeys work for other types of keygen blocks, like shell_cmd,
  which could be used to get a key from a hardware token that needs a
  button press.

The <info> parameter must be different for each params file;
everything else in the keygen block must be the same.  With this
clause, the keygen block determines a shared key used only to derive
keys; the actual key used by cgdconfig is derived from the shared key
by the specified algorithm.

The only supported algorithm is hkdf-hmac-sha256, which uses
HKDF-Expand of RFC 5869 instantiated with SHA-256.

Example:

	algorithm aes-cbc;
	iv-method encblkno1;
	keylength 128;
	verify_method none;
	keygen pkcs5_pbkdf2/sha1 {
		iterations 39361;
		salt AAAAgMoHiYonye6KogdYJAobCHE=;
		shared "pw" algorithm hkdf-hmac-sha256
		    subkey AAAAgFlw0BMQ5gY+haYkZ6JC+yY=;
	};

The key used for this disk will be derived by

	HKDF-HMAC-SHA256_k(WXDQExDmBj6FpiRnokL7Jg==),

where k is the outcome of PBKDF2-SHA1 with the given parameters.

Note that <info> encodes a four-byte prefix giving the big-endian
length in bits of the info argument to HKDF, just like all other bit
strings in cgdconfig parameters files.

If you have multiple disks configured using the same keygen block
except for the info parameter, `cgdconfig -C' will only prompt once
for your passphrase, generate a shared key k with PBKDF2 as usual,
and then reuse it for each of the disks.
2022-08-12 10:49:17 +00:00
riastradh 732db29a3c cgdconfig(8): New -T operation prints all generated keys in cgd.conf.
For testing purposes.
2022-08-12 10:48:44 +00:00
riastradh a7c16118d0 cgdconfig(8): New -t operation just prints the derived key in base64.
For testing purposes.
2022-08-12 10:48:27 +00:00
andvar 5a58ccfbec fix various typos in comments, documentation and messages.
mainly s/paramater/parameter/ and s/reduntant/redundant/.
2022-08-07 11:06:18 +00:00
rin 422de7d163 Assert postts only if we really obtained a timestamp. 2022-08-06 10:22:22 +00:00
rin eb7145dc97 Do not declare unused tstamp for SMALL. NFC. 2022-08-06 10:19:44 +00:00
rin 82dbd18ccf Get back to the statically-allocated tbuf.
If a string is longer than tbuf, it cannot be a timestamp.
Therefore, no need for buffering anymore in this case.
2022-08-06 10:16:18 +00:00
rin df7debb42d Oops, fix thinko in the previous. 2022-08-06 09:42:33 +00:00
rin 2a3cf2bf71 Do not discard \[.*\] which is not identified as a timestamp. 2022-08-06 09:39:32 +00:00
rin d67befb65b KNF. Do not unnecessarily define ADDC() for SMALL. No binary changes. 2022-08-06 09:33:56 +00:00
mlelstv 876fd04d2a Fix build on 32bit. 2022-07-31 13:49:23 +00:00
mlelstv fa449f06f2 Report error code (SCT/SC). 2022-07-31 12:11:44 +00:00
dholland 3ad018779f Fix misleading fsck_ffs messages about wapbl journal replay.
Apparently fsck doesn't have a way to replay it to its internal memory
only. (Someone(TM) should implement this...)

This means that if you use -n, it can't replay the journal. But the
sequence of prints is such that it looks like it did. This is quite
misleading. Add an additional specific warning.
2022-07-25 05:15:08 +00:00
kre 5c922bdb9e PR bin/56917
If getfsspecname() fails that will usually mean that a NAME=wedge or
ROOT.x partition is unabailable.   raidframe specified unavailable
partitions as "absent" so in this case, pass "absent" rather than the
unaltered NAME= or ROOT.x string, which the kernel has no clue what
do do with, and doesn't configure the raid at all.
2022-07-21 09:19:53 +00:00
mlelstv ac9df4c9d7 Whitespace 2022-07-16 12:57:14 +00:00
snj 91e84632a7 drop reference to smbfs, which was removed in 2020.
while here, s/file-system/file system/
2022-07-10 18:52:34 +00:00
wiz 52bbdadeb2 Fix At argument and remove superfluous Pp. 2022-07-01 16:58:02 +00:00
kre e1c098e157 Bring shutdown(8) into the 21st century.
I found this juxtaposition in the shutdown man page kind of
interesting:

     time  Time is the time at which shutdown will bring the system down
	   and may be the word now or a future time in one of two formats:
	   ... [2nd format:] [[[[[cc]yy]mm]dd]hh]mm,  ...
	   If the century [cc] is not specified, it defaults to 1900 for
	   years [yy] between 69 and 99, ...

In that, all the "[text]" except the one "[[[[["(etc) sequence are my
interjections, The ellipses ("...") represent where I omitted irrelevant
(for here) text.

Interesting yes, bizarre also.   Requiring a future time, and then
defaulting to the (long gone) 20th century (for any random year)
makes no sense at all.    So I fixed it.

In another hundred years or so, anytime from 2100 onwards, but best
left at least a decade into the new century, it will need altering again.
[One could write the code to automate this adjustment, but the man
page would still need updating.]   More significant changes will be
needed as the 101st century approaches (years 10000 and beyond), as
then a 2 digit century will no longer be adequate.   Call me then, and
if I'm able, I'll fix it.

If someone really has a need to schedule a shutdown for sometime
between 1969 and 1999 that can still be done by explicitly giving
the "19" cc value.  It is just no longer ever the default.

Otherwise, now, years 20..90 mean the 21st century (2020..2099)
(the first 2 of those are already unusable, but, IMO, that's OK)
and years 00..19 mean the 22nd century (2100..2119) (except that
00, 2100, is still technically the final year of the 21st century).

This is advance planning for near the end of the 21st century when
someone wants to schedule a shutdown for early in the following
century, and can't be bothered typing the 2 century digits.
2022-07-01 16:45:12 +00:00
kre d73b978a64 Implement "raidctl -t config-file"
This does the same config file parse  that -c/-C do, but only
that (hence no raidframe device is needed, or accepted).

Any syntax errors in the config file will be reported, nothing
else happens.
2022-06-14 08:06:18 +00:00
kre b958b2dc5a Fix some config file parsing.
First, and what got me started on this set of cleanups, the queue
length in the "queue" section (START queue) is limited to what will
fit in a char without losing accuracy (I tried setting it to 200,
rather than the more common (universal?) 100 and found that the
value configured into the array was -56 instead.

Why the value needs to be passed through a char variable I have no
idea (it is an int in the filesystem raidframe headers) - but that's
the way it is done, and changing it would be an ABI change I believe
(and so need versioning to alter) and that isn't worth it for this
(or not now, IMO).

Instead check that the value in the char is the same value as was
read from the config file, and complain if not.   Those of you with
unsigned chars will be able to have queue lengths up to 255, the
rest of us are limited to 127.

While looking at that, I noticed some code that obviously fails to
understand that scanf("%s") will never return a string containing
spaces, and proceeded to attempt to remove trailing spaces from the
result ... amusingly, after having used the result for its intended
purpose (non existent trailing spaces unremoved), after which that
buffer was never used again.   That code is now gone (but for now,
just #if 0'd rather than actually deleted - it should be cleaned up
sometime).

Then I saw some other issues with how the config was parsed - a
simple (unbounded) scanf("%s") into a buffer, which hypothetically
might not be large enough (not a security issue really, raidctl has
no special privs, and it isn't likely that root could easily be
tricked into running it on a bogus config file - or not without
looking first anyway, and a huge long string would rather stand
out).   Bound the string length to something reasonable, and
assert() that the buffer is big enough to contain it.

Lastly, in the event of one particular detected error in the
config file, the code would write a warning, but then just go
ahead and use the bad data (or nothing perhaps) anyway - a
failure of logic flow (unlikely to have ever happened, everyone
seems to simply copy the sample config from the man page, and
make minor adjustments as needed).

If any of these changes make any difference to anyone (except
me with my attempt to make longer queues - for no particularly
well thought out reason), I'd be very surprised.
2022-06-14 08:06:13 +00:00
kre 5a1ff55a3a In the previous (and some earlier) version(s) of raidctl.c
the following comment appeared:

	/*
	 * After NetBSD 9, convert this to not output the numRow's value,
	 * which is no longer required or ever used.
	 */

We are after NetBSD 9 (well after).   The change requested in that
comment is made here, and the comment is thus removed.

A couple of places in rf_configure.c where a value for the "rows"
parameter was output in an error message (always simply as the
constant 0) have also been updated (those messages will no longer
include "row 0", which they always said previously).   One of them
was also slightly reworded to be clearer what problem it was
experiencing (when it said 'unable to get device file' it meant
it was unable to locate the name for the device in the config file,
not that it was found, and there was some other problem with it).
2022-06-14 08:06:07 +00:00
kre 681f9ba5c2 Reorder the getopts() switch () (slightly) to sort the options. NFCI. 2022-06-14 08:06:01 +00:00
kre ee1e729e87 KNF (whitespace & 80 column limits) - NFCI.
This is the first of a series of 5 commits in this
directory, all coming within minutes or now.
2022-06-14 08:05:55 +00:00
nia 402b924225 revert bits and pieces I accidentally included in my last commit
from hannken
2022-06-06 13:28:55 +00:00
nia b7957d1677 build system: Revert all the recent additions of MK[...] knobs that
allow conditionally disabling the building of certain user space
programs in the 'base' set.

There is not enough consensus that this is the right way and a few
people had strong objections, see source-changes-d@.
2022-06-06 10:56:27 +00:00
andvar ff23aff6ad fix various typos in comments, documentation and messages. 2022-05-31 08:43:13 +00:00
andvar 09fb17927e fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.
2022-05-28 21:14:56 +00:00
nia cbb875961a mk: Add a MKLFS flag for excluding the log-structured filesystem userspace
tools from the build.
2022-05-27 07:28:20 +00:00
andvar cdc507f0d2 fix various typos in comment, documentation and log messages. 2022-05-24 20:50:17 +00:00
andvar 9f4a9600be fix various typos in comments, docs and log messages. 2022-05-24 06:27:59 +00:00
andvar f42f89fd6f fix various small typos, mainly in comments. 2022-05-22 11:27:33 +00:00
christos 7a3aa8fc03 Use the Makefile.inc from libargon2 (fixes the vax build that requires
a compiler hack).
2022-05-17 18:56:29 +00:00