Mosh (Mobile Shell) is a popular alternative to SSH for remote server access. It’s fast, resilient to network interruptions, and ideal for spotty connections. Yet, one challenge arises when you need to record Mosh sessions for compliance or audit purposes. Unlike SSH, which has straightforward logging capabilities, Mosh doesn't natively support session recording. This gap leaves teams looking for an effective solution to ensure compliance without sacrificing Mosh’s benefits.
This blog explores how to record Mosh sessions, why it matters for compliance, and how to implement it in a streamlined way.
Why Recording Mosh Sessions Matters
Recording sessions is often a critical requirement for organizations. Compliance standards, such as SOC 2, HIPAA, and ISO 27001, demand comprehensive audit trails for all access to critical systems. Without this level of visibility, organizations risk non-compliance, security breaches, or operational setbacks.
Since Mosh prioritizes lightweight performance over heavy features, it doesn’t offer built-in recording tools like an SSH session replay. For teams running on Mosh, this creates a unique challenge. How do you record everything without disrupting performance or draining resources?
Steps to Enable Mosh Session Recording
Even when built-in solutions are missing, there are workarounds and tools that make Mosh session recording straightforward. Below are steps to enable session logging effectively.
1. Use a Proxy Tool for Traffic Logging
One way to capture Mosh sessions is to route them through a proxy tool (like tmux or screen). These tools allow you to mirror or log session activity while providing an additional layer of visibility.
- Configure the Proxy: Set up a system where all users log into Mosh via a centralized tool.
- Enable Persistent Logs: Direct session output to a log file for compliance audits later.
- Secure Logs: Protect recorded files with access controls and encryption since they may contain sensitive information.
2. Extend Mosh with External Session Tracking
While Mosh doesn't natively log sessions, you can combine it with specialized session tracking tools. Some of these include scripts or open-source solutions you can layer directly into your workflow.