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))

View File

@ -15,8 +15,24 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissions
schema_view = get_schema_view(
openapi.Info(
title="ToDo API",
default_version='v1',
description="MSA Django Todo API",
),
public=True,
permission_classes=[permissions.AllowAny],
)
urlpatterns = [
path('admin/', admin.site.urls),
]
path('api/ansible/', include('ansible.urls')), # ✅ 추가됨
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]