glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

glpi-remote on macOS Ventura #599

Closed GuidoWilden closed 1 month ago

GuidoWilden commented 4 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

Authentication via public key no longer works on macOS Ventura. I can ssh without entering a password but when I try to add the host I get the following:

> glpi-remote add ssh://engineer@10.26.2.131 --target server0 --debug --debug
Current vardir: /var/lib/glpi-agent
[debug] Logger backend Stderr initialized
[debug2] Using libssh2 1.10.0 for ssh remote
[debug2] Connecting to '10.26.2.131' remote host...
[debug2] Check remote host key...
[debug2] Try authentication using id_rsa key...
[error] Can't authenticate on 10.26.2.131 remote host
[debug2] executing ssh -q -o BatchMode=yes -l engineer -o ConnectTimeout=60 10.26.2.131 LANG=C id -u
[warning] You should execute remote inventory as super-user on remote host
[debug2] executing ssh -q -o BatchMode=yes -l engineer -o ConnectTimeout=60 10.26.2.131 LANG=C cat '.glpi-agent-deviceid'
Updating sys01-2024-02-08-10-58-35 remote for server0
Updated sys01-2024-02-08-10-58-35 remote agent for server0

The ssh command on its own gives us:

> ssh -q -o BatchMode=yes -l engineer -o ConnectTimeout=60 10.26.2.131 LANG=C id -u
501

To reproduce

Try and add a Mac running Ventura to the glpi-remote hosts list.

Expected behavior

Should just get added to the list of hosts.

Operating system

Linux

GLPI Agent version

Nightly build (git version in additional context below)

GLPI version

10.0.12

GLPIInventory plugin or FusionInventory for GLPI plugin version

GLPI Inventory v1.3.4

Additional context

GLPI Agent nightly build: v1.8-gitea453479

g-bougard commented 4 months ago

Hi @GuidoWilden

I see the error, but it seems related to a libssh2 failed try. Then the ssh command try, which follows the libssh2 try, worked.

To me, it seems the remote has been added. Don't you see the remote with glpi-remote list ?

GuidoWilden commented 4 months ago

Hi @g-bougard,

You are right it has intact been added. Hadn't checked that as I thought there is no point. The inventory does get created but the log is full of these: [error] [worker 1] sys01-2024-02-08-10-58-35, Can't authenticate on 10.26.2.131 remote host

g-bougard commented 4 months ago

Yes, you can ignore it. You should be able to make it disappeared by forcing ssh mode, using this url ssh://engineer@10.26.2.131?mode=ssh.

About libssh2 failure itself, I can only guess the libssh2 v1.10.0 is not supporting the security level forced in MacOSX Ventura. I've you check to upgrade that library ? The most recent one is v1.11.0 and it may work.

g-bougard commented 1 month ago

Hi @GuidoWilden

I'm closing this outdated issue.

I also updated code to more clearly report error related to libssh2.