jymcheong / OpenEDR

Renamed to Free EDR to avoid confusion with Comodo's project
https://edr.sg
GNU General Public License v3.0
22 stars 8 forks source link

Installing OpenEDR with WSL2 #3

Closed jymcheong closed 4 years ago

jymcheong commented 4 years ago

OpenEDR installation will not work with WSL-1, it needs a Ubuntu container running on WSL-2. Everything will install as if it is in a VM but...

Caveats

Note that:

  1. Assuming you enable WSL2, the installation order should be, 1) Ubuntu, 2) Docker Desktop & lastly OpenEDR
  2. docker will not start with host; you will need Windows docker desktop to configure to start service after user sign-in
  3. eth0 will change IP with each reboot (unlike a VM which is rather static even with DHCP), this affects the sftp service for Windows endpoint to upload event files.

For each Windows host reboot, you will need to use Ubuntu console to run:

cd openEDR
manage/mountUploads.sh

The script will start bindfs mount & start onewaysftp container.

It is better to use an Ubuntu VM (eg. HyperV, VirtualBox or VMware) to host OpenEDR backend because

But I WANT WSL2!

Let's say you really to use OpenEDR with WSL2, these are additional steps to take:

  1. Rebuild onewaysftp container to listen on 127.0.0.1:2222
  2. Add Windows port-proxying from 0.0.0.0:2222 to 127.0.0.1:2222
  3. Modify sftpconf.json within sftpconf.zip

Rebuild SFTP Container

Please use the instruction from https://github.com/jymcheong/OpenEDR/wiki/0.-Installation#modify-env-to-reassign-frontend_ip but modify SFTP_HOST=127.0.0.1 instead.

Port-Proxying

The backend installation script will use container's eth0, that IP is based on NAT addressing. That means if you have another Windows VM, it will likely have issues uploading to the OpenEDR onewaysftp container. After we rebuilt the container, the docker host 127.0.0.1:2222 is accessible. You can install OpenEDR host agent on the Windows host but it is NOT recommended.

Using an admin powershell session:

netsh interface portproxy add v4tov4 listenport=2222 listenaddress=0.0.0.0 connectport=2222 connectaddress=127.0.0.1

Modify sftpconf.json

Using Ubuntu console:

Last step will re-generate sftpconf.zip which is under openEDR/backend/sftp/keys.

sftpconf.zip needs to be copied to the target Windows endpoint installed with OpenEDR under c:\Windows\openedr.