MOTDfetch/readme.md
2023-02-07 16:10:46 +07:00

6.3 KiB

MOTDfetch

Bash Debian Ubuntu

MOTDfetch is a modular & dynamic MOTD replacement written in Bash and a nice command line information tool for Debian/Ubuntu systems.

MOTD - "message of the day"
Feature used on Unix-like CLI systems to send a common message to all users after a successful login, and just before it executes the login shell.
Newer Unix-like systems may generate the message dynamically when the host boots or a user logs in.

Drawbacks with the current implementation of MOTD with PAM on Debian and Ubuntu are at least 3:

  1. The SSH client does not decide whether to activate the MOTD.
    As it is loaded before the shell login is opened:
  2. User has to wait blindly for the end of the execution if there is a dynamic script.
  3. Scripts can not check the user sessions status.

MOTDfetch avoids and partially disable the original MOTD implementation, but remains compatible with it for PAM login.


Table of contents

FEATURES
INSTALLATION
USAGE

Preview of MOTDfetch


Features

  • Usable as a command, a login MOTD or SSH MOTD.
  • 8 Core modules.
  • Uniform and easily customizable.
  • Emphasis of important elements and status by colors, symbols or flashing.
  • Notice message upon missing dependencies
  • Reduced operation mode fot high load (enforceable).
  • Separate system and users configuration files.
  • Scripted installation and updates.
  • Modules or sections can be disabled.
  • Standalone executable modules.

8 Core modules

HEADER module

  • decorative banner (custom text or username)
  • welcome message with username, date and time
  • user mail inbox status

SYSYINFO module

  • distribution name, kernel version, uptime
  • CPU, cores, load, processes, memory, swap
  • hostname, network interface, DNS servers, public IPs/DNS/rDNS records
  • custom external API for public IP check
  • skip connectivity related tests if the API check fail
  • short timeout on dig & curl commands to keep the script snappy

SERVICES module

  • check systemd services status
  • by service name and user UID if not system
  • ⚠️ user cannot check other user's services

FILESYSTEM module

  • 2 sections: general filesystems, ZFS filesystems
  • name, fs type, usage and size of disk or ZFS pool
  • inodes usage and size when relevant
  • health status for ZFS
  • custom usage threshold for warning hints

TLS module

  • check X.509 certificates status with openssl
  • accept domain and optional port (443 by default)
  • validate name correspondence and expiration date
  • skip the test if there is no internet connectivity
  • short timeout on openssl command to keep the script snappy

POSTQUEUE module

  • postfix deferred queue status
  • short timeout on the parsing to keep the script snappy if there is thousands of mails

FAIL2BAN module

  • display fail2ban jails status
  • ⚠️ need to be executed with root or sudo

USERSLOG module

  • display last user logged in
  • name, IP and connection range
  • if the current user is different, display his last log too
  • display currently logged sessions with usernames

Installation

Requirements

Usage