Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to disable regeneration of ssh private key #772

Closed
gowenpotato opened this issue Jun 18, 2024 · 3 comments
Closed

option to disable regeneration of ssh private key #772

gowenpotato opened this issue Jun 18, 2024 · 3 comments

Comments

@gowenpotato
Copy link

Description

If you build a VM with a private key already for SSH, there is no option to disable the recreation of the private key that I can find

Solution

I'd li like a variable that enables the ability to disable the regeneration of the private key such as:

ssh_server_create_keypair

  • default: true
  • Description: true to specify generation of private keys if they already exist, false to specify no regeneration of private keys if none exist. will generate kaypair regardless if they dont already exist
  • Type: bool
  • Required: no

Alternatives

I dont know any alternatives

Additional information

...

@rndmh3ro
Copy link
Member

I'm not really sure what keys you mean. The hostkeys here?

@gowenpotato
Copy link
Author

It would be the the "Replace default 2048 bits RSA keypair" task

here

Sorry if there is a way to do this already - I'm not a dev and I have looked through all the options in the documentation and can't find anything that looks like its applicable

@rndmh3ro
Copy link
Member

Then you can use the variable ssh_host_key_files, e.g. like this:

- hosts: localhost
  roles: ssh_hardening
  vars:
    ssh_host_key_files:
      - /path/to/your/ssh_key

This way the role will use the existing, defined ssh-keys and not regenerate them.

@schurzi schurzi closed this as completed Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants