### Install and Start MeshCentral via NPM
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/quickstart.md
This snippet shows the basic steps to install the MeshCentral package using npm and then start the server. It assumes you have Node.js and npm installed. Ensure you are not using sudo for the installation command. The server will set itself up and manage local network devices with the MeshAgent.
```shell
# Example: Create and move into the directory
mkdir -p /opt/meshcentral
cd /opt/meshcentral
# Install the MeshCentral package
npm install meshcentral
# Start the server
node node_modules/meshcentral
```
--------------------------------
### Start MeshCentral with WAN Access Configuration
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/advanced.md
Examples of starting the MeshCentral server with arguments to configure it for WAN or Hybrid Mode, including generating necessary certificates. This allows remote management over the internet.
```shell
# Using a domain name
node node_modules/meshcentral --cert servername.domain.com
# Using an IP address
node node_modules/meshcentral --cert 1.2.3.4
```
--------------------------------
### MeshCentral Plugin Structure Example
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/plugins.md
This illustrates the typical directory structure for a MeshCentral plugin. It includes a `config.json` for metadata, the main plugin JavaScript file (`plugin_name.js`), and an optional `modules_meshcore` directory for additional modules.
```bash
plugin_name/
-- config.json
-- plugin_name.js
-- modules_meshcore/ // optional
--- plugin_name.js // optional
```
--------------------------------
### Start MeshCentral Server
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/advanced.md
Command to start the MeshCentral server. It's crucial to run this from the directory above 'node_modules' for features like auto-install and self-update to work correctly. Running without arguments defaults to LAN-only mode.
```shell
node node_modules/meshcentral [arguments]
```
--------------------------------
### Install and Run MeshCentral Server
Source: https://context7.com/ylianst/meshcentral/llms.txt
Installs MeshCentral globally using npm and starts the server. The server automatically generates a configuration file and runs on default HTTPS and HTTP ports. It requires Node.js and npm to be installed.
```bash
# Install MeshCentral globally via npm
npm install meshcentral -g
# Create working directory and start server (auto-generates config)
mkdir meshcentral-data
cd meshcentral-data
meshcentral
# Server will start on:
# - HTTPS: Port 443 (main interface)
# - HTTP: Port 80 (auto-redirect to HTTPS)
# - Intel AMT MPS: Port 4433 (optional)
# Configuration file will be created at:
# ./meshcentral-data/config.json
```
--------------------------------
### MeshCentral Configuration File Example
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshctrl/index.md
An example JSON configuration file for MeshCentral, illustrating how different domains are defined. This structure is used to understand the --domain and --url arguments when logging into specific domains via meshctrl.
```json
{
"settings": {
"Cert": "myserver.com",
"Port": 443
},
"domains": {
"": {
"title": "Default domain",
},
"customer1": {
"dns": "c1.myserver.com",
"title": "Customer1 domain",
}
}
}
```
--------------------------------
### Verify Node.js and NPM Versions
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/advanced.md
Commands to check if Node.js and NPM are installed and their respective versions. These are essential prerequisites for installing MeshCentral.
```shell
node -v
```
```shell
npm -v
```
--------------------------------
### Install MeshCentral using NPM
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/advanced.md
Shell commands to create a directory, navigate into it, and install the MeshCentral package using NPM. It's recommended to use /opt/meshcentral on Linux and avoid using sudo.
```shell
# Create the directory
mkdir -p /opt/meshcentral
# Move into the directory
cd /opt/meshcentral
# Install MeshCentral
npm install meshcentral
```
--------------------------------
### MeshCentral JSON Configuration Examples
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/faq.md
Demonstrates valid and ignored settings in MeshCentral's config.json file. Note that keys starting with an underscore are ignored.
```json
```json
"title": "MyServer"
```
```
```json
```json
"_title": "MyServer"
```
```
--------------------------------
### Download MeshAgent for Windows
Source: https://github.com/ylianst/meshcentral/blob/master/emails/mesh-invite.html
Provides a direct download link for the MeshAgent installer for Windows. This link includes parameters for device ID, mesh ID, email tagging, and installation flags.
```html
Click here to download the MeshAgent for Windows.
```
--------------------------------
### Install MeshAgent on Linux
Source: https://github.com/ylianst/meshcentral/blob/master/emails/mesh-invite.html
Provides a shell command to download, make executable, and run the MeshAgent installation script on Linux systems. It requires `wget`, `chmod`, and `sudo`.
```bash
wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh \'[[[SERVERURL]]]' \'[[[MESHIDHEX]]]\'
```
--------------------------------
### MeshCentral Manual Installation and Update Commands
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/debugging.md
These bash commands illustrate the recommended manual installation process for MeshCentral using npm. It covers creating a directory, installing the package, running the server, and updating it. This method offers more control compared to the MSI installer.
```bash
mkdir c:\meshcentral
cd c:\meshcentral
npm install meshcentral
node node_modules\meshcentral
```
```bash
mv node_modules node_modules_bak
npm install meshcentral
node node_modules/meshcentral
```
```bash
node node_modules/meshcentral --install
node node_modules/meshcentral --uninstall
node node_modules/meshcentral --start
node node_modules/meshcentral --stop
```
--------------------------------
### Install MeshCommander Background Service (Bash)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Installs MeshCommander as a background service on the system. The command specifies the installation path for the executable. This facilitates running MeshCommander without manual intervention.
```bash
C:\MeshCmd>meshcmd meshcommander install
Installing to "C:\Program Files (x86)\Open Source\MeshCmd\MeshCommander.exe" MeshCommander installed.
```
--------------------------------
### Enable Plugins in MeshCentral Configuration
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/plugins.md
This JSON snippet shows how to enable the plugin system in MeshCentral's configuration file. Ensure this setting is `true` to allow plugins to be installed and used. This configuration change requires a MeshCentral restart.
```json
{
"plugins": {
"enabled": true
}
}
```
--------------------------------
### Load MeshCentral Configuration from Database
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
This command starts the MeshCentral server using configuration files stored in the database. It requires the encryption password (provided either directly or via the `--configkey` option) and the connection string for the database, such as MongoDB in this example. This allows MeshCentral to run in a state-less mode.
```bash
node ./node_modules/meshcentral --loadconfigfromdb mypassword --mongodb "mongodb://127.0.0.1:27017/meshcentral"
```
--------------------------------
### Download MeshAgent for macOS
Source: https://github.com/ylianst/meshcentral/blob/master/emails/mesh-invite.html
Provides a direct download link for the MeshAgent installer for macOS. This link includes parameters for device ID, mesh ID, email tagging, and installation flags.
```html
Click here to download the MeshAgent for Apple OSX.
```
--------------------------------
### Generic SAML Setup Configuration (JSON)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
Configures a generic SAML authentication provider for MeshCentral. This involves setting up callback URLs, entity IDs, IdP URLs, and identity provider certificates in the config.json file. Requires MeshCentral to install extra NPM modules.
```json
{
"settings": {
"Cert": "myserver.mydomain.com",
"Port": 443,
"RedirPort": 80
},
"domains": {
"": {
"Title": "MyServer",
"Title2": "Servername",
"NewAccounts": 1,
"authStrategies": {
"saml": {
"__callbackurl": "https://server/auth-saml-callback",
"entityid": "meshcentral",
"idpurl": "https://server/saml2",
"cert": "saml.pem"
}
}
}
}
}
```
--------------------------------
### Running MeshCtrl Command Line Tool
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshctrl/index.md
This command shows how to execute the MeshCtrl tool, which is part of the MeshCentral installation. When run without parameters, it displays usage instructions and a list of supported actions and arguments for managing the MeshCentral server.
```shell
node ./node_modules/meshcentral/meshctrl
```
--------------------------------
### Install MicroLMS Background Service (Bash)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Installs MicroLMS as a background service on the system, similar to MeshCommander installation. The command indicates the installation path for the MicroLMS executable.
```bash
C:\MeshCmd>meshcmd microlms install
Installing to "C:\Program Files (x86)\Open Source\MeshCmd\MicroLMS.exe"
MicroLMS installed.
```
--------------------------------
### Linux Agent Installation Script
Source: https://github.com/ylianst/meshcentral/blob/master/emails/mesh-invite.txt
This command downloads and executes a MeshCentral agent installation script on Linux systems. It requires wget to be installed and uses sudo for elevated privileges. The script takes the server URL and mesh ID as arguments.
```bash
wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] '[[[MESHIDHEX]]]'
```
--------------------------------
### Configure NPM Proxy Settings
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/advanced.md
Shell commands to set HTTP and HTTPS proxy configurations for NPM. This is required if your server is behind a proxy to access external resources during installation.
```shell
# Set HTTP proxy
npm config set proxy http://proxy.com:88
# Set HTTPS proxy
npm config set https-proxy http://proxy.com:88
```
--------------------------------
### Pull MeshCentral Docker Image
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/container.md
Command to pull the latest MeshCentral Docker image from the GitHub Container Registry. This is the first step before running the container.
```sh
docker pull ghcr.io/ylianst/meshcentral:latest
```
--------------------------------
### MeshCentral Default Configuration with Node.js
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
Standard MeshCentral server setup using Node.js, specifying certificate name, and default ports for MeshAgent and Intel AMT connections. This is a common starting point for server deployment.
```bash
node meshcentral --cert Server1 --port 443 --mpsport 4433
```
--------------------------------
### Install MeshAgent on Linux using wget
Source: https://github.com/ylianst/meshcentral/blob/master/emails/translations/mesh-invite_pt-br.html
This script downloads, makes executable, and runs the MeshAgent installation script for Linux. It requires wget and sudo privileges. The script takes the server URL and Mesh ID as arguments.
```shell
wget -q "[[[SERVERURL]]]/meshagents?script=1" --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[["SERVERURL"]]] \'[[[MESHIDHEX]]]\'
```
--------------------------------
### Initialize MeshCentral Data Folders
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/security/secure.md
Runs the MeshCentral server once as the 'meshcentral' user to generate necessary data folders and install initial dependencies. The process is stopped with CTRL-C after folder creation.
```shell
# Run once as the meshcentral user
sudo -u meshcentral node ./node_modules/meshcentral
```
--------------------------------
### MeshCentral Vault Configuration Example (JSON)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
An example of a minimal config.json file used to configure MeshCentral to connect to a HashiCorp Vault server. This file specifies the Vault endpoint, token, unseal key, and the name for the MeshCentral secrets.
```json
{
"settings": {
"vault": {
"endpoint": "http://127.0.0.1:8200",
"token": "s.cO4Q…",
"unsealkey": "7g4wFC…",
"name": "meshcentral"
}
}
}
```
--------------------------------
### MeshCentral Plugin Development: config.json Structure
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/plugins.md
This JSON object represents the configuration file for a MeshCentral plugin. It defines essential metadata like name, version, author, and URLs for changelog, configuration, and downloads. It also specifies compatibility with MeshCentral versions and repository details.
```json
{
"name": "Plugin Name",
"shortName": "plugin_name",
"version": "0.0.0",
"author": "Author Name",
"description": "Short Description of the plugin",
"hasAdminPanel": false,
"homepage": "https://www.example.com",
"changelogUrl": "https://raw.githubusercontent.com/User/Project/master/changelog.md",
"configUrl": "https://raw.githubusercontent.com/User/Project/master/config.json",
"downloadUrl": "https://github.com/User/Project/archive/master.zip",
"repository": {
"type": "git",
"url": "https://github.com/User/Project.git"
},
"versionHistoryUrl": "https://api.github.com/repos/User/Project/tags",
"meshCentralCompat": ">0.4.3"
}
```
--------------------------------
### MeshCentral npm Installation Command
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/debugging.md
This command demonstrates how to install MeshCentral from the command line using npm. It is a prerequisite for running the server manually and ensures that all necessary dependencies are downloaded and installed correctly.
```bash
node node_modules\meshcentral
```
--------------------------------
### Agent Installation on Linux
Source: https://context7.com/ylianst/meshcentral/llms.txt
Install MeshCentral agents on Linux distributions. This involves downloading the agent, making it executable, installing it using `sudo`, checking its service status, and uninstalling it. Requires `chmod` and `systemctl` commands.
```bash
# Linux - Install agent
# Download agent from: https://mesh.example.com/meshagents?id=6&meshid=mesh%2F%2Fxxxxxxxxxxxxxxx
# Make executable and install
chmod +x meshagent
sudo ./meshagent -install
# Check agent status
sudo systemctl status meshagent
# Uninstall agent
sudo ./meshagent -uninstall
```
--------------------------------
### Advanced Client Configuration Example
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/openidConnectStrategy.md
Demonstrates an advanced configuration for the OIDC client in MeshCentral. This example includes essential identifiers, redirect URIs, and token endpoint authentication methods.
```json
"client": {
"client_id": "00b3875c-8d82-4238-a8ef-25303fa7f9f2",
"client_secret": "7PP453H577xbFDCqG8nYEJg8M3u8GT8F",
"redirect_uri": "https://mesh.your.domain/auth-oidc-callback",
"post_logout_redirect_uri": "https://mesh.your.domain/login",
"token_endpoint_auth_method": "client_secret_post",
"response_types": "code"
}
```
--------------------------------
### Agent Installation
Source: https://context7.com/ylianst/meshcentral/llms.txt
Instructions for deploying MeshCentral agents on Windows, Linux, and macOS systems, including silent installation and configuration options.
```APIDOC
## Agent Installation
### Description
Deploy agents on managed devices for Windows, Linux, and macOS.
### Method
Command Line Execution
### Endpoints
**(Varies by OS and download source)**
### Details
**Windows**
1. Download agent from: `https://mesh.example.com/meshagents?id=4&meshid=mesh%2F%2Fxxxxxxxxxxxxxxx`
2. **Silent Install:** `meshagent.exe -install --installPath="C:\Program Files\MeshAgent"`
3. **Install with Custom Config:** `meshagent.exe -install --installPath="C:\Program Files\MeshAgent" --meshServer="wss://mesh.example.com/agent.ashx" --meshId="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`
4. **Check Status:** `sc query meshagent`
5. **Uninstall:** `meshagent.exe -uninstall`
**Linux**
1. Download agent from: `https://mesh.example.com/meshagents?id=6&meshid=mesh%2F%2Fxxxxxxxxxxxxxxx`
2. Make executable: `chmod +x meshagent`
3. **Install:** `sudo ./meshagent -install`
4. **Check Status:** `sudo systemctl status meshagent`
5. **Uninstall:** `sudo ./meshagent -uninstall`
**macOS**
1. Download agent from: `https://mesh.example.com/meshagents?id=16&meshid=mesh%2F%2Fxxxxxxxxxxxxxxx`
2. **Install:** `chmod +x meshagent`
`sudo ./meshagent -install`
3. **Check Status:** `sudo launchctl list | grep meshagent`
4. **Uninstall:** `sudo ./meshagent -uninstall`
```
--------------------------------
### Agent Installation on Windows
Source: https://context7.com/ylianst/meshcentral/llms.txt
Deploy MeshCentral agents on Windows systems using command-line arguments. This includes silent installations, installations with custom server configurations, checking agent status, and uninstallation. Requires the `meshagent.exe` executable and appropriate permissions.
```powershell
# Windows - Install agent via command line
# Download agent from: https://mesh.example.com/meshagents?id=4&meshid=mesh%2F%2Fxxxxxxxxxxxxxxx
# Silent install
meshagent.exe -install --installPath="C:\Program Files\MeshAgent"
# Install with custom config
meshagent.exe -install --installPath="C:\Program Files\MeshAgent" \
--meshServer="wss://mesh.example.com/agent.ashx" \
--meshId="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# Check agent status
sc query meshagent
# Uninstall agent
meshagent.exe -uninstall
```
--------------------------------
### Start MeshCommander Background Service (Bash)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Starts the MeshCommander background service after it has been installed. This command ensures MeshCommander runs in the background, providing continuous access to its features.
```bash
C:\MeshCmd>meshcmd meshcommander start
MeshCommander starting.
```
--------------------------------
### Start MicroLMS Background Service (Bash)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Starts the MicroLMS background service after installation. This ensures MicroLMS runs continuously, providing essential Intel AMT management functionalities.
```bash
C:\MeshCmd>meshcmd microlms start
MicroLMS starting.
```
--------------------------------
### Download MeshCentral Assistant for Windows
Source: https://github.com/ylianst/meshcentral/blob/master/emails/mesh-invite.html
Provides a direct download link for the MeshCentral Assistant for Windows. This link includes parameters for device ID, mesh ID, email tagging, and assistant type.
```html
Click here to download the MeshCentral Assistant for Windows.
```
--------------------------------
### Example IP List File Format for MeshCentral
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
This is an example of a text file format used by MeshCentral for IP address filtering. Each line starting with a number or colon is treated as an IP address or network range. Lines starting with '#' are ignored and can be used for comments, facilitating organized IP management.
```txt
# My list of blocked IP's
185.101.70.0/24
185.46.85.0/24
37.9.44.0/24
37.9.45.0/24
5.189.205.0/24
5.189.206.0/24
5.189.207.0/24
5.62.153.0/24
5.62.156.0/24
5.62.158.0/24
# One more list
5.8.44.0/24
5.8.45.0/24
5.8.46.0/24
79.110.28.0/24
79.110.31.0/24
91.204.14.0/24
95.181.218.0/24
95.85.81.0/24
```
--------------------------------
### Set up PostgreSQL Database and User for MeshCentral
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/database/postgresql.md
This section provides bash and SQL commands to set up a PostgreSQL database and user for MeshCentral. It includes logging into `psql`, creating a new user with a password, creating the database, and assigning ownership to the new user. Remember to replace placeholder passwords with strong, unique ones.
```bash
# Log into the server
psql -U postgres
```
```sql
-- Create the database user
postgres=# CREATE USER meshcentral WITH PASSWORD 'your-very-strong-password';
CREATE ROLE
-- Create the database and set the above user as owner
postgres=# CREATE DATABASE meshcentral OWNER meshcentral;
CREATE DATABASE
-- Exit the database
postgres=# exit
```
--------------------------------
### MeshCtrl Supported Actions and Arguments
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshctrl/index.md
This output details the available commands and parameters for the MeshCtrl command-line tool. It lists actions for server information, user management, device management, device group management, and sending broadcast messages, along with supported login arguments for server connection.
```shell
MeshCtrl performs command line actions on a MeshCentral server.
Information at: https://meshcommander.com/meshcentral
No action specified, use MeshCtrl like this:
meshctrl [action] [arguments]
Supported actions:
Help [action] - Get help on an action.
ServerInfo - Show server information.
UserInfo - Show user information.
ListUsers - List user accounts.
ListDevices - List devices.
ListDeviceGroups - List device groups.
ListUsersOfDeviceGroup - List the users in a device group.
AddUser - Create a new user account.
RemoveUser - Delete a user account.
AddDeviceGroup - Create a new device group.
RemoveDeviceGroup - Delete a device group.
AddUserToDeviceGroup - Add a user to a device group.
RemoveUserFromDeviceGroup - Remove a user from a device group.
SendInviteEmail - Send an agent install invitation email.
Broadcast - Display a message to all online users.
Supported login arguments:
--url [wss://server] - Server url, wss://localhost:443 is default.
--loginuser [username] - Login username, admin is default.
--loginpass [password] - Login password.
--token [number] - 2nd factor authentication token.
--loginkey [hex] - Server login key in hex.
--loginkeyfile [file] - File containing server login key in hex.
--domain [domainid] - Domain id, default is empty.
```
--------------------------------
### Start MicroLMS without Console (Bash)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Starts MicroLMS in the background without launching the MeshCommander console on port 16994. This is useful when only the LMS functionality is needed, or when port 16994 is required for other services.
```bash
C:\MeshCmd>meshcmd microlms --noconsole
MicroLMS started.
```
--------------------------------
### Plugin System Configuration and Installation
Source: https://context7.com/ylianst/meshcentral/llms.txt
Extend MeshCentral's functionality by installing plugins. This involves enabling the plugin system in the configuration JSON and cloning plugin repositories into the designated `plugins` directory. Requires restarting MeshCentral for changes to take effect.
```json
{
"settings": {
"plugins": {
"enabled": true
}
}
}
```
--------------------------------
### Start MicroLMS and MeshCommander (Bash)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Launches MicroLMS, which includes an internal implementation of the Layered Management Service (LMS), and simultaneously starts MeshCommander on local port 16994. This is useful for configuring Intel AMT, especially on Linux.
```bash
C:\MeshCmd>meshcmd microlms
MicroLMS started, MeshCommander on HTTP/16994.
```
--------------------------------
### MeshCentral Startup Output
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
This output displays the expected messages when MeshCentral starts successfully. It indicates the ports MeshCentral is listening on, the status of the web certificate loading from NGINX, and the Intel(R) AMT server status.
```bash
MeshCentral HTTP redirection web server running on port 800.
Loaded RSA web certificate at https://127.0.0.1:443/, SHA384: d9de9e27a229b5355708a3672fb23237cc994a680b3570d242a91e36b4ae5bc96539e59746e2b71eef3dbdabbf2ae138.
MeshCentral Intel(R) AMT server running on myservername.domain.com:4433.
MeshCentral HTTP web server running on port 4430, alias port 443.
```
--------------------------------
### Install Plugin via Git Clone
Source: https://context7.com/ylianst/meshcentral/llms.txt
Install a MeshCentral plugin by cloning its Git repository into the `meshcentral-data/plugins` directory. This command-line process allows users to easily add custom functionality. Ensure the plugin repository URL is correct.
```bash
# Install plugin
cd meshcentral-data
mkdir plugins
cd plugins
git clone https://github.com/username/meshcentral-plugin-example.git
# Restart MeshCentral to load plugin
```
--------------------------------
### MeshCentral Docker Compose Configuration
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/container.md
A Docker Compose file defining a MeshCentral service. It specifies the image, environment variables, volume mounts for data persistence, and port mappings.
```yaml
services:
meshcentral:
image: ghcr.io/ylianst/meshcentral:latest
environment:
- DYNAMIC_CONFIG=false # Show the option but disable it by default, for safety.
volumes:
- meshcentral-data:/opt/meshcentral/meshcentral-data
- meshcentral-files:/opt/meshcentral/meshcentral-files
- meshcentral-web:/opt/meshcentral/meshcentral-web
- meshcentral-backups:/opt/meshcentral/meshcentral-backups
ports:
- "80:80"
- "443:443"
volumes:
meshcentral-data:
meshcentral-files:
meshcentral-web:
meshcentral-backups:
```
--------------------------------
### Run MeshCentral Docker Container
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/install/container.md
Command to run a MeshCentral container using the Docker CLI. It maps ports, mounts volumes for persistent data, and sets the container to restart automatically.
```sh
docker run -d \
--name meshcentral \
--restart unless-stopped \
-p 80:80 \
-p 443:443 \
-v data:/opt/meshcentral/meshcentral-data \
-v user_files:/opt/meshcentral/meshcentral-files \
-v backup:/opt/meshcentral/meshcentral-backups \
-v web:/opt/meshcentral/meshcentral-web \
ghcr.io/ylianst/meshcentral:latest
```
--------------------------------
### Connect MeshCentral to MongoDB
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
Configure MeshCentral to use a MongoDB database by specifying the MongoDB connection URL with the '--mongodb' flag when starting the server. This is essential for multi-server setups requiring a shared database. MongoDB will create the specified database if it doesn't exist.
```bash
node meshcentral --mongodb mongodb://127.0.0.1:27017/meshcentral
```
--------------------------------
### Get Intel AMT Web Storage State
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Retrieves the current state of the Intel AMT web storage. This command outputs information about the web application, including its size and realm details. Useful for checking if a custom index.htm is loaded.
```bash
C:\MeshCmd>meshcmd amtstoragestate --host 192.168.2.144 --pass xxxxxxxx
Storage State: {
"information": {
"version": 1,
"realms": 7765759,
"user": "admin"
},
"content": {
"index.htm": {
"size": 57246 Replacement index.htm with size.
}
}
}
```
--------------------------------
### MeshCentral Sample Configuration File (JSON)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcentral/index.md
This JSON configuration file outlines various settings for MeshCentral, including server settings, domain configurations, Let's Encrypt options, peer server details, and SMTP server parameters. It serves as a template for customizing MeshCentral's behavior.
```json
{
"settings": {
"MongoDb": "mongodb://127.0.0.1:27017/meshcentral",
"MongoDbCol": "meshcentral",
"Port": 4430,
"AliasPort": 443,
"RedirPort": 800,
"TlsOffload": "127.0.0.1",
"MpsPort": 44330,
"MpsAliasPort": 4433,
"MpsTlsOffload": true,
"SessionTime": 30,
"SessionKey": "MyReallySecretPassword",
"AllowLoginToken": true,
"AllowFraming": true,
"WebRTC": true,
"ClickOnce": true
},
"domains": {
"": {
"Title": "MyServer",
"Title2": "Servername",
"TitlePicture": "title-sample.png",
"UserQuota": 1048576,
"MeshQuota": 248576,
"NewAccounts": true,
"Footer": "Twitter",
"PasswordRequirements": { "min": 8, "max": 128, "upper": 1, "lower": 1, "numeric": 1, "nonalpha": 1 }
},
"customer1": {
"Dns": "customer1.myserver.com",
"Title": "Customer1",
"Title2": "TestServer",
"NewAccounts": 1,
"Auth": "sspi",
"Footer": "Test"
},
"info": {
"share": "C:\\ExtraWebSite"
}
},
"letsencrypt": {
"email": "myemail@myserver.com ",
"names": "myserver.com,customer1.myserver.com",
"rsaKeySize": 3072,
"production": false
},
"peers": {
"serverId": "server1",
"servers": {
"server1": { "url": "wss://192.168.2.133:443/" },
"server2": { "url": "wss://192.168.1.106:443/" }
}
},
"smtp": {
"host": "smtp.myserver.com",
"port": 25,
"from": "myemail@myserver.com",
"tls": false
}
}
```
--------------------------------
### Configure Intel AMT Activation Certificate (PEM)
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/intelamt/index.md
This JSON configuration demonstrates how to configure Intel AMT activation using certificate files in PEM format (.crt and .key). The 'certfiles' array lists all certificate files in the chain, with the leaf certificate first, and 'keyfile' specifies the private key file. These files should reside in the 'meshcentral-data' folder and are part of the 'AmtAcmActivation' settings in MeshCentral's config.json.
```json
{
"settings": {
"Cert": "devbox.mesh.meshcentral.com"
},
"domains": {
"": {
"title": "My Server",
"AmtAcmActivation": {
"log": "amtactivation.log",
"certs": {
"myvprocert": {
"certfiles": [
"amtacm-vprodemo.crt",
"amtacm-intermediate1.crt",
"amtacm-intermediate2.crt",
"amtacm-root.crt"
],
"keyfile": "amtacm-vprodemo.key"
}
}
}
}
}
}
```
--------------------------------
### Convert ADFS Certificate to PEM Format using OpenSSL
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/other/adfs_sso_guide.md
This command converts an ADFS token signing certificate from CRT format to PEM format, which is required for MeshCentral's SSO configuration. Ensure you have OpenSSL installed and the certificate file (`mycert.crt`) is accessible.
```bash
openssl x509 -in mycert.crt -out mycert.pem -outform PEM
```
--------------------------------
### Get System and Intel AMT Info with MeshCmd
Source: https://github.com/ylianst/meshcentral/blob/master/docs/docs/meshcmd/index.md
Retrieves detailed system and Intel AMT information using the 'smbios' command. The output is in JSON format and provides details about the processor, memory, system, and AMT capabilities. Requires MeshCmd to be run with appropriate privileges.
```shell
C:\MeshCmd>meshcmd smbios
{
processorInfo: {
0: {
Processor: "CPU"
MaxSpeed: "3800 Mhz"
Cores: 4
Threads: 8
Populated: 1
Status: "Enabled"
Socket: "CPU 1"
Manufacturer: "Intel(R) Corporation"
Version: "Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz"
}
}
memoryInfo: {
location: "System Board"
maxCapacityKb: 33554432
}
systemInfo: {
uuid: "C57B83D9A94E11E18BA1505054503030"
wakeReason: "Power Switch"
}
systemSlots: {
uuid: "C57B83D9A94E11E18BA1505054503030"
wakeReason: "Power Switch"
}
amtInfo: {
AMT: true
enabled: true
storageRedirection: true
serialOverLan: true
kvm: true
TXT: false
VMX: true
MEBX: "66.0.0.8"
ManagementEngine: "8.1.0.57353"
}
}
```
--------------------------------
### MeshCtrl CLI: Server and Device Management Commands (Bash)
Source: https://context7.com/ylianst/meshcentral/llms.txt
Utilize the MeshCtrl command-line tool for authenticating with the server, listing users and devices, managing user accounts and device groups, running commands on devices, and performing power actions. Includes examples for file transfers and generating agent links.
```bash
# Authenticate and get server info
meshctrl serverinfo --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword
# List all users
meshctrl listusers --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword
# List all devices
meshctrl listdevices --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword
# Add new user
meshctrl adduser --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--user newuser --pass UserPassword123 --email newuser@example.com
# Edit user permissions
meshctrl edituser --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--userid "user//domain/newuser" --siteadmin
# Create device group
meshctrl adddevicegroup --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--name "Production Servers" --desc "All production infrastructure"
# Add user to device group
meshctrl addusertodevicegroup --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--id "mesh//xxxxxxxxxxxxx" --userid "user//domain/techuser" --fullrights
# Run remote command on device
meshctrl runcommand --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--id "node//xxxxxxxxxxxxxxx" --run "systeminfo"
# Download file from device
meshctrl download --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--id "node//xxxxxxxxxxxxxxx" --remote "C:\\logs\\app.log" --local "./downloaded-app.log"
# Upload file to device
meshctrl upload --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--id "node//xxxxxxxxxxxxxxx" --local "./script.ps1" --remote "C:\\temp\\script.ps1"
# Power actions (wake/sleep/reset/shutdown)
meshctrl devicepower --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--id "node//xxxxxxxxxxxxxxx" --action reset
# Generate agent invitation link
meshctrl generateinvitelink --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--id "mesh//xxxxxxxxxxxxx" --hours 48
# Create login token for API access
meshctrl logintokens --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--createtoken --duration 365
# List server events
meshctrl listevents --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword \
--limit 100
# Real-time event monitoring
meshctrl showevents --url wss://mesh.example.com --loginuser admin --loginpass SecurePassword
```