All product names, logos, and brands used in this post are property of their respective owners.
In reviewing my posts for 2020 thus far, it appears I am on a “credential kick.” Not sure if this is good or bad but I am going to roll with it in this post and my next one entitled YubiKey Manager and PowerShell: TOTP Credentials.
OneTimeSecret is a gem of a service created by Delano Mandelbaum that allows you to obfuscate credentials in chats, email sent items, ticket history and other mediums that tend to persist information indefinitely. There is certainly an argument that sensitive information (credentials and the like) should never be shared in these ways, but let’s face it. It happens!
If you use OneTimeSecret, the only persisted information (URL or link to the credential) is invalidated once retrieved. This provides at least a measure of security vs. sharing passwords in cleartext.
In pursuit of saving clicks and automating some of my processes, I assembled the following PowerShell snippet to generate a random password using OneTimeSecret, display it in the console, and print a URL that can be used to retrieve the credential.
|
|
I wrapped this up in a PowerShell function I can call as needed.
> generate-password
rk6WWg(2tn7b
https://onetimesecret.com/secret/bq9vr5job5snfy5ppt53pqyybs6nf18
Alternatively, you can have OneTimeSecret email the secret link for you by specifying a recipient - this requires an additional parameter in the request body:
$Body = @{
ttl = 604800
recipient = someone@example.com
}
If you plan to do any heavy lifting with OneTimeSecret and PowerShell, I recommend looking at the module Craig Gumbley created. I stumbled across the OneTimeSecret module after the fact but it looks incredibly robust.
I hope this helps someone hoping to achieve something similar!