mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-21 00:41:01 +02:00
- After acme.sh renew/issue, run install-cert into live/ (ECC/RSA aware) - Resolve ACME webroot from sslpath like obtainSSLForADomain - Add --ecc to obtainSSL acme.sh install-cert (PR #1732 alignment) - Add test/ssl_acme_helpers_test.py smoke tests for webroot helpers
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""Smoke tests for SSL renewal helpers (CyberPanel issue #1676 / PR #1732 alignment)."""
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
|
|
_REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
sys.path.insert(0, _REPO_ROOT)
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CyberCP.settings')
|
|
|
|
import django # noqa: E402
|
|
|
|
django.setup()
|
|
|
|
from plogical.sslUtilities import ( # noqa: E402
|
|
_ssl_resolve_acme_webroot,
|
|
_ssl_privkey_is_ecdsa,
|
|
)
|
|
|
|
|
|
def test_webroot_default():
|
|
assert _ssl_resolve_acme_webroot(None) == '/usr/local/lsws/Example/html'
|
|
assert _ssl_resolve_acme_webroot('') == '/usr/local/lsws/Example/html'
|
|
|
|
|
|
def test_webroot_custom():
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
assert _ssl_resolve_acme_webroot(tmp) == tmp
|
|
|
|
|
|
def test_webroot_invalid_fallback():
|
|
assert _ssl_resolve_acme_webroot('/nonexistent/path/12345') == '/usr/local/lsws/Example/html'
|
|
|
|
|
|
def test_privkey_missing_defaults_ecdsa():
|
|
assert _ssl_privkey_is_ecdsa('/nonexistent/privkey.pem') is True
|
|
|
|
|
|
if __name__ == '__main__':
|
|
test_webroot_default()
|
|
test_webroot_custom()
|
|
test_webroot_invalid_fallback()
|
|
test_privkey_missing_defaults_ecdsa()
|
|
print('ok: ssl_acme_helpers_test')
|