LSMS – Linux Security And Monitoring Scripts

These are a collection of security and monitoring scripts you can use to monitor your Linux installation for security-related events or for an investigation. Each script works on its own and is independent of other scripts. The scripts can be set up to either print out their results, send them to you via mail, or using AlertR as notification channel.

LSMS - Linux Security And Monitoring Scripts

Monitoring

If you want to use the scripts to monitor your Linux system constantly, you have to perform the following steps:

  • Set up a notification channel that is supported by the scripts (currently printing out, mail, or AlertR).
  • Configure the scripts that you want to run using the configuration files in the directory.scripts/config/
  • Execute with the argument to initialize the scripts with the prefix and let them establish a state of your system. However, this assumes that your system is currently uncompromised. If you are unsure of this, you should verify its current state.start_search.py--initmonitor_
  • Set up a cron job as user that executes (e.g., to start the search hourly).rootstart_search.py0 * * * * root /opt/LSMS/start_search.py

    List of Scripts

    NameScript
    Monitoring cron filesmonitor_cron.py
    Monitoring /etc/hosts filemonitor_hosts_file.py
    Monitoring /etc/ld.so.preload filemonitor_ld_preload.py
    Monitoring /etc/passwd filemonitor_passwd.py
    Monitoring modulesmonitor_modules.py
    Monitoring SSH authorized_keys filesmonitor_ssh_authorized_keys.py
    Monitoring systemd unit filesmonitor_systemd_units.py
    Search executables in /dev/shmsearch_dev_shm.py
    Search fileless programs (memfd_create)search_memfd_create.py
    Search hidden ELF filessearch_hidden_exe.py
    Search immutable filessearch_immutable_files.py
    Search kernel thread impersonationssearch_non_kthreads.py
    Search processes that were started by a now disconnected SSH sessionsearch_ssh_leftover_processes.py
    Search running deleted programssearch_deleted_exe.py
    Test script to check if alerting workstest_alert.py
    Verify integrity of installed .deb packagesverify_deb_packages.py

    Download LSMS