MeshCentral: 2FA fails in LDAP

Whenever we enable TOTP for a user, login is no longer possible. Using Mail or Auth-App or Securitykey does not make a difference.

System asks for 2nd FA and just fails back to login. Debug-Mode shows AUTHLOG: Failed password for undefined from IP-ADRESS port 12839, Browser: Chrome/124.0.0.0, OS: Mac OS/10.15.7

To Reproduce Steps to reproduce the behavior:

  1. Use LDAP (Active Directory for example)
  2. Enable any 2FA
  3. Tray login

Expected behavior User should be able to login.

Server Software (please complete the following information):

  • OS: Debian
  • Virtualization: LXC
  • Network: LAN/WAN behind NGINX-Reverse-Proxy on opnsense
  • Version: 1.1.22
  • Node: 20.11.0

Client Device (please complete the following information):

  • Device: Macbook
  • OS: MacOS Sonoma 14.4.1
  • Network: any
  • Browser: Brave

Your config.json file

{
  "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json",
  "__comment1__": "This is a simple configuration file, all values and sections that start with underscore (_) are ignored. Edit a section and remove the _ in front of the name. Refer to the user's guide for details.",
  "__comment2__": "See node_modules/meshcentral/sample-config-advanced.json for a more advanced example.",
  "settings": {
    "cert": "mesh.it-ngo.com",
    "ignoreAgentHashCheck" : true,
    "_WANonly": true,
    "_LANonly": true,
    "sessionKey": "ASessionKey&Co.KG",
    "port": 443,
    "aliasPort": 443,
    "redirPort": 80,
    "redirAliasPort": 80,
    "relayPort": 453,
    "agentsInRam": true,
    "trustedproxy": ["10.255.14.1"],
    "_tlsOffload": "10.255.14.1",
    "desktopMultiplex": false,
    "authlog": "/etc/meshcentral/auth.log",
    "plugins": true,
    "WebRTC": false,
    "Compression": true,
    "WsCompression": true,
    "AgentWsCompression": true,
    "AllowLoginToken": true,
    "_AllowFraming": true,
    "CookieIpCheck": false,
    "CookieEncoding": "hex",
    "_noAgentUpdate": "1",
    "autoBackup": {
      "mysqlDumpPath": "/etc/bin"
                  },
    "webrtcConfig": {
      "iceServers": [
        { "urls": "stun:stun.services.mozilla.com" },
        { "urls": "stun:stun.l.google.com:19302" }
      ]
    },
     "mySQL": {
            "host": "10.255.14.101",
            "port": "3306",
            "user": "meshcentral",
            "password": "aPassword",
            "database": "meshcentral"
		}
	     },
    "domains": {
    "": {
      "titlehtml": "",
      "title": "ATITLEG - Remotesupport",
      "title2": " - RemoteSupportTool - V 0.01a",
      "titlepicture": "title-mycompany.png",
      "welcomeText": "Willkommen zum Fernwartungs und Webmeetingportal.",
      "welcomePicture": "welcome.png",
      "LoginPicture": "welcome.png",
      "GeoLocation": false,
      "CookieIpCheck": false,
      "x-frame-options": "allow-from *",
      "agentConfig": [ "skipmaccheck=1" ],
      "agentCustomization": {
         "displayName": "itNGO - QuickSupport Agent",
         "description": "itNGO - QuickSupport Agent background service",
         "companyName": "itNGO GmbH & Co. KG",
         "serviceName": "itNGO - Agent",
	 "foregroundColor": "#FFFEFE",
         "backgroundColor": "#464646",
         "image": "welcome.png",
         "remoteMouseRender": true,
         "fileName": "itNGO-Agent"
      },
      "userConsentFlags": {
        "desktopnotify": true,
        "terminalnotify": true,
        "desktopprompt": false,
        "terminalprompt": false,
        "desktopprivacybar": true
      },
      "desktopPrivacyBarText": "{1} - ist mit Ihrem System verbunden!",
      "minify": true,
      "_newAccounts": true,
      "_userNameIsEmail": true,
      "AllowHighQualityDesktop": true,
      "CertURL": "https://anjURL:443",
      "ManageAllDeviceGroups": [ "User1","User2" ],
      "agentInviteCodes": true,
      "passwordRequirements": {
        "msg2factor": true
      },
      "AgentSelfGuestSharing": true,
      "mstsc": true,
      "ssh": true,
      "auth": "ldap",
      "ldapUserName": "sAMAccountName",
      "_ldapUserBinaryKey": "objectSid",
      "ldapUserKey": "sAMAccountName",
      "ldapOptions": {
        "url": [ "ldaps://aserver1:636", "ldaps://anotherserver2:636" ],
        "bindDN": "############",
        "bindCredentials": "###########-:",
        "searchBase": "DC=someSeearchBase",
        "searchFilter": "(&(sAMAccountName={{username}})(objectClass=organizationalPerson))",
        "tlsOptions": { "rejectUnauthorized": false },
        "reconnect":true
      },
      "_altmessenging": {
          "_name": "Ticket",
          "_url": "https://helpdesk.it-ngo.com/index.php?section=bug&sub=edit&init=1&backTo=main"
      },
    "customui": {

                "desktopButtons": {
                 "exec5": {
                  "name": "Leistung erfassen",
                  "action": "dialog:dialog1"
                          }
                                  },
                "terminalButtons": {
                 "exec6": {
                  "name": "Leistung erfassen",
                   "action": "dialog:dialog1"
                          }
                                  },
          "dialogs": {
           "dialog1": {
             "logmsg": "Leistungsdialog Eingabe",
             "title": "Schnellerfassung Leistung",
             "text": "Bitte getane Arbeiten dokumentieren...",
             "buttons": 1,
             "elements": {
               "test1": {
                 "name": "Titel",
                 "type": "text"
                          }
                                }
                           }
                         }
                       }

    }
  },
  "_letsencrypt": {
    "__comment__": "Requires NodeJS 8.x or better, Go to https://letsdebug.net/ first before trying Let's Encrypt.",
    "email": "anadress",
    "names": "aDNS-Name",
    "production": false
  },
  "smtp": {
           "host": "ansmtpserver",
           "port": 587,
           "from": "adress",
           "user": "anotheradress",
           "pass": "############-:",
           "tls": false
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@JSuenram dont worry about opening a new issue, just pushed the fix for you! https://github.com/Ylianst/MeshCentral/commit/323ef2d50a17b16965dc89bbb65f9394551bb2b4 basically it was encoding the sessions with either hex or base64, but if u specified hex, it was then decoding with base64 only, doh!

@JSuenram nope, tried with user//fred.smith and the 2fa still works! one thing u can try is removing "CookieEncoding": "hex", the default is base64 restart meshcentral, clear users 2fa, clear all your cookies from ur browser, login, setup 2fa, logout, try logging in?

edit: also run meshcentral with web debug and watch what it does when adding the 2fa and then logging in etc node node_modules/meshcentral --debug web

@JSuenram the double slash is OK, it’s just the separator. user/domain/username So in my case I created another domain in config.json called ldaptest for the ldap testing. But I will try setting the default blank domain to ldap and see if it makes any difference

side note: http://info.meshcentral.com/downloads/meshcentral-config-schema.json doesnt exist you should change it to https://raw.githubusercontent.com/Ylianst/MeshCentral/master/meshcentral-config-schema.json

also x-frame-options isnt a valid option, it should be set under httpHeaders

"httpHeaders": {
  "x-frame-options": "SAMEORIGIN"
 }

@JSuenram oh sorry! im having one of those days! why would AD do 2FA, when MC does the 2FA 🤦 ill get my test environment setup again with ldap and give it a try and find out whats up!