Typhonragewind / meshcentral-docker

163 stars 46 forks source link

Container doesn't build config.json correctly ("latest" tag) #33

Open natechoiniere opened 1 year ago

natechoiniere commented 1 year ago

So I ran into this issue (bug?) earlier and fixed it. I was just able to recreate it. Went straight to this page https://hub.docker.com/r/typhonragewind/meshcentral and copied/pasted the "docker-compose.yml example" and spun it up after changing the hostname to be my IP address. Looks like it is using the "latest" tag. It gives me the error "ERROR: Unable to parse /opt/meshcentral/meshcentral-data/config.json." The culprit is a mangled sessionKey in config.json:

{
  "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json",
  "settings": {
    "cert": "2x.xx.xx.x8",
    "_WANonly": true,
    "_LANonly": true,
    "sessionKey": "%-$GEdm[(@IzzGg}MV"_sessionKey": "MyReallySecretPassword1"7-sqi7bz-@CZ3",
    "port": 443,
    "_aliasPort": 443,
    "redirPort": 80,
    "_redirAliasPort": 80,
    "AgentPong": 300,
    "TLSOffload": false,
    "SelfUpdate": false,
    "AllowFraming": "false",
    "WebRTC": "false",
    "AutoBackup": {
      "backupPath": "/opt/meshcentral/meshcentral-backups",
      "backupInvervalHours": "24",
      "keepLastDaysBackup": "10",
      "zippassword": "MyAwesomePasswordPleaseChangeMe"
    }
  },
  "domains": {
        "": {
        "_title": "MyServer",
    "_title2": "Servername",
    "_minify": true,
    "NewAccounts": "true",
        "_userNameIsEmail": true,
    "_certUrl": "my.reverse.proxy"
        }
  },
  "_letsencrypt": {
    "__comment__": "Requires NodeJS 8.x or better, Go to https://letsdebug.net/ first before>",
    "_email": "myemail@mydomain.com",
    "_names": "myserver.mydomain.com",
        "production": false
  }
}

For some reason the container doesn't correctly set the sessionKey. Looks like it's trying to set both a commented out & an uncommented sessionKey, and forgetting a comma between them. The fix is to simply make the sessionKey of format "sessionKey":"sessionKeyHere";

grahamIT commented 7 months ago

Thanks

Typhonragewind commented 7 months ago

Uhh, weird. Thanks for letting me know, I'll fix this as soon as i can

svenwanzenried commented 7 months ago

It also seems to copy and add some lines to the end of the file, when I fix the above mistake and recreate the container. Which again makes the JSON broken. The end of my file looks like this: image

Typhonragewind commented 7 months ago

Something changed on the master config file from meshcentral and now my SED lines are broken. Thanks for all the troubleshooting! Things should get calmer for me in a few days and i'll be able to take a look at this properly

Typhonragewind commented 7 months ago

I had a look at the startup script and it seems to be all in order. I did remove one source for a potential bug i didn't think off and that may solve this issue