Skip to content

πŸ—‚οΈπŸ‘€ File Monitor ++ β€” Safeguard your system by monitoring specified directories for unauthorized changes, ensuring file integrity and enhancing security.

License

Notifications You must be signed in to change notification settings

cryptrunner49/fmpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‚οΈπŸ‘€ FMPP - File Monitor ++

fmpp is a command-line tool designed to monitor file integrity by tracking changes in directories or specific files. It uses SHA256 hashing to detect modifications and stores file metadata in an SQLite database. Optional systemd service setup is available for continuous monitoring.

Features ✨

  • Scan: Scan a directory and update the database with file hashes.
  • Monitor: Continuously monitor a directory for changes (configurable interval).
  • Check: Verify the integrity of files or directories against the database.
  • Report: Display all tracked file records.
  • Reset: Clear and reinitialize the database.
  • Exclusion Patterns: Skip files or directories using glob patterns (e.g., *.log).
  • Config File: Load settings from /etc/fmpp/fmpp.conf.

Requirements πŸ“‹

  • A Linux distribution (e.g., Debian, Ubuntu, Fedora, Arch Linux, openSUSE).
  • C++17-compatible compiler (e.g., GCC 8+).
  • Dependencies: cmake, libssl-dev (OpenSSL), libsqlite3-dev (SQLite3).

Installation πŸš€

The installation process is automated via the provided install-fmpp.sh script, which builds and installs the fmpp binary and default configuration.

For a System Installation

This installs FMPP into /usr/local/bin using sudo. Run:

curl -sL https://github.com/cryptrunner49/fmpp/releases/latest/download/install-fmpp.sh | bash -s -- install --system

For a User Installation

This installs FMPP into $HOME/.local/bin (and automatically adds it to your PATH if needed). Run:

curl -sL https://github.com/cryptrunner49/fmpp/releases/latest/download/install-fmpp.sh | bash -s -- install --user

Download the Latest Release Directly

curl -LO https://github.com/cryptrunner49/fmpp/releases/latest/download/fmpp
chmod +x fmpp

Steps to Build From Source πŸ“

  1. Clone or Download the Repository:

    git clone https://github.com/cryptrunner49/fmpp
    cd fmpp
  2. Make the Script Executable:

    chmod +x install-fmpp.sh
  3. Run the Installation:

    ./install-fmpp.sh install
    • This script:
      • Detects your Linux distribution (Debian, Ubuntu, Fedora, Arch, openSUSE).
      • Installs dependencies using the appropriate package manager (apt, dnf, pacman, zypper).
      • Creates necessary directories (/etc/fmpp, /var/lib/fmpp).
      • Builds and installs fmpp to /usr/local/bin.
      • Installs a default config file (/etc/fmpp/fmpp.conf).
  4. Verify Installation:

    fmpp --help

Notes πŸ“

  • Requires sudo privileges.
  • Internet access is needed to install dependencies.
  • The default config uses /bin as the monitored directory; adjust this in /etc/fmpp/fmpp.conf if needed.

Usage πŸ“š

Command-Line Options πŸ–₯️

fmpp [--config <config_file>] [--db <database_file>] <command> [options]
  • --config <file>: Specify a custom config file (default: /etc/fmpp/fmpp.conf).
  • --db <file>: Override the database path from the config file.

Commands πŸ”§

  • Initialize Database:

    fmpp init
  • Scan Directory:

    fmpp scan /path/to/dir [--exclude "*.log"] [--exclude "build/*"]
  • Monitor Directory:

    fmpp monitor /path/to/dir [--exclude "*.log"] [--interval 30]
    • If no directory is provided, uses monitor_dir from the config file.
  • Check Integrity:

    fmpp check /path/to/file_or_dir
  • Report Records:

    fmpp report
  • Reset Database:

    fmpp reset

Configuration File βš™οΈ

Edit /etc/fmpp/fmpp.conf to customize settings:

# File Monitor ++
db_path=/var/lib/fmpp/fmpp.db
monitor_dir=/var/www
exclude=*.log,build/*
interval=60
  • db_path: Database location.
  • monitor_dir: Directory to monitor (used by monitor if no directory is specified).
  • exclude: Comma-separated glob patterns to exclude.
  • interval: Monitoring interval in seconds.

Optional: Setting Up as a Systemd Service πŸ› οΈ

To run fmpp as a background service, use the sample fmpp.service file provided in the sample/ directory.

  1. Create a User (Optional):

    sudo useradd -r -s /bin/false -d /var/lib/fmpp fmppuser
    sudo chown fmppuser:fmppuser /var/lib/fmpp
  2. Copy the Service File:

    sudo cp sample/fmpp.service /usr/lib/systemd/system/
  3. Enable and Start the Service:

    sudo systemctl daemon-reload
    sudo systemctl enable fmpp.service
    sudo systemctl start fmpp.service
  4. Check Status:

    sudo systemctl status fmpp.service
  5. View Logs:

    journalctl -u fmpp.service
  • Adjust User, Group, and ExecStart in fmpp.service as needed (e.g., change fmppuser to your user).

Uninstallation πŸ—‘οΈ

To remove fmpp from your system:

  1. Run the Uninstall Command:

    ./install-fmpp.sh uninstall
    • This script:
      • Removes the binary (/usr/local/bin/fmpp), config directory (/etc/fmpp), and data directory (/var/lib/fmpp).
      • Cleans the build directory.
  2. Verify Removal:

    command -v fmpp || echo "FMPP binary removed"
  • If you set up the service manually, remove it with:

    sudo systemctl stop fmpp.service
    sudo systemctl disable fmpp.service
    sudo rm /usr/lib/systemd/system/fmpp.service
    sudo systemctl daemon-reload

Troubleshooting πŸ› οΈ

  • Command Not Found: Ensure /usr/local/bin is in your PATH (export PATH=$PATH:/usr/local/bin).
  • Permission Issues: Check that /var/lib/fmpp is writable by the user running fmpp.
  • Dependencies Missing: Run install-fmpp.sh install again to ensure all packages are installed.

Contributing 🀝

We welcome contributions! Check out our CONTRIBUTING.md for guidelines.

License πŸ“œ

Distributed under the GPL-3.0 License. See LICENSE for more information.

About

πŸ—‚οΈπŸ‘€ File Monitor ++ β€” Safeguard your system by monitoring specified directories for unauthorized changes, ensuring file integrity and enhancing security.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published