Target/Machine Health Check Fails with "not a valid Base-64 string"

(Harris Kirk) #1

The target is defined as

The target definition via REST
{
“Id”: “Machines-1963”,
“EnvironmentIds”: [
“Environments-3763”,
“Environments-3764”,
“Environments-3765”
],
“Roles”: [
“Core”
],
“TenantedDeploymentParticipation”: “TenantedOrUntenanted”,
“TenantIds”: [
“Tenants-295”
],
“TenantTags”: [],
“SpaceId”: “Spaces-1296”,
“Name”: “core-1.dev2.dev.ldxc”,
“Thumbprint”: null,
“Uri”: null,
“IsDisabled”: false,
“MachinePolicyId”: “MachinePolicies-1296”,
“Status”: “CalamariNeedsUpgrade”,
“HealthStatus”: “Unhealthy”,
“HasLatestCalamari”: false,
“StatusSummary”: “There was a problem communicating with this machine (last checked: Friday, 15 May 2020 1:13:48 PM +00:00)”,
“IsInProcess”: false,
“Endpoint”: {
“CommunicationStyle”: “Ssh”,
“AccountId”: “sshkeypair-ldxc-dev2-dev-us-east-1-spaces-1296”,
“Host”: “10.19.94.27”,
“Port”: 22,
“Fingerprint”: “xxxxxxxxxxxxxxxx6:f5:1b:43:f1:9d:2a:ce:b9”,
“Uri”: “ssh://10.19.94.27:22/”,
“ProxyId”: “Proxys-35”,
“DotNetCorePlatform”: “”,
“Id”: null,
“LastModifiedOn”: null,
“LastModifiedBy”: null,
“Links”: {}
},
“OperatingSystem”: “Unknown”,
“ShellName”: “Unknown”,
“ShellVersion”: “Unknown”,
“Links”: {
“Self”: “/api/Spaces-1296/machines/Machines-1963”,
“Connection”: “/api/Spaces-1296/machines/Machines-1963/connection”,
“TasksTemplate”: “/api/Spaces-1296/machines/Machines-1963/tasks{?skip,take}”
}
},

(Dane Falvo) #4

Hi Harris,

Thank you for providing so much information. It’s very appreciated.

I’m sorry you’ve hit this issue - but I think the Raw Log Files will be able to give us some insight into the issue. The Raw log files will be available on the same page you grabbed the first screenshot from.

Just click on the “Task Log” tab followed by “Raw Logs”. There should be an option to Download the log file. Send that file across and I can have a closer look.

Are you using an Octopus cloud-hosted environment or are you running a Self-hosted server? If you are self-hosted, what version of Octopus are you running?

Do you have other tentacles connecting through the Proxy successfully? If so, are they Polling, listening or SSH tentacles?

I’m looking forward to hearing back from you so we can get to the bottom of this.

Regards,

Dane.

(Harris Kirk) #5

Hi Dane: Thank you so much for your offer to help.

We have 2 Octopus Cloud-hosted instances. instance A is heavily used with manually-maintained jobs. instance B is where the problem is and all artifacts are created with the REST api. I create the artifacts to exactly align with the artifacts on instance
A. The connection to the target is ssh.

Hmmmm perhaps trying to access a target from 2 different Octopus instances is the problem?

I attached the raw log output.

The octopus server is Octopus-cloud hosted

Thanks!

ServerTasks-16085.log.txt (7.54 KB)

(Harris Kirk) #6

Actually, Dane. Here is the update for this ticket. Adding the ssh private key MANUALLY (via UI) caused the Healthcheck to
PASS.

However, passing in the private key via a rest call does NOT work.

Please let me know that you have received this update and I will work on the REST call. But please leave this ticket open for now.

Thanks

(Harris Kirk) #7

Update again. The passing of the private key via REST call to the account object is the problem. Here is the code

    pvtkey = '''-----BEGIN RSA PRIVATE KEY-----

MIIEogIBAAKCAQEAqru0kiCCOn7K/wAPESlqF+stZkdOl5ysDRvJULsAFMaZOwtB

+SsyAaXLs0p9zVVwlGS6mjR5qXHgnpsNAACeFEwUKL7FLZxLLPwiatY+Rt0cJmI1

IeBTlL+QvAxyWykFR0yA/k5MYb591ofkquf8ZFF7+OEyWFQdy7Z/LtQS7UdOvVN8

TGKP9M/1KxXF2aK7dNy7fL3e8aCmllypq+IToAt9hQ9JEqfDq1Sl5qN+5hFVJq7C

xl5Ka51wvJeAWHzhuh/do9Ma2Jt+h8wgQyEMnO9TQkMRzeRB3SVfDL4YWCBABq3B

hw8pTRQugttgTMY7EUvT68EIzIzgBjkWGbvdDwIDAQABAoIBABeq76w2H3d2bjON

UYligVeRfXipN+bijCNBD9ZGJgu7QDCkLeAZsdPypNtU3z2gs3uOvyNzVM49gBLc

kZ/HdiKALWc8kt7wxKcWyLqgun9eVXGouY7Zpxx+tdSrsQqcFCQ/Ib6fIg2Gt7EO

etc

w8ABSKYO3GVtMst2O+NZgtnFxjbD5+k7a2QvkfxlLsxadUxT84E=

-----END RSA PRIVATE KEY-----’’’

    trimmed_key = ''.join(pvtkey.split())

    data = {

        "Name": acct['Name'],

        "AccountType":

“SshKeyPair”,

        "Username": acct['Username'],

        "PrivateKeyFile": {"HasValue":

False, “NewValue”: trimmed_key},

        "PrivateKeyPassphrase": {"HasValue":

False, “NewValue”:
None},

        "TenantedDeploymentParticipation":

“TenantedOrUntenanted”,

        "EnvironmentIds": env_ids,

        "TenantIds": tenant_ids,

    }

    response = self.executor.http_post(f"/accounts", data)

    return response["Id"]

Is there something about how the “PrivateKeyFile” is handled? I am assuming that the KEY is what belong here not a ‘file’?

(Harris Kirk) #8

This ticket can be closed (don’t see a way to do that in the web ui).

The problem is that the REST API does not seem to support direct uploads of ssh private key.

Will open another ticket with the clearer explanation

1 Like