terminal_sync

Overview

terminal_sync is a standalone tool for logging Bash and PowerShell commands to GhostWriter automatically. The provided Bash script and PowerShell module register pre-exec and post-exec hooks that capture and send information about executed commands to the terminal_sync server for additional processing and enrichment. Once properly configured, any commands that meet the configured logging criteria (e.g., contain a specific keyword) are sent to GhostWriter.


Features


Known Limitations

  • Background jobs (i.e., Bash commands ending with & and PowerShell Start-Job commands) will always be reported as successful since the post-exec hook runs when the prompt returns, which happens before the command completes.

Bash Limitations

  • Compound commands (i.e., multiple commands joined by &&) run in the background will not be logged
    • These commands trigger the precmd (i.e., post-exec) hook but not the preexec hook; however, the current post-exec implementation relies on a variable set in the pre-exec hook to prevent logging duplicate entries when a user submits an empty line

Local vs Remote Usage

The terminal_sync server is intended to be run locally and therefore does not include authentication or encryption. Should you choose to run the server on a remote host, it is highly recommended that you run it on localhost and use an SSH forward tunnel, or similar mechanism, to access it.

Similarly, terminal_sync was (mostly) designed with a single user per instance in mind. The one exception is that if the OPERATOR environment variable is set within a client shell session, this value will override the operator setting on the server, thus allowing multiple users to share a terminal_sync server. That said, the server itself only supports a single API key / token per instance, so make sure all users with access to the server are authorized for that level of access to GhostWriter.