logdebarker/README.md

99 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2025-05-16 13:40:32 -04:00
# logdebarker
2025-05-16 18:18:41 +00:00
`logdebarker` is a UNIX-style log sanitizer tool written in Go. It censors sensitive information from logs, config files, and other text streams based on user-defined patterns. This is useful for cleaning data before exporting logs or sharing files.
## Features
* Accepts input from STDIN or a file
* Outputs to STDOUT or a specified output file
* Uses `$HOME/.blocked_words.txt` as a pattern file for matching sensitive strings
2025-05-16 18:22:35 +00:00
* Enforces strict file permissions on the config file (`0600` only)
2025-05-16 18:18:41 +00:00
* Supports custom redaction strings (e.g. `redaction: <string>`)
* Ignores comment lines beginning with `#` in both input and config
## Usage
Pipe logs through `logdebarker`:
```sh
sudo cat /var/log/someprogram/log.log | logdebarker | tee cleaned_log.txt
```
Sanitize a file to a new output file:
```sh
sudo logdebarker /etc/nginx/conf.d/somesite.conf output.txt
```
## Configuration
`logdebarker` reads its blocklist from:
```
$HOME/.blocked_words.txt
```
Each line should be a literal string to redact. Lines starting with `#` are ignored. You may optionally define one redaction string:
```
redaction: [your-censor-string]
```
Example `.blocked_words.txt`:
```
# block API keys
redaction: <removed>
ABC123XYZ456
supersecretpassword
```
## Security
2025-05-16 18:32:01 +00:00
To protect your sensitive word list, `logdebarker` will refuse to run if `$HOME/.blocked_words.txt` is not `chmod 600`.
2025-05-16 18:18:41 +00:00
```sh
2025-05-16 18:32:01 +00:00
chmod 600 ~/.blocked_words.txt
2025-05-16 18:18:41 +00:00
```
## Installation
1. Clone and build:
```sh
2025-05-16 18:22:35 +00:00
git clone https://codeberg.org/firebadnofire/logdebarker.git
2025-05-16 18:18:41 +00:00
cd logdebarker
go build -o logdebarker
```
2. Move the binary to your PATH:
```sh
2025-05-16 18:21:09 +00:00
sudo install -Dm755 logdebarker /usr/local/bin/logdebarker
2025-05-16 18:18:41 +00:00
```
OR
2025-05-16 18:37:56 +00:00
`go install archuser.org/logdebarker@latest`
2025-05-16 18:18:41 +00:00
2025-05-16 18:32:01 +00:00
## Final notes
`Logdebarker` is not a service, so you may simply wipe out ~/.blocked_words.txt when not in use for added security. This can be done with `truncate -s 0 ~/.blocked_words.txt`
Usage is as follows:
```
Usage:
logdebarker [input_file] [output_file]
logdebarker < input.txt > output.txt
inputstream | logdebarker | outputstream
```
2025-05-16 18:18:41 +00:00
## License
This project is released under the GPLv3 License.
---
For bug reports, suggestions, or contributions, open an issue or submit a pull request.