stoken(1)
β¨ stoken(1) β¨
the manual page, but make it a group chat π
πΈ NAME πΈ
stoken β software token for cryptographic authentication
okay so bestie, stoken is a software token for cryptographic authentication. that's the whole vibe. let's get into it π
π¦ SYNOPSIS π¦
stoken [tokencode] [--stdin] [--force] [--next] [opts]
stoken import {--file=file | --token=token_string} [--force] [opts]
stoken setpin [opts]
stoken setpass [opts]
stoken show [--seed] [opts]
stoken export [{--blocks | --iphone | --android | --v3 | --sdtid |
--qr=file.png | --show-qr}] [opts]
stoken issue [--template=file]
stoken help
stoken version
look at all those little modes, it's giving main character energy π
π DESCRIPTION π
stoken is a software token compatible with RSA SecurID 128-bit (AES) tokens. the command-line interface provides facilities for:
- importing new tokens
- displaying the current tokencode
- encrypting the seed with a user-specified password
- storing the user's PIN alongside the token
- viewing or exporting the token data
so basically it does a lot and it does it well. periodt. π
π BASIC USAGE π
Use stoken import to decode a token string and write it into ~/.stokenrc. This may prompt for a device ID and/or password, depending on what options your administrator used to create the token. The token string can be provided on the command line, or read from a text file.
stoken will autodetect the following types of token strings:
286510182209303756117707012447003320623006...
29658-21098-45467-64675-65731-01441-11337...
Pure numeric (81-digit) "ctf" (compressed token format) strings, with or without dashes. These may have been furnished as-is, or they could have been derived from an sdtid file by the RSA TokenConverter program.
com.rsa.securid.iphone://ctf?ctfData=229639330774927764401...
iPhone-compatible token strings. π
http://127.0.0.1/securid/ctf?ctfData=250494932146245277466...
http://127.0.0.1/securid/ctf?ctfData=AwAAfBc3QSopPxxjLGnxf...
Android-compatible token strings. π€
<?xml version=...
RSA sdtid-formatted XML files. These should be imported from a file: stoken import --file=FILE.SDTID.
Tokens supplied as QR codes can be converted back to standard URIs by running zbarimg(1) on the image file. lowkey iconic that zbarimg(1) is out here doing the Lord's work π
The device ID, if used, can be viewed in the "about" menu for the RSA soft token app on the phone. Numeric ctf strings and smartphone tokens bound to a device ID contain a seed that is encrypted using the device ID, so the ID must be furnished before stoken can successfully import the token. sdtid files can be imported without knowledge of the device ID, as long as the password (if any) is known. π
By default, stoken import will refuse to overwrite an existing token in ~/.stokenrc. The --force switch overrides this check.
stoken import will normally prompt for a new password, which is used to encrypt the seed before storing it in ~/.stokenrc. This can be bypassed by entering an empty password, or specifying --new-password='' on the command line. It is recommended to choose a longer, hard-to-guess passphrase for this purpose. no cap, protect your seed bestie π
After a token has been imported, running stoken with no arguments will prompt for any required password or PIN, then display the current tokencode.
Tokencodes are computed from the raw (decrypted) seed data, the current time of day, and the PIN. If the same seed is installed on multiple devices, they should all produce identical tokencodes. If they do not, double-check the timezone setting and consider using NTP to synchronize the system time to a known good source. (clock drift really said "not today" π)
stoken setpin can be used to save the PIN in ~/.stokenrc. Not all tokens will require a PIN; this can be configured by the SecurID administrator when generating new tokens. Setting an empty PIN will remove the PIN from ~/.stokenrc so that the user will be prompted every time it is required. See the SECURITY CONSIDERATIONS section below for additional details.
stoken setpass encrypts the seed and PIN (if present) in ~/.stokenrc with a user-selectable password or passphrase. If an empty password is entered, the password will be removed. See the SECURITY CONSIDERATIONS section below for additional details.
π VIEWING TOKENS π
stoken show displays information about the current token, typically read from ~/.stokenrc. The --seed option displays the encrypted and decrypted seed bytes (which should be treated as sensitive data, as they can be used to derive tokencodes). fr fr, that's the crown jewels, treat it like it π
stoken export translates the current token into a format suitable for importation to another device. π¦
stoken issue generates a new software token in XML sdtid format. A template file, itself in sdtid format, may be provided to override some or all of the human-readable fields. This would permit appropriate serial numbers, expiration dates, usernames, etc. to be specified. If Secret, Seed, or MAC fields are present in the template file, they will be ignored. π
β¨ GLOBAL OPTIONS β¨
--rcfile=fileβ Use an alternate.stokenrcconfiguration file. This is typically used to support multiple tokens on the same user's UNIX account. Note that the.stokenrcfile stores additional data (such as the PIN), so it cannot be parsed as a "raw" token string bystoken --file.--password=password,-ppasswordβ Use a password supplied from the command line, instead of prompting the user. See notes in SECURITY CONSIDERATIONS below.--pin=pin,-npinβ Use a PIN supplied from the command line, instead of prompting the user. See notes in SECURITY CONSIDERATIONS below. If you save your PIN in~/.stokenrc, note that--pin=0000is often required when activating a new soft token for the first time. π--devid=devidβ Use a device ID supplied from the command line to decrypt the token. A token can be bound to a class GUID device ID (i.e. a certain type of device, such as"iPhone"or"Android"), a unique device ID (one specific unit), or nothing.stokenwill attempt to autodetect matches with a class GUID, but on rare occasions this results in false positives due to hash collisions. In these cases, the bound device ID should be specified on the command line to override autodetection. (hash collision said "surprise" π)
π EXPORT OPTIONS π
--new-password=passwordβ Supply the encryption password from the command line for operations that write out a token string or.stokenrcfile:import,export,setpass, andissue. See notes in SECURITY CONSIDERATIONS below.--keep-passwordβ If the token in the.stokenrcfile is protected with a password, retain the same password when exporting the token. By default, the export operation will not encrypt the token with a password; note that it may not be possible to enter all possible passwords on devices with limited text input capabilities (such as feature phones). π±--new-pin=pinβ Supply a new PIN from the command line for thesetpinoperation. See notes in SECURITY CONSIDERATIONS below.--new-devid=devidβ Used with theexportorissuecommand to encrypt the new token with a specific device ID. This is only used for testing purposes.--blocks,--iphone,--android,--v3β Used with theexportcommand to select the output format. See examples in BASIC USAGE. By default, theexportcommand will print an unformatted 81-digit string to standard output.--sdtid,--xmlβ These options are synonyms. Both export a token to standard output in RSA'ssdtidXML format.--qr=file.pngβ Encode the token as a QR code and write it tofile.png. This requires theqrencodeprogram to be installed.--show-qrβ Encode the token as a QR code and immediately display it on the screen. This requires theqrencodeprogram to be installed. If theQR_VIEWERenvironment variable is set,stokenwill use that program as the preferred viewer. Otherwise it will try to execute a few common Linux image viewers, and give up if none of them exist. π«Ά--template=fileβ Used with theexportorissuecommands to override fields in the XML output. The template file should look like any standardsdtidfile, but all fields are optional and will default to reasonably sane values if omitted. This can be used to force the output XML to use a specific serial number, user name, expiration date, etc. Correct MAC checksums will be (re)computed on the provided values. See theexamplesdirectory in the source distribution for more information.
π§ OTHER OPTIONS π§
--use-time={unix_time|+offset|-offset}β Instead of generating a tokencode based on the current time of day, force a specific time, or adjust the current time based on a positive or negative offset (specified in seconds). This is only used for testing purposes.--nextβ Generate the next tokencode instead of the current tokencode. For a 60-second token, this is equivalent to--use-time=+60.--stdin,-sβ When generating a tokencode that requires either a password or PIN, read the password or PIN as single line from standard input. This is intended to allow external programs to callstokento generate single-use passwords without user intervention; see NON-INTERACTIVE USE below.--force,-fβ Override token expiration date checks (for tokencode) or token overwrite checks (for import).--batch,-bβ Abort with an error exit code if any user input is required. Intended for automated operation and testing. π€--file=fileβ Read actfstring, an Android/iPhone URI, or an XMLsdtidtoken fromfileinstead of the.stokenrcconfiguration. Moststokencommands accept this flag, but it is expected that the typical user will save his token in~/.stokenrcinstead of supplying it by hand on every invocation. Typically--fileand--tokenare only used for theimportcommand.--token=token_stringβ Use a token from the command line instead of the.stokenrcfile. See above notes on--file.--randomβ Generate a random token on the fly. Used for testing or demonstrations only. These tokens should not be used for real authentication. π«--help,-hβ Display basic usage information.--version,-vβ Display version information.
π SECURITY CONSIDERATIONS π
okay bestie, real talk time, because this part is important. π
Software tokens, unlike hardware tokens, are relatively easy to replicate. so like... a soft token seed is copyable, a hardware token is a whole lil gadget. that means systems that store soft token seeds should be carefully guarded to prevent unauthorized disclosure. and the use of whole-disk encryption, such as TrueCrypt, is strongly recommended for laptops and other portable devices that are easily lost or stolen. yes queen, encrypt the whole disk, it's giving responsible. π«Ά
stoken permits users to store their PIN in ~/.stokenrc to allow for automated (scriptable) generation of tokencodes, but the risks of this approach should be carefully weighed against the benefits. like, convenience is cute but read the room. π
Using the setpass command to encrypt the seed and PIN in ~/.stokenrc provides some degree of protection against unauthorized access, but does not necessarily cover all possible attack vectors. A host that is already compromised (e.g. running a keylogger) will not provide adequate protection for any seed(s) stored on it. no cap, if the box is owned, it's owned. π
stoken encryption passwords may be up to 40 characters long. A longer passphrase constructed from several random words can provide more protection from brute-force attacks than a shorter password. so like, correct horse battery staple energy. π΄
Entering a password or PIN on the command line is generally unsafe on multiuser systems, as other users may be able to view the command line arguments in ps or similar utilities. The command line could also be cached in shell history files. π so maybe don't, bestie.
Encoding QR tokens may expose the seed data through ps, and the --show-qr option writes temporary PNG files in /tmp. yeah. it's giving exposed. πΈ
stoken attempts to lock pages to prevent swapping out to disk, but does not scrub secrets from process memory. so it's trying, but it's not perfect, and you should know that. β¨
π€ NON-INTERACTIVE USE π€
Other applications, such as VPN clients, may want to invoke stoken non-interactively to generate single-use passwords. Three usage modes are supported, depending on the level of security (and/or convenience) that is required:
π No password or PIN π
The user configures stoken to print a tokencode immediately upon invocation, with no prompts, by using setpin to store the PIN in ~/.stokenrc and using setpass to set an empty password. The other application can then invoke stoken --batch and read the tokencode through a pipe from standard output.
This provides no security for the seed, but may be useful in applications where (re-)authentication is frequent or unattended operation is required. lowkey convenient, highkey unprotected. β
π Save the PIN and set a password π
The user configures stoken to encrypt the ~/.stokenrc secrets with a password using setpass, then saves the PIN with setpin. The PIN and the seed will both be encrypted with the password. The other application will request the password from the user, then call stoken --stdin, write the password to stoken's standard input through a pipe, and read back a tokencode from stoken's standard output. bestie this one's the balanced icon. π
π No password; prompt for the PIN π
Similar to above, but set an empty password using setpass, do not save the PIN in ~/.stokenrc, and pass the PIN to stoken --stdin via standard input. cute and simple, no stored PIN moment. π
π BUGS/TODO π
sdtid support is still new and may choke on unexpected input. As a short-term workaround you can try commenting out the sanity checks in sdtid_decrypt() to see if the problem goes away. (not me telling you to disable the checks π it's literally what the page says though.)
Features under development include: hardware token seeds (and the stoken split command needed to work with them), and support for non-Linux hosts.
Patches are always welcome. π«Ά like genuinely, come through.
π SEE ALSO π
π FILES π
~/.stokenrcβ Default configuration file. it's the main character file fr fr. β¨
π AUTHOR π
Kevin Cernekee <cernekee@gmail.com>
and that's a wrap, bestie!! this page is from 2012-09-09 and it's the stoken(1) manual β slay, go generate some tokencodes responsibly, lock your laptop, and don't put your PIN on the command line on a multiuser box. iykyk. π¦ππ
π¦ where this page comes from
- alpine 3.24: stoken-doc 0.93-r0 Β· LGPL-2.1-or-later
- arch rolling: stoken 0.92-6 Β· LGPL-2.1-or-later
- debian bookworm: stoken 0.92-1 Β· LGPL-2.1-or-later
- debian trixie: stoken 0.92-1.1+b2 Β· LGPL-2.1-or-later
- epel 10: stoken-cli 0.93-2.el10_3 Β· LGPL-2.1-or-later
- epel 9: stoken-cli 0.93-2.el9 Β· LGPL-2.1-or-later
- fedora 43: stoken-cli 0.92-14.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: stoken-cli 0.93-2.fc43 Β· LGPL-2.1-or-later
- fedora 44: stoken-cli 0.93-2.fc44 Β· LGPL-2.1-or-later
- nixos 26.05: stoken 0.93
- nixpkgs unstable: stoken 0.93
- opensuse-leap 16.0: stoken 0.93-bp160.1.13 Β· BSD-3-Clause AND LGPL-2.0-or-later
- opensuse-leap 16.0: stoken 0.93-bp160.1.13 Β· BSD-3-Clause AND LGPL-2.0-or-later
- opensuse-leap 16.0: stoken 0.93-bp160.1.13 Β· BSD-3-Clause AND LGPL-2.0-or-later
- opensuse-leap 16.0: stoken 0.93-bp160.1.13 Β· BSD-3-Clause AND LGPL-2.0-or-later
- ubuntu jammy: stoken 0.92-1 Β· LGPL-2.1-or-later
- ubuntu noble: stoken 0.92-1.1build2 Β· LGPL-2.1-or-later
- ubuntu questing: stoken 0.92-1.1build3
- ubuntu resolute: stoken 0.93-1 Β· LGPL-2.1-or-later
- ubuntu stonking: stoken 0.93-2 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms