Skip to content

Deployment

debifrank edited this page Sep 28, 2022 · 1 revision

This installation guide has been tested on fresh installs of Ubuntu 18.04 and 20.04.

Installing Dependencies

ETM is written with .NET Core, and is designed to run on Linux systems. ETM also is designed to work within Docker containers.

Update

  • sudo apt update
  • sudo apt upgrade

Install Vim

  • sudo apt install vim

Install GIT

  • sudo apt install git

Install DOS2Unix

  • sudo apt install dos2unix

Install Docker Engine

  • sudo apt update
  • sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  • sudo apt update
  • sudo apt install docker-ce docker-ce-cli containerd.io docker-compose

Setting up your environment

Creating directories

  • /var/matrix
  • /var/matrix/app
  • /var/matrix/mongo
  • /var/matrix/mongo/db
  • /var/matrix/mongo/configdb

Clone ETM

  • cd /var/matrix/app
  • git clone https://github.com/blacklanternsecurity/enter_the_matrix.git

Edit docker-compose.yaml

  • Change the following line to a unique password (alphanumeric)
  • - MONGO_INITDB_ROOT_PASSWORD=CHANGEMESUCKAH

Edit AppSettings.JSON

  • cd /var/matrix/app/enter_the_matrix
  • vim appsettings.json
  • Alter the ConnectionString to use your password for the MongoDB container
  • Replace the "Ldap" fields with your LDAP configuration
  • Replace the "LocalAuthSettings" with your desired administrative account credentials

Edit LdapAuthenticationService.cs

  • cd /var/matrix/app/enter_the_matrix/Services
  • vim LdapAuthenticationService.cs
  • Alter line 61 and replace OU=YOURORG,DC=REPLACEME,DC=ANDME with the appropriate information for your organization

SSL Certificate

  • Place your SSL certificate at /var/matrix/app/enter_the_matrix/matrix.cer
  • Place your SSL key at /var/matrix/app/enter_the_matrix/matrix.key
  • To create your own self-signed certificate and key:
    • sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout matrix.key -out matrix.cer

Nginx Config

  • Alter enter_the_matrix.conf and replace YOURDOMAIN with your domain if you are using one

For whatever reason the nginx configuration does not play nicely coming from a Windows development environment even when specifically telling GIT to convert to LF end-of-line format. So, do the following:

  • dos2unix /var/matrix/app/enter_the_matrix/enter_the_matrix.conf

Build

.NET SDK

If you are using Ubuntu 18.04:

  • wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

Ubuntu 20.04:

  • wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

  • sudo dpkg -i packages-microsoft-prod.deb

  • sudo apt-get install -y apt-transport-https

  • sudo apt-get update

  • sudo apt-get install -y dotnet-sdk-5.0

Build the project

  • sudo cd /var/matrix/app/enter_the_matrix
  • sudo dotnet publish --configuration Release

Deploy

  • cd /var/matrix/app/enter_the_matrix
  • docker-compose up -d