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

113 lines
6.3 KiB
Markdown

# [MOTDfetch][motdfetch_repo]
![Bash](https://img.shields.io/badge/bash-1f425f.svg?style=for-the-badge&logo=image%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkE3MDg2QTAyQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkE3MDg2QTAzQUZCMzExRTVBMkQxRDMzMkJDMUQ4RDk3Ij4gPHhtcE1NOkR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H4RgMrjU1HAB4vR6LzWYfFUCKxfS8Ftk5qxHoCUQAUkRJaSEokkV6Y%2F%2BJUOC4hn6A39NVXVBYeNP8piH6HeA4fPbpdBQV5KOx0QaL1YppX3Jgk0TwH2Vg6S3u%2BdB91%2B%2FpuNYPYFl5uP5V7ZqvsrX7jxqMXR6ff3gCQSTzFI0a1TX3wIs8ul%2Bq4HuWAAiM39vhOuR1O1fQ2gT%2F26Z8Z5vrl2OHi9OXZn995nLV9aFfS6UC9JeJPfuK0NBohWpCHMSAAsFe74WWP%2BvT25wtP9Bpob6uGqqyDnOtaeumjRu%2ByFu36VntK%2FPA5umTJeUtPWZSU9BCgud661odVp3DZtkc7AnYR33RRC708PrVi1larW7XwZIjLnd7R6SgSqWSNjU1B3F72pz5TZbXmX5vV81Yb7Lg7XT%2FUXriu8XLVqw6c6XqWnBKiiYU%2BMt3wWF7u7i91XlSEITwSAZ%2FCzAAHsJVbwXYFFEAAAAASUVORK5CYII%3D)
![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge&logo=debian&logoColor=white)
![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)
**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](#features)**
>**[INSTALLATION](#installation)**
>**[USAGE](#usage)**
[![Preview of MOTDfetch][preview_image]][preview_image_url]
---
## Features
- Usable as a **command**, a **login MOTD** or **SSH MOTD**.
- **[8 Core modules](#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
- :warning: 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
- :warning: 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
---
[//]: # (LINKS)
[motdfetch_repo]: https://git.tkapias.net/tkapias/MOTDfetch
[preview_image]: docs/img/preview.jpg "Preview of MOTDfetch"
[preview_image_url]: https://git.tkapias.net/tkapias/MOTDfetch/raw/master/docs/img/preview.jpg