diff --git a/.vscode/settings.json b/.vscode/settings.json index 681a496a..afabea27 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,45 +13,99 @@ "addusertodevice", "addusertodevicegroup", "addusertousergroup", + "adminaccount", + "adminname", "agentallowedip", + "agentblockedip", "agentconfig", "agentconsole", + "agentcustomization", "agentdownload", "agenterrorlogs", + "agentidletimeout", + "agentkey", "agentnoproxy", + "agenttype", + "agentupdateblocksize", + "agentupdatetest", + "agentwscompression", + "aliasport", + "allevents", "allowaccountreset", + "alreadyinstalled", "amtacmactivation", + "amtmanager", "amtoff", "amton", "amtonly", "amtreset", + "amtscanner", "apikey", + "appmetrics", "ashx", + "atag", "authcookie", "authenticode", + "authlog", + "authlogfile", "Authn", "autofido", "awsrds", "backgroundonly", "backupcode", + "backuppath", "callbackurl", "ccmp", "certfiles", "certpfx", "certpfxpass", "certurl", + "cfile", + "changedevice", + "changenode", "chatnotify", "CIRA", + "ciralocalfqdn", "ckey", + "clearpower", "clientid", "clientsecret", + "cmds", + "companyname", + "configfile", + "configfiles", + "configkey", + "connectionstring", + "cookieipcheck", + "cookiesamesite", "coolofftime", "coredumps", + "createaccount", "createmesh", "createusergroup", "crowdsec", + "crypted", "cscli", + "cuser", + "datapath", + "datastr", + "dbconfig", + "dbencryptkey", + "dbexport", + "dbexportmin", + "dbimport", + "dblistconfigfiles", + "dbmerge", + "dbpullconfigfiles", + "dbpulldatafiles", + "dbpushconfigfiles", + "dbshowconfigfile", + "defaultuserwebstate", + "deletedefaultdomain", + "deletedomain", "deletemesh", + "deleteuser", + "deleteusergroup", "desktopnotify", "desktopprivacybar", "desktopprompt", @@ -65,37 +119,72 @@ "devicesharing", "devicetoast", "devid", + "displayname", + "dnssuffix", "domaindefaults", "domainid", "dont", + "dumpcores", "editdevice", "editdevicegroup", "editgroup", "editmesh", "edituser", + "emailexists", "emailverified", "entityid", + "errlogpath", + "esversion", + "etype", + "eventlogger", + "exactport", + "exactports", + "extractall", "extralinks", + "fastcert", + "fileaccess", "filenotify", "fileprompt", + "filespath", + "filteredusers", + "filterid", + "firebaserelay", + "forceduserwebstate", "fullrights", "fullscreen", + "gatewaymac", "generateinvitelink", + "getnetworkinfo", "getsysinfo", + "getwspass", "groupid", "guestname", + "hashpass", + "hashpasssplit", + "hashpassword", "Hilaire", "httpheaders", + "idexists", + "idhex", "idpurl", "iframe", + "ignoreagenthashcheck", + "indexagenterrorlog", + "indexmcrec", + "installtext", + "intelamt", "interactiveonly", "interuser", "invitecodes", "ipkvm", + "iplayer", + "ipranges", "Jitsi", "jumpcloud", "keyfile", + "lanonly", "LAPI", + "lastaddr", "lastconnect", "ldapauth", "ldapoptions", @@ -103,104 +192,222 @@ "ldapuseremail", "ldapusername", "ldapusers", + "leok", + "letsencrypt", "limiteddesktop", "limitedevents", + "Linaro", "listdevicegroups", "listdevices", "listdomains", "listevents", "listusergroups", + "listuserids", "listusers", "listusersessions", "listusersofdevicegroup", + "loadconfigfromdb", + "localfile", + "localpath", "localurl", "lockagentdownload", + "locksettings", "logindomain", "loginfooter", "loginkey", + "loginkeyfile", "loginpass", + "logintoken", + "logintokengen", + "logintokenkey", "logintokens", "loginuser", "logouturl", + "mailserver", + "mailtokengen", + "maintenancemode", "managedevices", "manageusers", "maxfidokeys", + "maxlen", + "mcpath", "mcrdesktop", + "mcrec", "mcrfiles", "Mebx", "meshadmin", "meshagent", + "meshagents", + "meshauth", "meshcentral", + "meshcmd", "meshcore", "meshctrl", + "mesherrors", "meshid", + "meshidname", + "meshmail", "meshname", "meshquota", + "meshrelay", "meshrights", + "meshscanner", "meshtype", "Messagebox", "Messenging", + "minfo", + "minifyall", + "minifycore", + "mongodbcol", + "moutput", "movetodevicegroup", + "mpsaliasport", + "mpscert", + "mpsdebug", + "mpsport", + "mpsserver", + "mqttbroker", "MSCHA", "mstsc", + "multiresponse", + "myaccountname", + "mypassword", + "nameexists", + "nedbtodb", + "netif", "newaccountemaildomains", + "newaccountname", "newaccounts", "newaccountspass", "newaccountsrights", "newgroupname", + "newobj", + "newpassword", + "noagentupdate", "noamt", + "noauth", + "noav", + "nodeconnect", + "nodecount", "nodeid", "nodeids", "nodeinfo", + "nodepath", + "nodewindows", "nofiles", + "nofirewall", "nonalpha", + "nonewgroups", "noterminal", + "notools", + "nousers", "novnc", + "npmpath", "npmproxy", + "npmtag", + "ODELAY", "offloader", "oidc", "openurl", "orphanagentuser", + "osdesc", + "osinfo", + "otphkeys", + "otpkeys", + "otpsecret", + "parentpath", "passwordrequirements", "PKCK", "plivo", + "plusplus", "poweraction", "powerevents", + "publicid", "randompass", + "rauth", + "rawdata", + "rcookie", "realname", + "recordpath", "redir", + "rediraliasport", "redirections", + "redirport", + "redirserver", + "relaydns", + "relayport", "remotecontrol", "remotefile", + "remotepath", + "removeallusersfromusergroup", "removedevicegroup", "removedomain", "removefromdomain", "removefromusergroup", "removemeshuser", + "removesubdomain", + "removetestagents", "removeuser", "removeuserfromdevice", "removeuserfromdevicegroup", + "removeuserfromusergroup", "removeusergroup", + "resetaccount", "resetpass", "responseid", + "rightsstr", + "rname", + "rnamel", "runasuser", "runasuseronly", "runcommand", "runcommands", + "runmode", + "runonservererror", + "runonserverupdated", + "selfupdate", + "senderid", "sendgrid", "sendinviteemail", "serverfiles", + "serverid", "serverinfo", + "serverkey", + "serverupdate", + "servicename", + "servicepath", + "sessionkey", "sessionrecording", + "sessiontime", "settodomain", + "shareid", + "showall", + "showallmeshes", "showevents", + "showiplocations", + "showitem", + "showmeshes", + "shownodes", + "showpower", + "showsmbios", + "showusergroups", + "showusers", "siteadmin", "sitestyle", + "smsserver", + "specificupdate", + "splitip", "srights", "ssid", "sspi", + "startack", "statsevents", "Strs", + "subdir", + "swarmallowedip", + "swarmport", + "swarmserver", + "sysinfo", "syslogauth", "syslogjson", "syslogtcp", @@ -208,30 +415,74 @@ "tenantid", "terminalnotify", "terminalprompt", + "termsize", "titlepicture", "tkip", "tlscertcheck", + "tlsoffload", + "tlsrootcert", "tlsstrict", + "tokenrequired", + "translateall", + "translationpath", "trustedcert", + "trustedproxy", "TTLS", + "tunnelws", + "tunnelwsstate", "tzoffset", + "ugroup", + "ugroups", "ugrp", "ugrpid", + "uicustomevent", + "unadmin", + "unsealkey", + "uploadack", + "uploaderror", + "uploadstart", "useid", "userallowedip", + "userblockedip", "userbroadcast", "userconsentflags", + "usercount", "usergroups", "userid", "userids", + "usernameisemail", "userquota", + "Usersessionidletimeout", + "vaultpullconfigfiles", + "vaultpushconfigfiles", "verifyemail", "viewonly", "wakedevices", + "wanonly", + "webemailspath", + "webpublicpath", + "webpush", + "webrelayserver", "webrtc", + "webrtconfig", + "webviewspath", "welcomepicture", "welcometext", + "winservice", "wscompression", + "wssessioncount", + "wssessions", + "xdomains", + "xenv", + "xinstall", + "xjslint", + "xmeshes", + "xpad", + "xrestart", + "xuninstall", + "xxprocess", + "xxurl", + "xxxprocess", "Ylian", "yubikey" ] diff --git a/docs/docs/meshcentral/debugging.md b/docs/docs/meshcentral/debugging.md index f26a9fe2..f06e0701 100644 --- a/docs/docs/meshcentral/debugging.md +++ b/docs/docs/meshcentral/debugging.md @@ -21,6 +21,12 @@ Make sure you understand how MeshCentral works with your browser using chrome de "AgentWsCompression": false, ``` +### Port Troubleshooting on server + +If you're getting a `port 4433 is not available` error, this is because someone else is using this port, very likely another instance of MeshCentral. If your MeshCentral server is bound to ports 81/444 MeshCentral could not get port 80/443 and got the next available ones. + +In general the problem is that you are running two MeshCentral instances at the same time. Probably one as a background Windows Service and one in the command line. Which ever instance can grab port 4433 will have a running MPS and CIRA should work, but the second instance will not have port 4433 and CIRA will not work. + ### Enabling trace in your browser Dev Tools `Trace=1` as a parameter in chrome dev tools for debugging @@ -215,6 +221,37 @@ Then open your browser to http://localhost:9999 or whatever port you used. !!!note If you pause the debugger, and happen to forget about it, the agent will automatically kill itself and restart because it will think that a thread is stuck. Default debugger timeout is 10 minutes, you may find a log entry saved to disk saying "Microstack Thread STUCK", or something similar. +### Troubleshooting Agent connectivity + +If an agent keeps disconnecting and reconnecting, add this line to the "settings" section of the config.json: + +``` +"agentping": 30 +``` + +This will cause MeshCentral to "ping" the agent every 30 seconds and the agent to respond with a "pong" each time. That usually solves the issue however, it does generate more traffic. If that works, you can remove the line and try this line instead: + +``` +"agentpong": 30 +``` + +This will cause MeshCentral to "pong" the agent every 30 seconds, the agent will not respond. This usually fixes the issue, but you have half the traffic. I would also increase the time like: + +``` +"agentpong": 90 +``` + +This is the best, you have one way traffic to all agents every 90 seconds. The larger the number you can get away with the better. + +If you ever get the same problem but on the browser side, you can also use one of these: + +``` +"browserping": 30 +"browserpong": 30 +``` + +Same idea, browser side instead of agent side. + ## Intel AMT To debug issues, confirm that Intel AMT is active and there MeshCentral is not showing any red errors on the "Intel AMT" line: diff --git a/meshcentral.js b/meshcentral.js index c88c9789..838df3da 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -201,7 +201,7 @@ function CreateMeshCentralServer(config, args) { // Check if translate.json is in the "meshcentral-data" folder, if so use that and translate default pages. var translationFile = null, customTranslation = false; - if (require('fs').existsSync(obj.path.join(obj.datapath, 'translate.json'))) { translationFile = obj.path.join(obj.datapath, 'translate.json'); console.log("Using translate.json in meshentral-data."); customTranslation = true; } + if (require('fs').existsSync(obj.path.join(obj.datapath, 'translate.json'))) { translationFile = obj.path.join(obj.datapath, 'translate.json'); console.log("Using translate.json in meshcentral-data."); customTranslation = true; } if (translationFile == null) { if (require('fs').existsSync(obj.path.join(__dirname, 'translate', 'translate.json'))) { translationFile = obj.path.join(__dirname, 'translate', 'translate.json'); console.log("Using default translate.json."); } } if (translationFile == null) { console.log("Unable to find translate.json."); process.exit(); return; } @@ -369,7 +369,7 @@ function CreateMeshCentralServer(config, args) { // Check if we need to install, start, stop, remove ourself as a background service if (((obj.args.xinstall == true) || (obj.args.xuninstall == true) || (obj.args.start == true) || (obj.args.stop == true) || (obj.args.restart == true))) { var env = [], xenv = ['user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'exactport', 'rediraliasport', 'debug']; - for (i in xenv) { if (obj.args[xenv[i]] != null) { env.push({ name: 'mesh' + xenv[i], value: obj.args[xenv[i]] }); } } // Set some args as service environement variables. + for (i in xenv) { if (obj.args[xenv[i]] != null) { env.push({ name: 'mesh' + xenv[i], value: obj.args[xenv[i]] }); } } // Set some args as service environment variables. var serviceFilePath = null; if (obj.fs.existsSync(obj.path.join(servicepath, 'winservice.js'))) { serviceFilePath = obj.path.join(servicepath, 'winservice.js'); } @@ -757,7 +757,7 @@ function CreateMeshCentralServer(config, args) { obj.syslogtcp.log("MeshCentral v" + getCurrentVersion() + " Server Start", obj.syslogtcp.LOG_INFO); } - // Check top level configuration for any unreconized values + // Check top level configuration for any unrecognized values if (config) { for (var i in config) { if ((typeof i == 'string') && (i.length > 0) && (i[0] != '_') && (['settings', 'domaindefaults', 'domains', 'configfiles', 'smtp', 'letsencrypt', 'peers', 'sms', 'sendgrid', 'sendmail', 'firebase', 'firebaserelay', '$schema'].indexOf(i) == -1)) { addServerWarning('Unrecognized configuration option \"' + i + '\".', 3, [ i ]); } } } // Read IP lists from files if applicable diff --git a/meshctrl.js b/meshctrl.js index 1f2fd35c..57b3c838 100644 --- a/meshctrl.js +++ b/meshctrl.js @@ -318,7 +318,7 @@ if (args['_'].length == 0) { console.log(" --id '[groupid]' - Device group identifier (or --group)."); } console.log(" --group [groupname] - Device group name (or --id)."); - console.log(" --hours [hours] - Validity period in hours or 0 for infinit."); + console.log(" --hours [hours] - Validity period in hours or 0 for infinite."); console.log("\r\nOptional arguments:\r\n"); console.log(" --flags [mode] - Mode flag for link type (0 = both, 1 = interactive only, 2 = background only)"); break;