Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMBA fails to install in WSL environment #273

Closed
m-1-k-3 opened this issue Jul 23, 2022 · 2 comments · Fixed by #274
Closed

EMBA fails to install in WSL environment #273

m-1-k-3 opened this issue Jul 23, 2022 · 2 comments · Fixed by #274
Assignees
Labels
docker docker related things enhancement New feature or request Installation Installation issues unsupported Unsupported environment

Comments

@m-1-k-3
Copy link
Member

m-1-k-3 commented Jul 23, 2022

Thanks to https://twitter.com/jaylagorio we have tried to get EMBA running under WSL. There are some pitfalls that I want to show here. The following documentation is a quick howto to get EMBA up and running. In the near future I probably will integrate the relevant stuff into the installer.

Open Power Shell on your Windows host (with admin privs):

PS C:\WINDOWS\system32> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Do a reboot of your Windows host

PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Do a reboot of your Windows host

Download and install the WSL2 Linux Kernel from here: https://aka.ms/wsl2kernel

Open PowerShell as administrator and run:

PS C:\WINDOWS\system32> wsl --set-default-version 2

PS C:\WINDOWS\system32> wsl --install -d ubuntu

PS C:\WINDOWS\system32> wsl --list --verbose

image

As I have used the default ubuntu image I got the 20.04 LTS version. This version is not officially supported from EMBA. Let's give it a try:

m1k3@md3znjec:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"

First of all, I was running into issues with my DNS settings. So, I disabled the auto update and set it fixed to 8.8.8.8:

m1k3@md3znjec:~$ sudo vim /etc/wsl.conf
m1k3@md3znjec:~$ cat /etc/wsl.conf
# [network]
# generateResolvConf = false

m1k3@md3znjec:~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 8.8.8.8

After changing the DNS settings it was possible to resolve hostnames. Now, we need to update docker-compose. Another EMBA user (https://github.com/erd0spy) has already shown how this will work: #247

sudo curl -L https://github.com/docker/compose/releases/download/1.28.5/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

After these preparation steps we are mostly ready to go:

m1k3@md3znjec:~$ git clone https://github.com/e-m-b-a/emba.git

m1k3@md3znjec:~/emba$ sudo apt-get update

As we will run into issues with docker we install it now manually:

m1k3@md3znjec:~/emba$ sudo apt-get install docker.io

Start the docker daemon in the background:

m1k3@md3znjec:~/emba$ sudo dockerd &

image

Now we can give the installatino process a first try:

m1k3@md3znjec:~/emba$ sudo ./installer.sh -d

EMBA installs the initial stuff on the host and downloads the EMBA docker container

image

After a while the installer will fail during the setup of mongod:

image

This means that we already have most of the relevant installation process finished. Let's do the last steps manually:

m1k3@md3znjec:~/emba$ sudo sed -i 's/bindIp\:\ 127.0.0.1/bindIp\:\ 172.36.0.1/g' /etc/mongod.conf
[sudo] password for m1k3:
m1k3@md3znjec:~/emba$ sudo mongod --config /etc/mongod.conf &
[2] 11498
m1k3@md3znjec:~/emba$ sudo /etc/init.d/redis-server start
Starting redis-server: redis-server.

With this in place we should be able to manually update the cve database:

./external/cve-search/sbin/db_mgmt_cpe_dictionary.py -p
./external/cve-search/sbin/db_mgmt_json.py -p
./external/cve-search/sbin/db_updater.py -f

image

After all these steps EMBA should run as expected in your WSL Ubuntu environment.

image

I hope that I have noted all required steps. Please comment if something is not working as expected. I will do further tests with our supported Ubuntu and Kali Linux.

Thanks a lot to https://twitter.com/jaylagorio for an evening of testing, verifying and improving EMBA :)

@m-1-k-3 m-1-k-3 added enhancement New feature or request docker docker related things Installation Installation issues unsupported Unsupported environment labels Jul 23, 2022
@m-1-k-3 m-1-k-3 self-assigned this Jul 23, 2022
@m-1-k-3
Copy link
Member Author

m-1-k-3 commented Jul 24, 2022

Ubuntu 22.04 will also work in WSL with some adjustments:

Download and basic install:

curl.exe -L -o ubuntu-2204.appx https://aka.ms/wslubuntu2204
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb

install the packages with dpkg -i

sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update
sudo apt install docker-ce
sudo dockerd &

Afterwards you can use the installer and this will fail again at the mongod installation

@m-1-k-3
Copy link
Member Author

m-1-k-3 commented Jul 25, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker docker related things enhancement New feature or request Installation Installation issues unsupported Unsupported environment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant