pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.68k stars 1.69k forks source link

Wings API installation script giving back permission denied for almost every script #5170

Closed Falling12 closed 2 months ago

Falling12 commented 2 months ago

Current Behavior

I have an external backend which is connecting to the Wings API and if I create a new server Wings starts to run the installation script. However, when I look in the installation logs Its showing me Permission denied.

root@tokyoweb:/var/log/pterodactyl/install# cat 296e1de6-5416-4ad4-9a7c-fc90f8940136.log


|
| Details
| ------------------------------
  Server UUID:          296e1de6-5416-4ad4-9a7c-fc90f8940136
  Container Image:      ghcr.io/pterodactyl/yolks:java_8
  Container Entrypoint: bash

|
| Environment Variables
| ------------------------------
  TZ=Etc/UTC
  STARTUP=java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}
  SERVER_MEMORY=2048
  SERVER_IP=192.168.1.92
  SERVER_PORT=9000
  VANILLA_VERSION=latest
  SERVER_ID=296e1de6-5416-4ad4-9a7c-fc90f8940136

|
| Script Output
| ------------------------------
bash: /mnt/install/install.sh: Permission denied

Expected Behavior

The installation script should run normally without any problems. I know only one script which is running correctly and this is it: https://github.com/pelican-eggs/eggs/blob/master/game_eggs/gta/mtasa/egg-multi-theft-auto.json .

Steps to Reproduce

You cant really reproduce this because this is an external wrapper for the Wings API and there is a completely own panel.

Panel Version

-

Wings Version

1.11.13

Games and/or Eggs Affected

Minecraft (Vanilla), All Minecrafts

Docker Image

ghcr.io/pterodactyl/yolks:java_8, ghcr.io/pterodactyl/yolks:java_17, ghcr.io/pterodactyl/yolks:java_21

Error Logs

https://ptero.co/mikinirivo

root@tokyoweb:/var/log/pterodactyl/install# cat d7d3f24c-dcbb-4e77-99a5-229bfeef0365.log 
Pterodactyl Server Installation Log

|
| Details
| ------------------------------
  Server UUID:          d7d3f24c-dcbb-4e77-99a5-229bfeef0365
  Container Image:      ghcr.io/pterodactyl/yolks:java_8
  Container Entrypoint: bash

|
| Environment Variables
| ------------------------------
  TZ=Etc/UTC
  STARTUP=java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}
  SERVER_MEMORY=2048
  SERVER_IP=192.168.1.92
  SERVER_PORT=9000
  SERVER_ID=d7d3f24c-dcbb-4e77-99a5-229bfeef0365
  VANILLA_VERSION=latest

|
| Script Output
| ------------------------------
bash: /mnt/install/install.sh: Permission denied

Is there an existing issue for this?

danny6167 commented 2 months ago

If this isn't reproducible using Pterodactyl, and you can't provide any kind of code snippet that would demonstrate a flaw causing wings to behave outside it's designed behaviour, then I'm really don't see how we can proceed with this.

Falling12 commented 2 months ago

If this isn't reproducible using Pterodactyl, and you can't provide any kind of code snippet that would demonstrate a flaw causing wings to behave outside it's designed behaviour, then I'm really don't see how we can proceed with this.

I can send you code, but as I said Wings is still doing the installation job. But here is the code for the server creation after purchase:

func (u *UserController) InstallServer(uid, sid, nid string) {
    err := Nodes[nid].CreateServer(sid)
    if err != nil {
        WS.SendToUser(uid, WsMessage{
            Event: "server.install-failed",
            Data: fiber.Map{
                "sid": sid,
                "err": err.Error(),
            },
        })
        return
    }

    WS.SendToUser(uid, WsMessage{
        Event: "server.install-started",
        Data: fiber.Map{
            "sid": sid,
        },
    })
}

Create server function which is sending request to the Wings API:

func (c *Client) CreateServer(sid string) error {
    req := fasthttp.AcquireRequest()
    defer fasthttp.ReleaseRequest(req)
    req.SetRequestURI(fmt.Sprintf("%s/api/servers", c.url))
    req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.token))

    req.Header.SetMethod("POST")
    enc, err := sonic.Marshal(fiber.Map{
        "uuid": sid,
    })
    if err != nil {
        return err
    }
    req.SetBody(enc)

    res := fasthttp.AcquireResponse()
    defer fasthttp.ReleaseResponse(res)
    if err := c.httpClient.Do(req, res); err != nil {
        return err
    }

    if res.StatusCode() != fiber.StatusAccepted {
        return errors.New(string(bytes.Clone(res.Body())))
    }

    return nil
}
danny6167 commented 2 months ago

This isn't an issue with wings at all. You're using a yolk instead of a valid installer image. Either you've edited the egg, or your custom panel is sending the wrong data.

Falling12 commented 2 months ago

Official Vanilla Egg from the pterodactyl panel doesnt working got it from here: https://github.com/pterodactyl/panel/blob/1.0-develop/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json

danny6167 commented 2 months ago

Then as I said, it's an issue with your custom panel.

Falling12 commented 2 months ago

Okay, Its working now