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.81k stars 1.74k forks source link

Wings: failed to initialize the sftp server error=ssh: no key found #5204

Closed l1gi closed 1 month ago

l1gi commented 2 months ago

Current Behavior

Hell,

as suggested on installation instructions I am running wings for the first time after config was copied to /etc/pterodactyl/config.yaml. This is what I get:

root@ptero:~# wings --debug
 INFO: [Sep  3 18:23:41.188] writing log files to disk path=/var/log/pterodactyl/wings.log

                     ____
__ Pterodactyl _____/___/_______ _______ ______
\_____\    \/\/    /   /       /  __   /   ___/
   \___\          /   /   /   /  /_/  /___   /
        \___/\___/___/___/___/___    /______/
                            /_______/ 1.11.13

Copyright © 2018 - 2024 Dane Everitt & Contributors

Website:  https://pterodactyl.io
 Source:  https://github.com/pterodactyl/wings
License:  https://github.com/pterodactyl/wings/blob/develop/LICENSE

This software is made available under the terms of the MIT license.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

DEBUG: [Sep  3 18:23:41.189] running in debug mode    
 INFO: [Sep  3 18:23:41.189] loading configuration from file config_file=/etc/pterodactyl/config.yml
 INFO: [Sep  3 18:23:41.189] configured wings with system timezone timezone=Europe/Prague
DEBUG: [Sep  3 18:23:41.189] ensuring root data directory exists path=/var/lib/pterodactyl
DEBUG: [Sep  3 18:23:41.190] ensuring server data directory exists path=/var/lib/pterodactyl/volumes
DEBUG: [Sep  3 18:23:41.190] ensuring archive data directory exists path=/var/lib/pterodactyl/archives
DEBUG: [Sep  3 18:23:41.190] ensuring backup data directory exists path=/var/lib/pterodactyl/backups
 INFO: [Sep  3 18:23:41.190] checking for pterodactyl system user username=pterodactyl
 INFO: [Sep  3 18:23:41.191] configured system user successfully gid=995 uid=999 username=pterodactyl
 INFO: [Sep  3 18:23:41.195] fetching list of servers from API
DEBUG: [Sep  3 18:23:41.196] making request to external HTTP endpoint endpoint=https://ptero.tekkirk.org/api/remote/servers?page=0&per_page=50 headers=map[Accept:[application/vnd.pterodactyl.v1+json] Authorization:[(redacted)] Content-Type:[application/json] User-Agent:[Pterodactyl Wings/v1.11.13 (id:CYyvXnFbDco7cJ8I)]] method=GET
 INFO: [Sep  3 18:23:41.303] processing servers returned by the API total_configs=0
DEBUG: [Sep  3 18:23:41.303] using 24 workerpools to instantiate server instances
 INFO: [Sep  3 18:23:41.303] finished processing server configurations duration=599.564µs
 INFO: [Sep  3 18:23:41.311] configuring system crons  interval=1m0s subsystem=cron
 INFO: [Sep  3 18:23:41.312] starting cron processes   subsystem=cron
DEBUG: [Sep  3 18:23:41.312] sending sftp events to Panel cron=sftp subsystem=cron
 INFO: [Sep  3 18:23:41.312] configuring internal webserver host_address=0.0.0.0 host_port=8080 use_auto_tls=false use_ssl=true
DEBUG: [Sep  3 18:23:41.313] sending internal activity events to Panel cron=activity subsystem=cron
 INFO: [Sep  3 18:23:41.317] updating server states on Panel: marking installing/restoring servers as normal
FATAL: [Sep  3 18:23:41.317] failed to initialize the sftp server error=ssh: no key found

This happens on dedicated Debian system:

root@ptero:~# uname -a
Linux ptero 6.1.0-23-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux

I have found the source code where the issue is happening, but I am not able to find exact line because the binary has its symbols stripped. I would like to ask you for help identifying a command to isolate the issue so I can continue finding the root cause.

Thank you, m.

Expected Behavior

Wings successful startup.

Steps to Reproduce

Just run the wings binary.

Panel Version

1.11.7

Wings Version

1.11.13

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

https://ptero.co/locutomujo
https://ptero.co/usiwoqelaz

Is there an existing issue for this?

Melonendk commented 1 month ago

Hi, so i could reproduce this, and i also know how to fix this.

The issue seems that wings have issues creating / finding the correct keys so the function works but it also doesn't, so it definitely a bug that needs to be checked out.

Tested on Ubuntu 24.04

To fix the issue

Create a new key using this command

ssh-keygen -t ed25519

and set the location of the file to be

/var/lib/pterodactyl/volumes/.sftp/id_ed25519

NOTE: If you are asked if you want to overwrite say yes, and also just leave the passphrase empty.

l1gi commented 1 month ago

I confirm the key was an empty file:

root@ptero:/var/lib/pterodactyl/volumes/.sftp# cat id_ed25519 
root@ptero:/var/lib/pterodactyl/volumes/.sftp#

Now the wings runs.

Thank you, m.

l1gi commented 1 month ago

Do you know what the file was empty? In other words could we fix it in the code?

Melonendk commented 1 month ago

Sadly i dont, it might be a case of the go function not running properly or write permissions might be wrong.