tlog-rec-session(8)

πŸ’– tlog-rec-session(8) β€” the System Manager's Manual glow-up πŸ’–

okay bestie, pull up a chair, because we're talking about tlog-rec-session β€” a program from the Tlog family, and honestly? it's giving "quietly running your entire login session and writing down everything you do" main character energy. πŸŽ€


✨ NAME ✨

tlog-rec-session β€” start a shell and log terminal I/O πŸ¦‹


🌸 SYNOPSIS 🌸

tlog-rec-session [OPTION...] [CMD_FILE [CMD_ARG...]]
tlog-rec-session -c [OPTION...] CMD_STRING [CMD_NAME [CMD_ARG...]]

like, two whole shapes of invocation. pick your fighter. πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

so tlog-rec-session is a terminal session I/O logging program, and its whole job is to be used as the login shell for a user. the actual user shell that it's gonna start? it gets that from configuration or from the environment. it does not just vibe in there β€” nope, it starts the actual shell under a pseudo-TTY, hooks it up to the actual terminal, and logs literally everything passing between them: user input, program output, and even terminal window size changes. full surveillance, but make it cute. πŸ“βœ¨

no cap: tlog-rec-session will not start recording if another process with the same audit session ID (as seen in /proc/PID/sessionid) is already being recorded. instead, it will simply start the shell. one recording per session, we don't double-dip. πŸ™ˆ

now for the argument lore, because this is the part everyone skips and then gets confused about:

  • if no -c option is specified, then the first non-option argument CMD_FILE specifies the location of a shell script the shell should read, and the following arguments (CMD_ARG) specify its arguments. πŸ“œ
  • if the -c option is specified, then a non-option argument CMD_STRING is required and should contain shell commands to execute. the following arguments can specify first the script name (CMD_NAME, i.e. argv[0]) and then its arguments (CMD_ARG). 🧚
  • if no non-option arguments are encountered, or the -i option is specified, then the shell is started interactively. periodt. πŸ’¬

πŸͺž the name-based identity crisis (affectionate)

if tlog-rec-session is invoked under a name beginning with a dash (i.e. argv[0] beginning with -), then the executed shell name is also prepended with a dash. this passes the "login shell" status to the recorded shell and is equivalent to using the -l option. 🫢

if tlog-rec-session is invoked under a name containing -shell-, then the rest of the name after that string is considered an encoded absolute path to the shell to execute for the recorded session. the path is expected to be encoded by replacing all forward slashes / with dashes - and any characters to be preserved as is prepended with a backslash \. e.g. to have tlog-rec-session execute /bin/dash as the shell, invoke it with the name tlog-rec-session-shell-bin-dash. πŸ”₯

this is normally done by making a symlink with that name pointing to tlog-rec-session, and then executing the link. such links can be assigned to users as their shells to have specific shells started under recording for specific users. it's giving ✨personalized✨.

πŸ—‚οΈ where the settings come from (priority list, bestie)

tlog-rec-session loads its parameters in this exact order, and each source overrides the previous one in turn:

  1. the system-wide configuration file /etc/tlog/tlog-rec-session.conf 🏠
  2. then the file pointed at by the TLOG_REC_SESSION_CONF_FILE environment variable (if set) πŸ“
  3. then the contents of the TLOG_REC_SESSION_CONF_TEXT environment variable (if set) πŸ“
  4. and then command-line options 🎀

later ones win. that's the whole chain. don't fight it. πŸ’œ


πŸ’… OPTIONS πŸ’…

general options

  • -h, --help β€” output a command-line usage message and exit. the "help me bestie" button. πŸ†˜
  • -v, --version β€” output version information and exit. 🏷️
  • --configuration β€” output program configuration in JSON and exit. yes, JSON. yes, pretty. 🌈
  • -l, --login β€” make the shell a login shell.

if specified, the shell is signalled to act as a login shell. this is done by prepending argv[0] of the shell with a dash character. πŸŽ€

  • -i, --interactive β€” make the shell an interactive shell.

if specified, tlog-rec-session passes the -i option to the shell. πŸ’¬

  • -c, --command β€” execute shell commands.

if specified, tlog-rec-session passes the -c option to the shell, followed by all the positional arguments, which specify the shell commands to execute along with command name and its arguments. ⌨️


🌿 ENVIRONMENT 🌿

  • TLOG_REC_SESSION_CONF_FILE β€” specifies the location of a configuration file to be read. the configuration parameters in this file override the ones in the system-wide configuration file /etc/tlog/tlog-rec-session.conf. πŸ“
  • TLOG_REC_SESSION_CONF_TEXT β€” specifies the configuration text to be read. the configuration parameters in this variable override the ones in the file specified with TLOG_REC_SESSION_CONF_FILE. πŸ“
  • TLOG_REC_SESSION_SHELL β€” specifies the shell to spawn. overrides configuration specified with TLOG_REC_SESSION_CONF_TEXT. can be overridden by invoking tlog-rec-session under a special name (see above). 🐚

πŸ“‚ FILES πŸ“‚

  • /etc/tlog/tlog-rec-session.conf β€” the system-wide configuration file 🏠

πŸ“ EXAMPLES πŸ“

start recording a login shell:

tlog-rec-session -l

ask the recorded shell to execute a command:

tlog-rec-session -c whoami

ate. no crumbs. πŸ”₯


πŸ”­ SEE ALSO πŸ”­

tlog-rec-session.conf(5), tlog-rec(8), tlog-play(8) β€” go read the whole friend group, they're all iconic. πŸ‘‘


🌟 AUTHOR 🌟

Nikolai Kondrashov <spbnick@gmail.com> πŸ’–


and that's the whole page, bestie!! this was Tlog, version dated May 2017, served fresh from the System Manager's Manual. mwah. πŸ’‹βœ¨πŸ¦‹