ssh config for manager. dont need to create soqemussh user on manager

This commit is contained in:
m0duspwnens
2025-01-14 16:21:17 -05:00
parent 2e3c1adc63
commit 161e8a6c21
2 changed files with 13 additions and 36 deletions

View File

@@ -1,2 +1,2 @@
Host *
IdentityFile /home/soqemussh/.ssh/id_ed25519
IdentityFile /etc/ssh/auth_keys/soqemussh/id_ed25519

View File

@@ -5,44 +5,10 @@
{% from 'vars/globals.map.jinja' import GLOBALS %}
# used for qemu+ssh connection between manager and hypervisors
create_soqemussh_user:
user.present:
- name: soqemussh
- shell: /bin/bash
- home: /home/soqemussh
{% if not GLOBALS.is_manager %}
- groups:
- wheel
- qemu
- libvirt
{% endif %}
{% if GLOBALS.is_manager %}
create_local_libvirt_ssh_key_dir:
file.directory:
- name: /opt/so/saltstack/local/salt/libvirt/ssh/keys
- user: socore
- group: socore
- mode: 755
- makedirs: True
# generate the key pair and put the pub key in salt local files roots
generate_ssh_key_soqemussh:
cmd.run:
- name: ssh-keygen -q -N '' -t ed25519 -f /home/soqemussh/.ssh/id_ed25519
- runas: soqemussh
- unless: test -f /home/soqemussh/.ssh/id_ed25519
- require:
- user: create_soqemussh_user
soqemussh_ssh_key_to_local:
cmd.run:
- name: cp /home/soqemussh/.ssh/id_ed25519.pub /opt/so/saltstack/local/salt/libvirt/ssh/keys
- onchanges:
- cmd: generate_ssh_key_soqemussh
qemu_ssh_client_config:
file.managed:
- name: /root/.ssh/config
@@ -50,6 +16,17 @@ qemu_ssh_client_config:
{% else %}
# used for qemu+ssh connection between manager and hypervisors
create_soqemussh_user:
user.present:
- name: soqemussh
- shell: /bin/bash
- home: /home/soqemussh
- groups:
- wheel
- qemu
- libvirt
soqemussh_pub_key:
ssh_auth.present:
- user: soqemussh