sardinasystems / fleeting-plugin-openstack

GitLab fleeting plugin for OpenStack
Apache License 2.0
11 stars 6 forks source link

Authentication with static credentials broken #25

Closed D3N14L closed 1 month ago

D3N14L commented 1 month ago

While playing around with the plugin I encountered that the authentication with static credentials is broken. Most probably since the introduction of ignition with sshKeys.

You are initializing the SSH key in https://github.com/sardinasystems/fleeting-plugin-openstack/blob/d127199ff78cb07b1163df442360563e991fb610/provider.go#L97 . This happens regardless of the state of use_ignition. Consequently the initSSHKey function adds the key to the ConnectorConfig object in https://github.com/sardinasystems/fleeting-plugin-openstack/blob/d127199ff78cb07b1163df442360563e991fb610/connection_ssh.go#L35 .

Unfortunately the DialSSH funtion in the Connector only uses either the password or the public key based auth and it only ever adds the password to the client, if there is no private key in the ConnectInfo settings (see: https://gitlab.com/gitlab-org/fleeting/fleeting/-/blob/main/connector/ssh.go?ref_type=heads#L56). So with the current setup the password never gets added to the ssh-client because there always is a private key present in the connection settings - even though this should not be used.

vooon commented 1 month ago

Thank you for report. Should be fixed in 0.20.0.

D3N14L commented 1 month ago

Wow. That was quick!

Thank you very much for fixing it!