您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718
  1. import os
  2. import shutil
  3. def copy_certificates(certificates, destination='/etc/ssl', domain='example.org'):
  4. private_key_folder = os.path.join(destination, 'private')
  5. if not os.path.exists(private_key_folder):
  6. os.makedirs(private_key_folder)
  7. private_key = os.path.join(private_key_folder, domain + '.key')
  8. shutil.copy2(certificates['key'], private_key)
  9. os.chmod(private_key, 0o600)
  10. certificates_folder = os.path.join(destination, 'certs')
  11. if not os.path.exists(certificates_folder):
  12. os.makedirs(certificates_folder)
  13. certificate = os.path.join(certificates_folder, domain + '.crt')
  14. shutil.copy2(certificates['crt'], certificate)
  15. os.chmod(certificate, 0o644)