hexparrot / mineos-node

node.js implementation of mineos minecraft management
GNU General Public License v3.0
334 stars 170 forks source link

MineOS UI requires a group with same name as user #272

Closed lekro closed 4 years ago

lekro commented 6 years ago

Situation: I am running Ubuntu Server 16.04 and installed MineOS node via the instructions on the wiki. I have updated to a recent git commit following the instructions, but the issue persists.

I have multiple users, including myself, all with primary group minecraft with gid=1001. My uid is 1000. The WebUI appears as follows. The username in the top corner is not shown, and no servers are visible, even ones of which I am the owner.

image

The following error appears in /var/log/mineos.log.

{
    "date": "Sat Mar 31 2018 03:04:51 GMT-0400 (EDT)",
    "process": {
        "pid": 20366,
        "uid": 0,
        "gid": 0,
        "cwd": "/",
        "execPath": "/usr/bin/node",
        "version": "v4.8.7",
        "argv": ["/usr/bin/node", "/usr/games/minecraft/webui.js", "start"],
        "memoryUsage": {
            "rss": 206192640,
            "heapTotal": 69079552,
            "heapUsed": 37439568,
            "external": 801363
        }
    },
    "os": {
        "loadavg": [0.4130859375, 0.49267578125, 0.5703125],
        "uptime": 1152953
    },
    "trace": [{
        "column": null,
        "file": null,
        "function": "Error",
        "line": null,
        "method": null,
        "native": true
    }, {
        "column": 18,
        "file": "/usr/games/minecraft/node_modules/userid/lib/userid.js",
        "function": "Object.exports.gid",
        "line": 43,
        "method": "gid",
        "native": false
    }, {
        "column": 19,
        "file": "/usr/games/minecraft/server.js",
        "function": null,
        "line": 313,
        "method": null,
        "native": false
    }, {
        "column": 13,
        "file": "events.js",
        "function": "emitOne",
        "line": 77,
        "method": null,
        "native": false
    }, {
        "column": 7,
        "file": "events.js",
        "function": "Namespace.emit",
        "line": 169,
        "method": "emit",
        "native": false
    }, {
        "column": 10,
        "file": "/usr/games/minecraft/node_modules/socket.io/lib/namespace.js",
        "function": "Namespace.emit",
        "line": 206,
        "method": "emit",
        "native": false
    }, {
        "column": 14,
        "file": "/usr/games/minecraft/node_modules/socket.io/lib/namespace.js",
        "function": null,
        "line": 174,
        "method": null,
        "native": false
    }, {
        "column": 9,
        "file": "node.js",
        "function": "nextTickCallbackWith0Args",
        "line": 489,
        "method": null,
        "native": false
    }, {
        "column": 13,
        "file": "node.js",
        "function": "process._tickCallback",
        "line": 418,
        "method": "_tickCallback",
        "native": false
    }],
    "stack": ["Error: groupname not found", "    at Error (native)", "    at Object.exports.gid (/usr/games/minecraft/node_modules/userid/lib/userid.js:43:18)", "    at Namespace.<anonymous> (/usr/games/minecraft/server.js:313:19)", "    at emitOne (events.js:77:13)", "    at Namespace.emit (events.js:169:7)", "    at Namespace.emit (/usr/games/minecraft/node_modules/socket.io/lib/namespace.js:206:10)", "    at /usr/games/minecraft/node_modules/socket.io/lib/namespace.js:174:14", "    at nextTickCallbackWith0Args (node.js:489:9)", "    at process._tickCallback (node.js:418:13)"],
    "level": "error",
    "message": "uncaughtException: groupname not found",
    "timestamp": "2018-03-31T07:04:51.906Z"
}

I create a new (dummy) group with a (bogus) GID 9999, and don't add myself to it:

sudo groupadd lekro -g 9999

Now the WebUI loads fine and will show all servers I have made.

Adding a group with GID 1000 but different name causes the same issue:

sudo groupadd testing -g 1000

Is this intended behavior? Are all users required to have a group with their username?

EDITS: run json through formatter

hexparrot commented 6 years ago

Correct, all users are required to have a group matching their username.

Currently, I'd classify this as a bug, because the only real issue is I don't know how to get nodejs/npm modules to report back to me what a user's primary group is (id -gn).

charlyhue commented 5 years ago

This issue is fixed in pull request #293

Primary user group can be fetched with userid.gids(username)[0] instead of userid.gid(username)

cross commented 4 years ago

I am facing the same issue where I can't log in because my user doesn't have a matching group. I see that the PR is blocked. Can someone address this, please? Or, take the fix for groupname out of the LDAP related portions?

hexparrot commented 4 years ago

I've added the non-ldap portions of the code, which does indeed fix the issue of not having a matching group.

Creating a user "madeup" with group memberships including only "users" worked; successfully created a server.