Code Monkey home page Code Monkey logo

defense-matrix's Introduction

Defense Matrix (Archived Project)

This project was an attempt to automate various aspects of Linux security auditing and hardening. As time passed, I (K4YT3X) found many of the methodologies used in this project to be unideal and obsolete. Therefore, I recommend not continuing using this project but instead turning towards more advanced, up-to-date solutions. Below are some examples.

  • UFW (Uncomplicated Firewall): UFW is a wrapper of iptables/nftables. It makes configuring firewall fast and easy. If you have no experience configuring firewalls, or if you do not want to edit the rules manually, UFW is an excellent option to consider.
  • ArpON: ArpON is a host-based ARP monitoring and MITM prevention software. There are also other solutions like arpwatch and arpalert.
  • Lynis: Lynis is a Linux security auditing tool that helps you to identify security issues on a Linux host. It is also capable of checking a host's compliance with security standards.
  • PAM: Instead of replacing the original /usr/bin/passwd, it's recommended for you to set appropriate password complexity rules in PAM.

This project might be revived as a generic Linux hardening script in the future, but there's too much uncertainty lying in front of this project.


Join the chat at https://gitter.im/K4YT3X-DEV/DefenseMatrix status

Warning: passwd Binary Bug

The current method that defense matrix is using to enforce higher password strength seems defective. Therefore we have temporarily disabled the replacement of default system passwd binary.

If you wish to recover your default passwd binary file, please execute the following command to move the original binary back to its place.

sudo mv /usr/bin/oldpasswd /usr/bin/passwd

In the future, we'll be using a more stable, robust and secure way to implement this feature.

1.1.0 (October 20, 2018)

  • Rearranged executable files.
  • Removed everything that's redundant.
  • All tests passed. We are not expecting major bugs.
  • Integration with SCUTUM firewall fixed.
  • Unified code style (' and ", function and variable naming scheme)

Quick Install

Prerequisites

  • Designed for Linux OS
  • curl or wget is required for quick install
  • git should be installed

Detailed dependency list can be found in DEPENDENCIES.md

Via curl:

sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/K4YT3X/defense-matrix/master/quickinstall.sh)"

Via wget:

sudo bash -c "$(wget https://raw.githubusercontent.com/K4YT3X/defense-matrix/master/quickinstall.sh -O -)"

What is Defense Matrix?

DefenseMatrix helps individuals and organizations who use Linux to secure their servers on various dimensions automatically. It makes securing a Linux server faster and easier.

Never before have a program been able to have so many security features packed in one. Therefore we provide you with this all-in-one solution that will make the following difficult things easier to handle.

Why do you need Defense Matrix?

During HTN we made a test. Our nameless linux server which is exposed to the internet received roughly 6000 attacks and port scanning attempts every 24 hours.

Defense Matrix Features

scutum

  • TCP/UDP/ICMP firewall
  • ARP firewall

tiger & rkhunter

  • Rootkit Detection
  • Configuration sanity check

Other

  • Password complexity check

TODO

  • Attack analysis and visualization

These basic security features will defend your server(s) against most tech based attacks. We configure these things automatically for you.

Uninstallation

We make this easy for you.

sudo defense-matrix --uninstall

Usages

ALL commands require root privilege.

Firewall Controls

Firewall is controlled by SCUTUM Firewall. For more details please visit SCUTUM Help Page

sudo openport [port1] [port2] [port3]      # Open tcp ports
sudo closeport [port1] [port2] [port3]     # Close tcp ports
sudo service scutum start     # Start scutum service
sudo service scutum stop      # Stop scutum service
sudo systemctl enable scutum  # Start SCUTUM with system
sudo systemctl disable scutum # Don't start SCUTUM with system
sudo scutum                   # Start SCUTUM Normally
sudo scutum --start           # Start SCUTUM Manually for once even it it's disabled
sudo scutum --enable          # Enable SCUTUM (Start automatically on connect)
sudo scutum --disable         # Disable SCUTUM (Don't start automatically on connect)
sudo scutum --reset           # Reset SCUTUM (Allow ALL ARP packages temporarily)
sudo scutum --purgelog        # Purge SCUTUM logs
sudo scutum --install         # Run scutum installation wizard and install SCUTUM into system
sudo scutum --uninstall       # Remove SCUTUM from system completely
sudo scutum --upgrade         # Upgrade SCUTUM and AVALON Framework

