I am trying to use pulumi to connect to a Rocky Li...
# general
n
I am trying to use pulumi to connect to a Rocky Linux server with the pulumi command module. The connection fails, but I am seeing in my server logs that the error is because ssh-rsa algorithm is disabled. How do I define my connection to use ED25519? Here is how I define my key
Copy code
const tlsKey = new tls.PrivateKey("tls-key", {
  algorithm: "ED25519",
  rsaBits: 4096,
});
and here is my connection object
Copy code
const master1Con = {
  host: k3sMaster1.ipv4Address,
  user: "ansible",
  privateKey: tlsKey.privateKeyPem,
}
d
You don't need rsaBits set as that only applies to rsa. It looks like the TLS provider has an output
privateKeyOpenssh
for ssh usage, that should work provided the public key is loaded onto the server https://www.pulumi.com/registry/packages/tls/api-docs/privatekey/#privatekeyopenssh_nodejs
n
@dry-keyboard-94795 Thanks, I made the changes you suggested. I have found the problem though, for some reason my public key is not being added to the authorized_keys for the ansible user in my userData. Can you see anything wrong with my code below.
Copy code
const tlsKey = new tls.PrivateKey("tls-key", {
  algorithm: "ED25519",
});
const publicKey = tlsKey.publicKeyOpenssh

const k3sMaster1 = new hcloud.Server("k3s-master-1", {
  name: "k3s-master-1",
  image: "rocky-9",
  serverType,
  deleteProtection,
  sshKeys: [hKey.name, localKey],
  labels: {
    "k3s-master": "true"
  },
  networks: [{
    networkId: k3sNetwork.id,
    ip: "10.8.8.10"
  }],
  userData: `
#cloud-config
users:
  - name: ansible
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    ssh_authorized_keys:
      - "${publicKey}"
    sudo: 'ALL=(ALL) NOPASSWD:ALL'
runcmd:
  - sudo yum update -y
  - sudo reboot
  `
}, {
  dependsOn: [k3sNetwork, hKey]
})
d
publicKey here is an
Output<string>
, so you'll need to use something like
pulumi.interpolate
to access the contents. See here: https://www.pulumi.com/docs/concepts/inputs-outputs/#outputs-and-strings
n
Thank you.