| |
@@ -3,7 +3,7 @@
|
| |
# Created by argbash-init v2.10.0
|
| |
# ARG_OPTIONAL_SINGLE([user],[u],[Fedora account name],[$USER])
|
| |
# ARG_OPTIONAL_BOOLEAN([staging],[],[Use the staging infrastructure])
|
| |
- # ARG_HELP([Acquire a Kerberos ticket-granting ticket for Fedora])
|
| |
+ # ARG_HELP([Acquire a Kerberos ticket-granting ticket for Fedora],[If the environment variable \$FKINIT_OTP is set, it will be read for the one-time password instead of prompting for it.])
|
| |
# ARGBASH_GO()
|
| |
# needed because of Argbash --> m4_ignore([
|
| |
### START OF CODE GENERATED BY Argbash v2.10.0 one line above ###
|
| |
@@ -37,8 +37,9 @@
|
| |
printf '%s\n' "Acquire a Kerberos ticket-granting ticket for Fedora"
|
| |
printf 'Usage: %s [-u|--user <arg>] [--(no-)staging] [-h|--help]\n' "$0"
|
| |
printf '\t%s\n' "-u, --user: Fedora account name (default: '$USER')"
|
| |
- printf '\t%s\n' "--staging: Use the staging infrastructure (off by default)"
|
| |
+ printf '\t%s\n' "--staging, --no-staging: Use the staging infrastructure (off by default)"
|
| |
printf '\t%s\n' "-h, --help: Prints help"
|
| |
+ printf '\n%s\n' "If the environment variable \$FKINIT_OTP is set, it will be read for the one-time password instead of prompting for it."
|
| |
}
|
| |
|
| |
|
| |
@@ -59,8 +60,9 @@
|
| |
-u*)
|
| |
_arg_user="${_key##-u}"
|
| |
;;
|
| |
- --staging)
|
| |
+ --no-staging|--staging)
|
| |
_arg_staging="on"
|
| |
+ test "${1:0:5}" = "--no-" && _arg_staging="off"
|
| |
;;
|
| |
-h|--help)
|
| |
print_help
|
| |
@@ -104,9 +106,9 @@
|
| |
kinit -n @$domain -c FILE:$armorcache
|
| |
|
| |
F_PASSWORD=$(systemd-ask-password "FAS password:")
|
| |
- F_OTP=$(systemd-ask-password "FAS OTP (leave blank if not configured):")
|
| |
+ F_OTP=${FKINIT_OTP:-$(systemd-ask-password "FAS OTP (leave blank if not configured):")}
|
| |
|
| |
- echo -n ${F_PASSWORD}${F_OTP} | kinit -T FILE:$armorcache $_arg_user@$domain >/dev/null
|
| |
+ kinit -T FILE:$armorcache $_arg_user@$domain <<< "${F_PASSWORD}${F_OTP}" >/dev/null
|
| |
unset F_PASSWORD
|
| |
unset F_OTP
|
| |
|
| |
The first patch replaces the use of
echo
with a bash "here string" to avoid putting the password and OTP into the process table. This will avoid a potential attack vector on a shared system.The second patch resolves ticket #180 and will skip prompting for the OTP if it has been passed as the environment variable
$F_OTP
to the process.