Skip to content

About

A lightweigt Java-Container that alerts on SSH login-attempts

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

43 Commits

Folders and files

Repository files navigation

LoginWatcher

Sends Telegram and/or ntfy Notifications when detecting a Login-attempt.

Notification Channels

Variable Description Default Required
TELEGRAM_USE Enable the Telegram bot. If false, all TELEGRAM_* and SSH_* variables are ignored. true ❌
TELEGRAM_USE_SSH_RUNNER Enable the SSH runner (/test_ssh, /shutdown commands). If false, SSH_* variables are ignored. true ❌
NTFY_USE Enable ntfy notifications. false ❌

Configuration

The project is fully configurable via environment variables (ENV).
Below is a list of all available configuration parameters.

SSH Connection

Only required if TELEGRAM_USE and TELEGRAM_USE_SSH_RUNNER are true.

Variable Description Default Required
SSH_HOST The host domain or IP address used by the container to connect to the monitored system. — ✅
SSH_PORT The port of the SSH server. 22 ❌
SSH_USERNAME The SSH username used for login. — ✅
SSH_PASSWORD The SSH password used for login (alternative to key authentication). — ⚠️ Required if no private key is provided
SSH_PRIVATE_KEY Path or content of the SSH private key used for authentication. — ⚠️ Required if no password is provided
SSH_PRIVATE_KEY_PASSPHRASE Optional passphrase for the SSH private key. — ❌

There must be either a password or a private key set for SSH authentication.


Telegram Notifications

Only required if TELEGRAM_USE is true.

Variable Description Default Required
TELEGRAM_TOKEN Token of your Telegram Bot. — ✅
TELEGRAM_CHAT_ID Chat ID of the preferred Telegram chat to receive notifications. — ✅
TELEGRAM_BOT_NAME Name of the Telegram bot used in messages. — ✅

ntfy Notifications

Only required if NTFY_USE is true.

Variable Description Default Required
NTFY_URL Full topic URL of your ntfy server (e.g., https://ntfy.sh/my-topic). — ✅
NTFY_TOKEN Access token, sent as Authorization: Bearer header. — ❌

Log Monitoring

Variable Description Default Required
AUTH_LOG_PATH Path to your Linux authentication log file (e.g., /var/log/auth_monitoring.log). — ✅

Notification Triggers

These environment variables control which events will trigger notifications.
Each variable accepts "true" or "false". If omitted or set incorrectly, notifications are disabled by default.

Variable Description Default Required
NOTIFY_WHITELIST List of IP-Addresses that will not send a Notification. (Use ; for separation of multiple Addresses) — ❌
NOTIFY_SUCCESS Notify when a login succeeds. true ❌
NOTIFY_FAIL Notify when a login attempt fails. true ❌
NOTIFY_DISCONNECT Notify when a session disconnects. true ❌
NOTIFY_INVALID_USER Notify when an invalid user attempts to log in. true ❌
NOTIFY_CLOSE_SESSION Notify when a session is closed. true ❌
NOTIFY_STARTUP Notify when the app starts true ❌
NOTIFY_SHUTDOWN Notify when the app shuts down true ❌
NOTIFY_IGNORE_CONTENTS Strings to ignore in log entries (useful for filtering noise). — ❌
NOTIFY_SHOW_LOG Shows the Log inside the Telegram Message false ❌

Requirements:

  • Docker-CLI
  • Docker Compose
  • Own Telegram Bot
  • rsyslog
  • ssh server on host system

Installation:

  1. Install rsyslog

    sudo apt update && sudo apt install rsyslog

  2. Edit the rsyslog config (most likely at /etc/rsyslog.conf)

    auth,authpriv.* /var/log/auth_monitoring.log

  3. Restart rsyslog

    sudo systemctl restart rsyslog

  4. rename your adjusted Docker compose file:

    mv docker-compose.yml.template docker-compose.yml

  5. Configure your compose file

RUN:

then run:

docker compose up -d

About

A lightweigt Java-Container that alerts on SSH login-attempts

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages