Skip to content

Commit f2451ef

Browse files
committed
Improved known_hosts section in README.rst
1 parent b5ac5e0 commit f2451ef

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

README.rst

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ distribution.
6464
``openssh.known_hosts``
6565
-----------------------
6666

67-
Manages the side-wide ssh_known_hosts file and fills it with the
67+
Manages ``/etc/ssh/ssh_known_hosts`` and fills it with the
6868
public SSH host keys of your minions (collected via the Salt mine)
6969
and of hosts listed in you pillar data. It's possible to include
7070
minions managed via ``salt-ssh`` by using the ``known_hosts_salt_ssh`` renderer.
@@ -99,8 +99,8 @@ use other names, then you should indicate the names to use in pillar keys
9999
``openssh:known_hosts:mine_keys_function`` and
100100
``openssh:known_hosts:mine_hostname_function``.
101101

102-
You can also integrate alternate DNS names of the various hosts in the
103-
ssh_known_hosts files. You just have to list all the alternate DNS names as a
102+
You can also integrate alternate DNS names of the various hosts in
103+
``/etc/ssh/ssh_known_hosts``. You just have to specify all the alternate DNS names as a
104104
list in the ``openssh:known_hosts:aliases`` pillar key. Whenever the IPv4 or
105105
IPv6 behind one of those DNS entries matches an IPv4 or IPv6 behind the
106106
official hostname of a minion, the alternate DNS name will be associated to the
@@ -117,9 +117,19 @@ To **include minions managed via salt-ssh** install the ``known_hosts_salt_ssh``
117117
mkdir pillar/openssh
118118
ln -s ../../formulas/openssh-formula/_pillar/known_hosts_salt_ssh.sls pillar/openssh/known_hosts_salt_ssh.sls
119119

120-
Pillar ``openssh:known_hosts:salt_ssh`` overrides the Salt Mine.
120+
You'll find the cached pubkeys in Pillar ``openssh:known_hosts:salt_ssh``.
121121

122-
The pillar is fed by a host key cache. Populate it by applying ``openssh.gather_host_keys``
122+
It's possible to define aliases for certain hosts::
123+
124+
openssh:
125+
known_hosts:
126+
cache:
127+
public_ssh_host_names:
128+
minion.id:
129+
- minion.id
130+
- alias.of.minion.id
131+
132+
The cache is populated by applying ``openssh.gather_host_keys``
123133
to the salt master::
124134

125135
salt 'salt-master.example.test' state.apply openssh.gather_host_keys
@@ -129,30 +139,21 @@ The state tries to fetch the SSH host keys via ``salt-ssh``. It calls the comman
129139

130140
openssh:
131141
known_hosts:
132-
salt_ssh:
142+
cache:
133143
user: salt-master
134144

135-
It's possible to define aliases for certain hosts::
136-
137-
openssh:
138-
known_hosts:
139-
salt_ssh:
140-
public_ssh_host_names:
141-
minion.id:
142-
- minion.id
143-
- alias.of.minion.id
144-
145-
You can use a cronjob to populate a host key cache::
145+
Use a cronjob to populate a host key cache::
146146

147147
# crontab -e -u salt-master
148148
0 1 * * * salt 'salt-master.example.test' state.apply openssh.gather_host_keys
149149

150-
Or just add it to your salt master::
150+
If you must have the latest pubkeys, run the state before all others::
151151

152152
# states/top.sls:
153153
base:
154154
salt:
155-
- openssh.known_hosts_salt_ssh
155+
# slooooow!
156+
- openssh.gather_host_keys
156157

157158
You can also use a "golden" known hosts file. It overrides the keys fetched by the cronjob.
158159
This lets you re-use the trust estabished in the salt-ssh user's known_hosts file::

0 commit comments

Comments
 (0)