{"action":"created","issue":{"url":"https://api.github.com/repos/lago-project/lago/issues/371","repository_url":"https://api.github.com/repos/lago-project/lago","labels_url":"https://api.github.com/repos/lago-project/lago/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/lago-project/lago/issues/371/comments","events_url":"https://api.github.com/repos/lago-project/lago/issues/371/events","html_url":"https://github.com/lago-project/lago/pull/371","id":193498676,"number":371,"title":"Fix SSH with public key and with username","user":{"login":"mykaul","id":4655593,"avatar_url":"https://avatars.githubusercontent.com/u/4655593?v=3","gravatar_id":"","url":"https://api.github.com/users/mykaul","html_url":"https://github.com/mykaul","followers_url":"https://api.github.com/users/mykaul/followers","following_url":"https://api.github.com/users/mykaul/following{/other_user}","gists_url":"https://api.github.com/users/mykaul/gists{/gist_id}","starred_url":"https://api.github.com/users/mykaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykaul/subscriptions","organizations_url":"https://api.github.com/users/mykaul/orgs","repos_url":"https://api.github.com/users/mykaul/repos","events_url":"https://api.github.com/users/mykaul/events{/privacy}","received_events_url":"https://api.github.com/users/mykaul/received_events","type":"User","site_admin":false},"labels":[{"id":313524197,"url":"https://api.github.com/repos/lago-project/lago/labels/bug","name":"bug","color":"fc2929","default":true},{"id":318130095,"url":"https://api.github.com/repos/lago-project/lago/labels/needs%20review","name":"needs review","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-05T13:40:01Z","updated_at":"2016-12-11T11:00:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lago-project/lago/pulls/371","html_url":"https://github.com/lago-project/lago/pull/371","diff_url":"https://github.com/lago-project/lago/pull/371.diff","patch_url":"https://github.com/lago-project/lago/pull/371.patch"},"body":"1. We were never using public key auth.!\r\nWe've always supplied the user's password,\r\nwhile the key password is actually ''\" (empty string).\r\n\r\n2. Added not to look for keys in the system and not connect to the agent.\r\nNot needed.\r\n\r\n3. Switch SSH with username to use any username passed to it. The default\r\nis still root of course. Now it can also accept a password.\r\n\r\n4. Move the call to initialize the paramiko object outside the loop."},"comment":{"url":"https://api.github.com/repos/lago-project/lago/issues/comments/266275551","html_url":"https://github.com/lago-project/lago/pull/371#issuecomment-266275551","issue_url":"https://api.github.com/repos/lago-project/lago/issues/371","id":266275551,"user":{"login":"mykaul","id":4655593,"avatar_url":"https://avatars.githubusercontent.com/u/4655593?v=3","gravatar_id":"","url":"https://api.github.com/users/mykaul","html_url":"https://github.com/mykaul","followers_url":"https://api.github.com/users/mykaul/followers","following_url":"https://api.github.com/users/mykaul/following{/other_user}","gists_url":"https://api.github.com/users/mykaul/gists{/gist_id}","starred_url":"https://api.github.com/users/mykaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykaul/subscriptions","organizations_url":"https://api.github.com/users/mykaul/orgs","repos_url":"https://api.github.com/users/mykaul/repos","events_url":"https://api.github.com/users/mykaul/events{/privacy}","received_events_url":"https://api.github.com/users/mykaul/received_events","type":"User","site_admin":false},"created_at":"2016-12-11T11:00:14Z","updated_at":"2016-12-11T11:00:14Z","body":"The whole public key infrastructure is completely broken - mainly because it'll never get used. There is no chance the VM will not have a root or SSH password. And they are actually taking one from another.\r\n\r\nSee code mainly in lago/plugins/vm.py (specifically, _normalize_spec() and root_password() functions are of interest):\r\n1. There is also ssh-password, as it is set in lago/cmd.py by default. \r\n2. There is never a root_password in the spec (unless explicitly set.). It is (probably always) in the metadata of the image - but no one bothers to read it from it?\r\n3. There is a default_root_password set in lago/cmd.py - don't think it's used anywhere in the code.\r\n4. If you look at root_password() - it is trying to read it from the spec (which is never there) and if it fails, it copies it from spec's ssh-password. Of course, earlier ssh-password was set in _normalize_spec()\r\n\r\nSo all in all:\r\n1. A bit of a mess.\r\n2. No way public key would work, as we always have a password.\r\n\r\n@nvgoldin  , @david-caro  - thoughts?\r\n\r\nI'll probably do the minimal changes (2-4 above) and forget about the rest for the time being, unless we can properly fix this."}}
{"actor":{"display_login":"mykaul"}}