Outils pour utilisateurs

Outils du site


meshcentral-sur-lxc

Ceci est une ancienne révision du document !


Installation de Meshcentral sur LXC

Liens

Outils

apt install net-tools bash-completion software-properties-common
 
 
dpkg-reconfigure locales
 
cat <<EOF | tee -a /etc/bash.bashrc
if [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
fi
EOF

Réseau

cat <<EOF | tee /etc/netplan/10-lxc.yaml
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      addresses:
        - 10.0.3.133/24
      gateway4: 10.0.3.1
      nameservers:
        addresses:
          - 213.186.33.99 
          - 8.8.8.8
EOF

Meshcentral

apt install -y nodejs npm
node -v
npm -v
apt install mongodb -y
systemctl start mongodb
systemctl enable mongodb
setcap cap_net_bind_service=+ep /usr/bin/node
echo "@reboot setcap cap_net_bind_service=+ep /usr/bin/node" | crontab -
useradd -r -d /opt/meshcentral -s /sbin/nologin meshcentral
mkdir /opt/meshcentral
cd /opt/meshcentral
npm install meshcentral
npm install archiver@4.0.2 otplib@10.2.3 mongodb
mkdir /opt/meshcentral/meshcentral-data
chown -R meshcentral:meshcentral /opt/meshcentral
chmod 755 -R /opt/meshcentral/meshcentral-*
 
 
cat <<'EOF' | tee /opt/meshcentral/meshcentral-data/config.json
{
  "settings": {
    "MongoDb": "mongodb://127.0.0.1:27017/meshcentral",
    "Cert": "myservername.domain.com",
    "AliasPort": 443,
    "Port": 4430,
    "RedirPort": 800,
    "AgentPong": 300,
    "TlsOffload": "127.0.0.1"
  }
  "domains": {
  "": {"certUrl": "https://127.0.0.1:443/"}
  }
}
EOF
 
sudo -u meshcentral node ./node_modules/meshcentral

Apache revese proxy

https://github.com/Ylianst/MeshCentral/issues/317#issuecomment-525048548

ProxyPreserveHost On
ProxyRequests Off
 
ProxyPass "/agent.ashx" "ws://10.0.3.133:4430/agent.ashx"
ProxyPass "/amtactivate" "ws://10.0.3.133:4430/amtactivate"
ProxyPass "/control.ashx" "ws://10.0.3.133:4430/control.ashx"
ProxyPass "/meshrelay.ashx" "ws://10.0.3.133:4430/meshrelay.ashx"
ProxyPass "/webrelay.ashx" "ws://10.0.3.133:4430/webrelay.ashx"
ProxyPass "/webider.ashx" "ws://10.0.3.133:4430/webider.ashx"
ProxyPass / http://10.0.3.133:4430/

Systemd service

cat <<EOF | tee /etc/systemd/system/meshcentral.service
[Unit]
Description=MeshCentral Server

[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=/usr/bin/node /opt/meshcentral/node_modules/meshcentral
WorkingDirectory=/opt/meshcentral
Environment=NODE_ENV=production
User=meshcentral
Group=meshcentral
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10
# Set port permissions capability
AmbientCapabilities=cap_net_bind_service

[Install]
WantedBy=multi-user.target
EOF

systemctl enable meshcentral.service
systemctl start meshcentral.service
systemctl status meshcentral.service
systemctl stop meshcentral.service
meshcentral-sur-lxc.1604852419.txt.gz · Dernière modification: 2020/11/08 17:20 de pielo