ssh암복호화 해결 해야함

This commit is contained in:
2025-05-20 19:07:11 +09:00
parent b172945fc5
commit 69aca7ae85
9 changed files with 276 additions and 5 deletions

View File

@ -14,6 +14,9 @@ import os
from dotenv import load_dotenv
from pathlib import Path
import sys
from cryptography.fernet import Fernet
import hashlib
import base64
LOGGING = {
'version': 1,
@ -49,6 +52,11 @@ else:
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-ec9me^z%x7-2vwee5#qq(kvn@^cs!!22_*f-im(320_k5-=0j5')
# Fernet은 32바이트 base64 인코딩된 키를 요구하므로, Django SECRET_KEY를 기반으로 키 생성
hashed = hashlib.sha256(SECRET_KEY.encode()).digest()
FERNET_KEY = base64.urlsafe_b64encode(hashed[:32]) # 32 bytes → base64로 인코딩
FERNET = Fernet(FERNET_KEY)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = int(os.environ.get('DEBUG', 1))