Security Audit

Defense Matrix installs a number of security auditing tools for you, and more could be added later. To save you time executing those commands separately, we condense everything in to one command which will execute them all.

sudo defense-matrix --audit

Password Complexity Check

The default passwd binary will be replaced by our enhanced passwd command, and the old binary file will be backed up at /usr/bin/oldpasswd. When you change the password using passwd after installing Defense Matrix, it will require password with higher complexity.

TODO To restore the original passwd binary file:

sudo passwd --restore

What if I want to be more secure?

If you still feel unsafe after installing this security suite, we recommend you to look into IDSs and WAFs. Snort will be a good one to begin with.

defense-matrix's People

Contributors

eternali avatar ivensportugal avatar k4yt3x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

defense-matrix's Issues

AttributeError: 'NoneType' object has no attribute 'decode' kernel 4.19.0-9-amd64 debian live buster 10.4.0

user@debian:~$ defense-matrix --audit
[!] ERROR: This app requires root privilege to run!
user@debian:~$ sudo defense-matrix --audit
[+] INFO: Launching tiger
Tiger UN*X security checking system
   Developed by Texas A&M University, 1994
   Updated by the Advanced Research Corporation, 1999-2002
   Further updated by Javier Fernandez-Sanguino, 2001-2018
   Contributions by Francisco Manuel Garcia Claramonte, 2009-2010
   Covered by the GNU General Public License (GPL)

Configuring...
 
Will try to check using config for 'unknown' running Linux 4.19.0-9-amd64...
--CONFIG-- [con005c] Using configuration files for Linux 4.19.0-9-amd64. Using
           configuration files for generic Linux 4.
Tiger security scripts *** 3.2.4rc1, 2018.02.10.20.30 ***
11:42> Beginning security report for localhost.
11:42> Starting file systems scans in background...
11:42> Checking password files...
11:42> Checking group files...
11:42> Checking user accounts...
11:42> Checking .rhosts files...
11:42> Checking .netrc files...
11:42> Checking ttytab, securetty, and login configuration files...
11:42> Checking PATH settings...
11:42> Checking anonymous ftp setup...
11:42> Checking mail aliases...
11:42> Checking cron entries...
11:42> Checking 'services' configuration...
11:42> Checking NFS export entries...
11:42> Checking permissions and ownership of system files...
11:42> Checking for indications of break-in...
11:42> Performing rootkit checks...
11:43> Performing system specific checks...
12:17> Performing root directory checks...
12:17> Checking for secure backup devices...
12:17> Checking for the presence of log files...
12:17> Checking for the setting of user's umask...
12:17> Checking for listening processes...
12:17> Checking SSHD's configuration...
12:17> Checking the printers control file...
12:17> Checking ftpusers configuration...
12:17> Checking NTP configuration...
12:17> Waiting for filesystems scans to complete...
12:17> Filesystems scans completed...
12:17> Performing check of embedded pathnames...
12:17> Security report completed for localhost.
Security report is in `/var/log/tiger/security.report.localhost.200616-11:42'.
[!] ERROR: An exception was caught
Traceback (most recent call last):
  File "/usr/bin/defense-matrix", line 80, in <module>
    audit.run()
  File "/usr/share/defense-matrix/bin/security_audit.py", line 27, in run
    self._run_tiger()
  File "/usr/share/defense-matrix/bin/security_audit.py", line 32, in _run_tiger
    Utilities.execute(['tiger'], std_in=sys.stdin, std_out=sys.stdout, std_err=sys.stderr)
  File "/usr/share/defense-matrix/bin/utilities.py", line 34, in execute
    return process.communicate()[0].decode().split('\n')
AttributeError: 'NoneType' object has no attribute 'decode'
user@debian:~$ uname -r
4.19.0-9-amd64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.