Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11724346
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/bin/getcredentials b/bin/getcredentials
index 9a02f12..a074da6 100755
--- a/bin/getcredentials
+++ b/bin/getcredentials
@@ -1,71 +1,71 @@
#!/bin/sh
#
# Gets credentials information from Phabricator Passphrase application
#
# Usage: getcredentials <id> [data]
#
# - id: an integer matching the credential ID on Passphrase
# e.g. 17 for K17
# - data: the property to retrieve
# password, username or title
# If omitted, the password will be retrieved
#
-# This script requires:
+# This script requires:
# - arc to communicate with Phabricator through the conduit API
# - jq to parse JSON
#
# Arc is expected to be configured. It generally means there is an ~/.arcrc file
# with a conduit certificate and the Phabricator instance URL. Please note the
# relevant user must have access to the credentials. The easiest way to achieve
# that is to create a dedicated bot/script user, a group, and add both user and
# credentials to this group.
#
#
# Configuration
#
# The maximal credential ID
MAX_ID=2037
#
# Checks arguments
#
if [ $# -lt 1 ]
then
echo "Usage: getcredentials <id> [password|username|title]"
exit 1
fi
if echo $1 | egrep -q '^[0-9]+$'; then
ID=$1
else
echo "A positive integer id is expected."
exit 2
fi
if [ "${#ID}" -gt "${#MAX_ID}" ] || [ "$ID" -gt "$MAX_ID" ]
then
echo "The id must be equal or lesser than $MAX_ID."
exit 4
fi
if [ $# -gt 1 ]
then
case "$2" in
title) PROPERTY="name" ;;
username) PROPERTY="username" ;;
password) PROPERTY="material.password?" ;;
*) echo "Unknown property" ; exit 8 ;;
esac
else
PROPERTY="material.password?"
fi
#
# Queries DevCentral
#
echo "{\"ids\": [$ID], \"needPublicKeys\": true, \"needSecrets\": true}" | arc call-conduit passphrase.query | jq --raw-output ".response.data[].$PROPERTY"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Sep 18, 14:16 (16 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2987748
Default Alt Text
(1 KB)
Attached To
Mode
rZR Zemke-Rhyne
Attached
Detach File
Event Timeline
Log In to Comment