数据库优化
This commit is contained in:
parent
ce31a591af
commit
1720d69be6
6
app.py
6
app.py
@ -184,7 +184,7 @@ def create_ca(ca_name, common_name, organization, organizational_unit, country,
|
|||||||
created_by):
|
created_by):
|
||||||
# 创建拼音格式的目录名
|
# 创建拼音格式的目录名
|
||||||
pinyin_name = to_pinyin(ca_name)
|
pinyin_name = to_pinyin(ca_name)
|
||||||
ca_dir = os.path.join(CERT_STORE, f"ca_{pinyin_name}")
|
ca_dir = os.path.join(Config.CERT_STORE, f"ca_{pinyin_name}")
|
||||||
os.makedirs(ca_dir, exist_ok=True)
|
os.makedirs(ca_dir, exist_ok=True)
|
||||||
|
|
||||||
# 使用原始common_name作为文件名
|
# 使用原始common_name作为文件名
|
||||||
@ -235,7 +235,7 @@ def create_certificate(ca_id, common_name, san_dns, san_ip, organization, organi
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# 创建证书目录
|
# 创建证书目录
|
||||||
cert_dir = os.path.join(CERT_STORE, f"certs_{common_name}")
|
cert_dir = os.path.join(Config.CERT_STORE, f"certs_{common_name}")
|
||||||
os.makedirs(cert_dir, exist_ok=True)
|
os.makedirs(cert_dir, exist_ok=True)
|
||||||
|
|
||||||
key_path = os.path.join(cert_dir, f"{common_name}.key")
|
key_path = os.path.join(cert_dir, f"{common_name}.key")
|
||||||
@ -1355,7 +1355,7 @@ def generate_separate_files_zip(cert, cert_ext, zip_suffix):
|
|||||||
@login_required
|
@login_required
|
||||||
def download_file(filename):
|
def download_file(filename):
|
||||||
# 安全检查:确保文件路径在证书存储目录内
|
# 安全检查:确保文件路径在证书存储目录内
|
||||||
file_path = os.path.join(CERT_STORE, filename)
|
file_path = os.path.join(Config.CERT_STORE, filename)
|
||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
flash('文件不存在', 'danger')
|
flash('文件不存在', 'danger')
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user