Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.14k stars 556 forks source link

activate the meshcentral config for azure crash #5486

Open laboiteajb opened 11 months ago

laboiteajb commented 11 months ago

Hello I can't configure Azure on my meshcentral

when I activate the meshcentral config crash

THANKS

conf:

{
    "settings": {
        "cert": "remote.xxxxxx.fr",
        "port": 443,
        "redirPort": 80,
        "allowLoginToken": true,
        "nice404": true,
        "selfUpdate": false,
        "webPageLengthRandomization": false,
        "meshErrorLogPath": "c:\\log",
        "authLog": "c:\\log\\auth.log",
        "log": "main,web,webrequest,cert",
        "watchDog": {
            "interval": 100,
            "timeout": 400
        },
        "dbExpire": {
            "events": 1209600,
            "powerevents": 864000,
            "statsevents": 604800
        },
        "plugins": {
            "enabled": true
        }
    },
    "domaindefaults": {
        "__comment__": "Any settings in this section is used as default setting for all domains",
        "siteStyle": 1,
        "title": "Remote XXXX",
        "footer": "Default page footer",
        "auth": "ldap",
        "ldapUserName": "sAMAccountName",
        "ldapUserBinaryKey": "sAMAccountName",
        "ldapOptions": {
            "url": "ldap://XXXX0.1:389",
            "bindDN": "CN=s_meshc,OU=Comptes_de_Services,OU=Users,OU=XXXX,DC=XXXX,DC=dom",
            "bindCredentials": "xxxxxxxxx",
            "searchBase": "OU=Users,OU=XXXX,DC=XXXX,DC=dom",
            "searchFilter": "(sAMAccountName={{username}})"
        },
        "_authStrategies": {
            "azure": {
                "newAccounts": true,
                "_callbackurl": "https://XXXX.fr/auth-azure-callback",
                "clientid": "xxxxx",
                "clientsecret": "xxxxx",
                "tenantid": "xxxxxx"
            }
        },
        "deviceMeshRouterLinks": {
            "rdp": true,
            "ssh": false,
            "scp": false
        },
        "myServer": {
            "Backup": true,
            "Restore": true,
            "Upgrade": true,
            "ErrorLog": true,
            "Console": true,
            "Trace": true
        },
        "agentCustomization": {
            "description": "Remote XXXX Agent background service. https://remote.XXXX.fr",
            "displayName": "Remote XXXX Agent",
            "companyName": "XXXX Radiocommunications",
            "serviceName": "Remote XXXX Agent"
        },
        "twoFactorCookieDurationDays": 1,
        "maxGuestSessionSharingTime": 5760,
        "_sessionRecording": {
            "_onlySelectedDeviceGroups": true,
            "_filepath": "E:\recordings",
            "_index": true,
            "_maxRecordings": 10,
            "_maxRecordingSizeMegabytes": 30000,
            "__protocols__": "Is an array: 1 = Terminal, 2 = Desktop, 5 = Files, 100 = Intel AMT WSMAN, 101 = Intel AMT Redirection",
            "_protocols": [
                1,
                2,
                5,
                100,
                101
            ]
        },
        "welcomeText": ".",
        "welcomePicture": "XXXX.jpg",
        "newAccounts": true
    },
    "letsencrypt": {
        "__comment__": "Requires NodeJS 8.x or better, Go to https://letsdebug.net/ first before trying Let's Encrypt.",
        "email": "xxxxx@XXXX.fr",
        "names": "remote.XXXX.fr",
        "nochecks": true,
        "production": true
    },
    "_peers": {
        "serverId": "server1",
        "servers": {
            "server1": {
                "url": "wss://192.168.2.133:443/"
            },
            "server2": {
                "url": "wss://192.168.1.106:443/"
            }
        }
    },
    "smtp": {
        "host": "mail.XXXX.fr",
        "port": 25,
        "from": "meshcentral@XXXX.fr",
        "__tls__": "When 'tls' is set to true, TLS is used immidiatly when connecting. For SMTP servers that use TLSSTART, set this to 'false' and TLS will still be used.",
        "tls": false,
        "___tlscertcheck__": "When set to false, the TLS certificate of the SMTP server is not checked.",
        "tlscertcheck": false,
        "__tlsstrict__": "When set to true, TLS cypher setup is more limited, SSLv2 and SSLv3 are not allowed.",
        "tlsstrict": false,
        "verifyEmail": false
    }
}

error log:

-------- 31/10/2023 11:39:11 ---- 1.1.14 --------

node:internal/modules/cjs/loader:1048
  const err = new Error(message);
              ^

Error: Cannot find module 'passport'
Require stack:
- C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral\webserver.js
- C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral\meshcentral.js
- C:\Program Files\Open Source\MeshCentral\winservice\winservice.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at setupDomainAuthStrategy (C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral\webserver.js:7036:44)
    at serverStart (C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral\webserver.js:6358:43)
    at C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral\webserver.js:307:17
    at C:\Program Files\Open Source\MeshCentral\node_modules\meshcentral\db.js:2497:107
    at newArguments.<computed> (C:\Program Files\Open Source\MeshCentral\node_modules\@yetzt\nedb\lib\executor.js:29:17)
    at Cursor.execFn (C:\Program Files\Open Source\MeshCentral\node_modules\@yetzt\nedb\lib\datastore.js:485:12)
    at callback (C:\Program Files\Open Source\MeshCentral\node_modules\@yetzt\nedb\lib\cursor.js:126:19)
    at C:\Program Files\Open Source\MeshCentral\node_modules\@yetzt\nedb\lib\cursor.js:193:12
    at C:\Program Files\Open Source\MeshCentral\node_modules\@yetzt\nedb\lib\datastore.js:330:14
    at wrapper (C:\Program Files\Open Source\MeshCentral\node_modules\async\dist\async.js:271:20)
    at replenish (C:\Program Files\Open Source\MeshCentral\node_modules\async\dist\async.js:441:29)
    at C:\Program Files\Open Source\MeshCentral\node_modules\async\dist\async.js:451:13 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Program Files\\Open Source\\MeshCentral\\node_modules\\meshcentral\\webserver.js',
    'C:\\Program Files\\Open Source\\MeshCentral\\node_modules\\meshcentral\\meshcentral.js',
    'C:\\Program Files\\Open Source\\MeshCentral\\winservice\\winservice.js'
  ]
}

Node.js v20.8.1

si458 commented 11 months ago

you have put azure under authStrategies but you havent enabled authStrategies as its is commented out with _ so will be ignored

remove the underscore from authStrategies then restart meshcentral and it should install passport for you

https://ylianst.github.io/MeshCentral/meshcentral/faq/#json-config-files

also please follow the bug report template in the future! and dont edit it! your config and errors where very hard to follow/read!

laboiteajb commented 11 months ago

when I remove the "_" that's when meshcentral crashes

ok I will be careful for the next request

si458 commented 11 months ago

also all of your domaindefaults entried should be underdomains then a blank object "" and not domaindefaults unless you plan to have multiple domain (multi-tenant)

have a look at the example https://github.com/Ylianst/MeshCentral/blob/master/sample-config.json and advanced example https://github.com/Ylianst/MeshCentral/blob/master/sample-config-advanced.json