Skip to content

Commit 8cc7515

Browse files
authored
Merge pull request #148 from DrDaveD/add-htdecode-ca-options
Have htdestroytoken handle CA cert path and file
2 parents 28b1b35 + 7abd8a9 commit 8cc7515

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

htdestroytoken

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@ usage()
1919
VERBOSE=true
2020
RMREFRESH=false
2121
HTGETOPTS=""
22+
CAFILE=""
23+
CAPATH="${X509_CERT_DIR:-/etc/grid-security/certificates}"
2224
for ARG; do
2325
case $ARG in
2426
-h) usage;;
2527
-q) VERBOSE=false; HTGETOPTS="$HTGETOPTS -q";;
2628
-f) RMREFRESH=true;;
2729
*) if $RMREFRESH; then
2830
HTGETOPTS="$HTGETOPTS $ARG"
31+
if [[ "$ARG" = "--cafile="* ]]; then
32+
CAFILE="${ARG#--cafile=}"
33+
elif [[ "$ARG" = "--capath="* ]]; then
34+
CAPATH="${ARG#--capath=}"
35+
fi
2936
else
3037
usage
3138
fi;;
@@ -54,8 +61,15 @@ if $RMREFRESH && [ -f "$VTFILE" ]; then
5461
echo " at path $BEARERURL"
5562
fi
5663
# be careful to not let the vault token show up in a ps list; send to stdin
64+
CURLOPTS="-q -f -m 5"
65+
if [ -n "$CAFILE" ]; then
66+
CURLOPTS="$CURLOPTS --cacert $CAFILE"
67+
fi
68+
if [ -n "$CAPATH" ]; then
69+
CURLOPTS="$CURLOPTS --capath $CAPATH"
70+
fi
5771
if ! (echo -n "X-Vault-Token: ";cat $VTFILE) | \
58-
curl -q -f -m 5 -H @- -X DELETE "$BEARERURL"; then
72+
curl $CURLOPTS -H @- -X DELETE "$BEARERURL"; then
5973
echo "$ME: Unable to delete refresh token" >&2
6074
exit 3
6175
fi

htgettoken.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ rm -rf $RPM_BUILD_ROOT
7777

7878
# - Have htdecodetoken take advantage of new scitokens-verify ability
7979
# to read from stdin, when available.
80+
# - Add support in htdestroytoken -f for getting a CA cert directory
81+
# from ${X509_CERT_DIR:-/etc/grid-security/certificates} or from
82+
# a --capath option, and to get a CA cert file from a --cafile option,
83+
# mirroring the behavior of htgettoken.
8084

8185
* Mon Dec 1 2025 Dave Dykstra <dwd@fnal.gov> 2.5-1
8286
- Add htdestroytoken -f option to force a removal of a refresh token in

0 commit comments

Comments
 (0)