From d3b9c633d1b6a679672bf1f3aa22760dfcd77f7c Mon Sep 17 00:00:00 2001 From: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:44:00 -0500 Subject: [PATCH 1/2] add htdestroytoken, and htdecodetoken symlink --- htdestroytoken | 25 +++++++++++++++++++++++++ htgettoken.spec | 4 ++++ 2 files changed, 29 insertions(+) create mode 100755 htdestroytoken diff --git a/htdestroytoken b/htdestroytoken new file mode 100755 index 0000000..30e2264 --- /dev/null +++ b/htdestroytoken @@ -0,0 +1,25 @@ +#!/bin/bash + +VERBOSE=true +if [ "$1" = "-q" ]; then + VERBOSE=false + shift +fi + +if [ $# != 0 ]; then + echo "Usage: htdestroytoken [-q]" >&2 + echo "Removes bearer and vault tokens" >&2 + echo "-q means to do it silently" >&2 + exit 2 +fi + +# UID is a standard bash variable +TOKENFILE="${BEARER_TOKEN_FILE:-${XDG_RUNTIME_DIR:-/tmp}/bt_u$UID}" +for FILE in $TOKENFILE /tmp/vt_u$UID*; do + if [ -f "$FILE" ]; then + if $VERBOSE; then + echo "Removing $FILE" + fi + rm -f $FILE + fi +done diff --git a/htgettoken.spec b/htgettoken.spec index 8dd284a..76563cf 100644 --- a/htgettoken.spec +++ b/htgettoken.spec @@ -104,7 +104,9 @@ cat > $RPM_BUILD_ROOT%{_bindir}/%{name} <<'!EOF!' #!/bin/bash exec %{_libexecdir}/%{name}/%{name} "$@" !EOF! +cp htdestroytoken $RPM_BUILD_ROOT%{_bindir} cp httokendecode $RPM_BUILD_ROOT%{_bindir} +ln -s httokendecode $RPM_BUILD_ROOT%{_bindir}/htdecodetoken chmod +x $RPM_BUILD_ROOT%{_bindir}/* gzip -c %{name}.1 >$RPM_BUILD_ROOT%{_datadir}/man/man1/%{name}.1.gz @@ -125,6 +127,8 @@ rm -rf $RPM_BUILD_ROOT # Fix httokendecode -H functionality to only attempt to convert a parsed word # if it is entirely numeric, not if it just contains one digit. At the same # time, rewrite the functionality in native bash instead of using grep and sed. +# Add htdestroytoken command. +# Add a symlink htdecodetoken pointing to httokendecode. * Thu Jun 16 2022 Dave Dykstra 1.15-1 - Revert to prior method for allowing --vaultalias as an alternate name From 026850ab3d282d4224570d22db5ce370465065ee Mon Sep 17 00:00:00 2001 From: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:46:01 -0500 Subject: [PATCH 2/2] update to 1.16 --- htgettoken | 2 +- htgettoken.spec | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htgettoken b/htgettoken index 90f72a4..f069ac4 100755 --- a/htgettoken +++ b/htgettoken @@ -17,7 +17,7 @@ from __future__ import print_function prog = "htgettoken" -version = "1.15" +version = "1.16" import os import sys diff --git a/htgettoken.spec b/htgettoken.spec index 76563cf..785689c 100644 --- a/htgettoken.spec +++ b/htgettoken.spec @@ -2,7 +2,7 @@ Summary: Get OIDC bearer tokens by interacting with Hashicorp vault Name: htgettoken -Version: 1.15 +Version: 1.16 Release: 1%{?dist} License: BSD Group: Applications/System @@ -124,11 +124,12 @@ rm -rf $RPM_BUILD_ROOT %changelog -# Fix httokendecode -H functionality to only attempt to convert a parsed word -# if it is entirely numeric, not if it just contains one digit. At the same -# time, rewrite the functionality in native bash instead of using grep and sed. -# Add htdestroytoken command. -# Add a symlink htdecodetoken pointing to httokendecode. +* Wed Oct 12 2022 Dave Dykstra 1.16-1 +- Fix httokendecode -H functionality to only attempt to convert a parsed word + if it is entirely numeric, not if it just contains one digit. At the same + time, rewrite the functionality in native bash instead of using grep and sed. +- Add htdestroytoken command. +- Add a symlink htdecodetoken pointing to httokendecode. * Thu Jun 16 2022 Dave Dykstra 1.15-1 - Revert to prior method for allowing --vaultalias as an alternate name