mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-28 08:11:45 +00:00
Add a sample for doing SSH CA
This will explore the concept for the backend of the get certificate api.
This commit is contained in:
parent
7fe47baab3
commit
34f2f6e359
23
misc/sshca.py
Normal file
23
misc/sshca.py
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import confluent.collective.manager as collective
|
||||
import eventlet.green.subprocess as subprocess
|
||||
import os
|
||||
|
||||
def initialize_ca():
|
||||
try:
|
||||
os.makedirs('/etc/confluent/ssh', mode=0o600)
|
||||
except OSError as e:
|
||||
if e.errno != 17:
|
||||
raise
|
||||
caname = '{0} SSH CA'.format(collective.get_myname())
|
||||
subprocess.check_call(['ssh-keygen', '-C', caname, '-t', 'ecdsa', '-f', '/etc/confluent/ssh/ca', '-N', ''])
|
||||
|
||||
|
||||
def ca_exists():
|
||||
return os.path.exists('/etc/confluent/ssh/ca')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if not ca_exists():
|
||||
initialize_ca()
|
Loading…
x
Reference in New Issue
Block a user