mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
packge/klish-plugin-sysrepo: add 'change cleartext-symmetric-key'
This update brings new support for editing cleartext-symmetric-keys with the 'change' command. The cleartext-symmetric-key is of type binary and its use differs between different key-formats. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -1,23 +1,49 @@
|
||||
#!/bin/sh
|
||||
# Prompt for a secret with confirmation, then encode and output it.
|
||||
#
|
||||
# Default mode: hash with mkpasswd (for system passwords)
|
||||
# askpass [OUTPUT]
|
||||
#
|
||||
# Base64 mode (-b): base64-encode (for keystore passphrases)
|
||||
# askpass -b [OUTPUT]
|
||||
#
|
||||
# If OUTPUT is given, result is written to the file.
|
||||
# If omitted, result is written to stdout.
|
||||
# shellcheck disable=SC3045
|
||||
|
||||
LABEL="New password"
|
||||
MODE=hash
|
||||
if [ "$1" = "-b" ]; then
|
||||
LABEL="Passphrase"
|
||||
MODE=base64
|
||||
shift
|
||||
fi
|
||||
OUTPUT=$1
|
||||
|
||||
read -r -s -p "New password: " password
|
||||
read -r -s -p "$LABEL: " secret
|
||||
>&2 echo
|
||||
read -r -s -p "Retype password: " password_again
|
||||
read -r -s -p "Retype $LABEL: " secret_again
|
||||
>&2 echo
|
||||
|
||||
if [ "$password" != "$password_again" ]; then
|
||||
echo "Passwords do not match, try again."
|
||||
if [ "$secret" != "$secret_again" ]; then
|
||||
echo "${LABEL}s do not match, try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$OUTPUT" ]; then
|
||||
echo "$password"
|
||||
exit 0
|
||||
if [ -z "$secret" ]; then
|
||||
echo "Empty $LABEL, try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$MODE" = "base64" ]; then
|
||||
encoded=$(printf '%s' "$secret" | base64 -w 0)
|
||||
else
|
||||
encoded=$(printf '%s\n' "$secret" | mkpasswd -s)
|
||||
fi
|
||||
|
||||
umask 0177
|
||||
echo "$password" | mkpasswd -s > "$OUTPUT"
|
||||
exit 0
|
||||
if [ -z "$OUTPUT" ]; then
|
||||
echo "$encoded"
|
||||
else
|
||||
printf '%s' "$encoded" > "$OUTPUT"
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
|
||||
sha256 6e098390be2a78a56cf94eecb9d28b11c1791dd2c364e59602bbd664b508fd57 klish-plugin-sysrepo-a4b1fae697b51614dc75989e8f4fc8d277689d16-git4.tar.gz
|
||||
sha256 7bfdaef838ee8bd3995140c40144abe79ff1c6391c7b48445e6728cd4e7e56a8 klish-plugin-sysrepo-2f14503c7ea6eb24c8adaf0cf2cf7a511114b09e-git4.tar.gz
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
KLISH_PLUGIN_SYSREPO_VERSION = a4b1fae697b51614dc75989e8f4fc8d277689d16
|
||||
KLISH_PLUGIN_SYSREPO_VERSION = 2f14503c7ea6eb24c8adaf0cf2cf7a511114b09e
|
||||
KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git
|
||||
#KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb
|
||||
#KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git
|
||||
|
||||
Reference in New Issue
Block a user