No project description provided
Project description
Mailtrace
Mailtrace is a command-line tool for tracing emails via SSH or OpenSearch.
Installation
$ pip install mailtrace
You can copy the example configuration file from the repository:
$ cp config.yaml.sample ~/.config/mailtrace.yaml
Usage
mailtrace run \
-c ~/.config/mailtrace.yaml \
-h mail.example.com \
-k user@example.com \
--time "2025-07-21 10:00:00" \
--time-range 10h
You can specify the following parameters on the command line:
-c: Path to the configuration file.-h: Hostname of the mail server to begin tracing.-k: Keyword to search for, such as an email address.--time: The central time for the trace.--time-range: The duration to search before and after the central time. For example, if--timeis "10:00" and--time-rangeis "1h", the search will cover from 9:00 to 11:00.
Password-related options are also available:
--login-pass: Password for SSH login authentication.--sudo-pass: Password for sudo authentication.--opensearch-pass: Password for OpenSearch authentication.
To help prevent password leakage, you can use the following flags to enter passwords interactively at the prompt: --ask-login-pass, --ask-sudo-pass, --ask-opensearch-pass.
Configuration
The configuration file supports these parameters:
method: Tracing method, either "ssh" or "opensearch".log_level: Logging level, one of "DEBUG", "INFO", "WARNING", "ERROR", or "CRITICAL".ssh_config: Configuration for SSH tracing.opensearch_config: Configuration for OpenSearch tracing.
SSH Configuration
Example ssh_config section:
ssh_config:
username: username
password: ""
private_key: /path/to/private.key
sudo_pass: ""
sudo: true
host_config:
log_files:
- /var/log/mail.log
log_parser: NoSpaceInDatetimeParser
time_format: "%Y-%m-%dT%H:%M:%S"
hosts:
another.mailserver.example.com:
log_parser: DayOfWeekParser
time_format: "%b %d %H:%M:%S"
username: SSH username.password: SSH password. For security, it's recommended to provide this via the CLI using the--ask-login-passflag.private_key: Path to the SSH private key file.sudo_pass: Sudo password. For security, it's recommended to provide this via the CLI using the--ask-sudo-passflag.sudo: Whether to use sudo for reading logs.host_config: Default settings for hosts.log_files: List of log files to read.log_parser: Log parser for processing log files.time_format: Time format in logs, used for time comparison.
hosts: Host-specific configurations, using the same format ashost_config.
OpenSearch Configuration
Example opensearch_config section:
opensearch_config:
host: ""
port: 9200
username: username
password: ""
index: ""
use_ssl: false
verify_certs: false
time_zone: "+00:00"
host: Hostname or IP address of the OpenSearch server.port: Port number for OpenSearch.username: OpenSearch username.password: OpenSearch password. For security, it's recommended to provide this via the CLI using the--ask-opensearch-passflag.index: Name of the OpenSearch index for storing logs.use_ssl: Whether to use SSL for communication.verify_certs: Whether to verify SSL certificates.time_zone: Time zone of the OpenSearch server.
How It Works
An aggregator can read the logs and find out the related ones. It then extracts information from the logs, including hostname, mail_id, etc.
With the information extracted, it can find out the next stop of the mail flow. The tracing is performed by the do_trace function in aggregator/__init__.py, the core of this tool.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailtrace-0.2.0.tar.gz.
File metadata
- Download URL: mailtrace-0.2.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10efce681af07f3176d22b776228f071b584a02e85f7a5efcb726a8fbd732e9c
|
|
| MD5 |
6ecbb91c60edcd398b9b1b5eb3ea5fe4
|
|
| BLAKE2b-256 |
6081dc8c0a42ef8098ed996e889e1c40151f5b9f2ec8553274911944535ab43e
|
File details
Details for the file mailtrace-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mailtrace-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
730439357f659d3d2996b6a7fb8e424e0a7b1638c72b848b00e2802b31d5c8dc
|
|
| MD5 |
08b88cb8cfa06124ce850f22cd6e5e58
|
|
| BLAKE2b-256 |
fc53c5c4c7b62deb810c548a0c839a04fc60e0675ad3487d3403c2b145b87a11
|