mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
check that the manager has a ca in the mine and that it is valid
This commit is contained in:
@@ -46,6 +46,25 @@ def start(interval=60):
|
|||||||
mine_update(minion)
|
mine_update(minion)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# if a manager check that the ca in in the mine and it is correct
|
||||||
|
if minion.split('_')[-1] in ['manager', 'managersearch', 'eval', 'standalone', 'import']:
|
||||||
|
x509 = __salt__['saltutil.runner']('mine.get', tgt=minion, fun='x509.get_pem_entries')
|
||||||
|
try:
|
||||||
|
ca_crt = x509[minion]['/etc/pki/ca.crt']
|
||||||
|
log.debug('checkmine engine: found minion %s has ca_crt: %s' % (minion, ca_crt))
|
||||||
|
# since the cert is defined, make sure it is valid
|
||||||
|
if not __salt__['x509.verify_private_key'](private_key='/etc/pki/ca.key', public_key='/etc/pki/ca.crt'):
|
||||||
|
log.error('checkmine engine: found minion %s does\'t have a valid ca_crt in the mine' % (minion))
|
||||||
|
log.error('checkmine engine: %s: ca_crt: %s' % (minion, ca_crt))
|
||||||
|
mine_delete(minion, 'x509.get_pem_entries')
|
||||||
|
mine_update(minion)
|
||||||
|
else:
|
||||||
|
log.debug('checkmine engine: found minion %s has a valid ca_crt in the mine' % (minion))
|
||||||
|
except IndexError:
|
||||||
|
log.error('checkmine engine: found minion %s does\'t have a ca_crt in the mine' % (minion))
|
||||||
|
mine_delete(minion, 'x509.get_pem_entries')
|
||||||
|
mine_update(minion)
|
||||||
|
|
||||||
# Update the mine if the ip in the mine doesn't match returned from manage.alived
|
# Update the mine if the ip in the mine doesn't match returned from manage.alived
|
||||||
network_ip_addrs = __salt__['saltutil.runner']('mine.get', tgt=minion, fun='network.ip_addrs')
|
network_ip_addrs = __salt__['saltutil.runner']('mine.get', tgt=minion, fun='network.ip_addrs')
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user