Bookmark

Run MeshCentral for remote computer management in Docker

MeshCentral is a self-hosted web site for managing and controlling computers on a LAN or over the Internet. This adaptation keeps the i12bretro order: one MongoDB container, one MeshCentral container, separated data directories, and HTTPS on port 8086.1

Youtube video player

The original video follows the same deployment direction; the YouTube player is used directly and the video is not downloaded or rehosted.2

Install Docker on Linux

Log into Linux with sudo access and run the source command set:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# install prerequisites
sudo apt install apt-transport-https ca-certificates git curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER

For a current distribution, check the current Docker installation documentation because apt-key is deprecated. Re-authenticate so the Docker group takes effect.1

Run MongoDB and MeshCentral

  1. Create the data directories and shared network, then start MongoDB and MeshCentral:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# create working directories
mkdir ~/docker/meshcentral/{data,user_files} -p && mkdir ~/docker/mongodb -p
# set owner of working directories
sudo chown "$USER":"$USER" ~/docker -R
# create docker network
docker network create containers
# run mongodb container
docker run -d --name=mongodb --network containers -v ~/docker/mongodb:/data/db --restart=unless-stopped mongo
# run meshcentral container
# update the HOSTNAME variable
docker run -d --name=meshcentral --network containers -p 8086:443 -e HOSTNAME=ubuntuserver.local -e REVERSE_PROXY=false -e IFRAME=false -e ALLOW_NEW_ACCOUNTS=false -e WEBRTC=false -e NODE_ENV=production -v ~/docker/meshcentral/data:/opt/meshcentral/meshcentral-data -v ~/docker/meshcentral/user_files:/opt/meshcentral/meshcentral-files --restart=unless-stopped typhonragewind/meshcentral:mongodb-latest
# update the config file
sed -Ei 's/("NewAccounts": "false",)/"NewAccounts": "false",\n\t"allowedOrigin": true,/' ~/docker/meshcentral/data/config.json
# restart the container
docker restart meshcentral

Replace HOSTNAME=ubuntuserver.local with the hostname/DNS name that clients will use. Do not put a real password in the command or commit a credential-bearing config.json.1

  1. Open https://DNSorIP:8086.
  2. Accept the certificate warning if the default certificate is in use.
  3. Click the account-creation link.
  4. Enter a private username, email, and password, then click Create Account.
  5. Sign in and verify MeshCentral is working.

Verification and security

Check docker ps, the container logs, and ~/docker/meshcentral/data before exposing the service. Put MeshCentral behind a trusted HTTPS reverse proxy outside the LAN; keep ALLOW_NEW_ACCOUNTS=false after creating the administrator, and never expose MongoDB to the Internet.1

Source and video

Sources


  1. https://i12bretro.github.io/tutorials/0963.html — Run MeshCentral - Remote Management Site - in Docker (i12bretro) ↩︎ ↩︎ ↩︎ ↩︎

  2. https://www.youtube.com/watch?v=V94q02P1zwM — Run MeshCentral - Remote Management Site - in Docker (official video) ↩︎


0 Bình luận

Góp Ý / Bình Luận / Đánh giá