인증 시스템
SirrChat은 기존 비밀번호부터 최신 블록체인 서명까지 다양한 유연한 인증 방법을 제공합니다.
인증 방법
블록체인 인증
블록체인 지갑을 사용한 비밀번호 없는 인증.
작동 방식
- 클라이언트가 개인 키로 임의 메시지에 서명
- 서버가 서명을 확인하고 지갑 주소를 복구
- 주소가 사용자 계정과 일치하는지 확인
구성 예제
toml
[auth.blockchain]
enabled = true
networks = ["ethereum", "bsc", "polygon"]
[auth.blockchain.rpc]
ethereum = "https://mainnet.infura.io/v3/YOUR-PROJECT-ID"
bsc = "https://bsc-dataseed.binance.org"
polygon = "https://polygon-rpc.com"지원되는 네트워크
- Ethereum (ETH)
- BNB Smart Chain (BSC)
- Polygon (MATIC)
- 모든 EVM 호환 체인
클라이언트 사용
javascript
// 서명 생성
const message = `Login to SirrChat: ${timestamp}`;
const signature = await web3.eth.personal.sign(message, address);
// SMTP AUTH
AUTH BLOCKCHAIN
<address>
<signature>
<message>LDAP 인증
엔터프라이즈 LDAP 디렉토리 서비스와의 통합.
구성
toml
[auth.ldap]
enabled = true
server = "ldap://ldap.example.com:389"
bind_dn = "cn=admin,dc=example,dc=com"
bind_password = "password"
user_base = "ou=users,dc=example,dc=com"
user_filter = "(uid={username})"Active Directory
toml
[auth.ldap]
server = "ldap://dc.example.com:389"
bind_dn = "cn=Administrator,cn=Users,dc=example,dc=com"
bind_password = "password"
user_base = "cn=Users,dc=example,dc=com"
user_filter = "(sAMAccountName={username})"PAM 인증
인증을 위해 Linux 시스템 계정 사용.
구성
toml
[auth.pam]
enabled = true
service = "sirrchat"PAM 구성 파일
/etc/pam.d/sirrchat 생성:
auth required pam_unix.so
account required pam_unix.so데이터베이스 인증
기존 사용자 이름/비밀번호 인증.
구성
toml
[auth.database]
enabled = true
password_hash = "bcrypt" # bcrypt, argon2, scrypt사용자 생성
bash
sirrchatd user create \
--username user@example.com \
--password secretpassword다중 인증 (MFA)
TOTP
시간 기반 일회용 비밀번호.
toml
[auth.mfa]
enabled = true
issuer = "SirrChat"MFA 활성화
bash
sirrchatd mfa enable --user user@example.com하드웨어 키
FIDO2/WebAuthn 하드웨어 키 지원.
toml
[auth.mfa.webauthn]
enabled = true
rp_name = "SirrChat Mail Server"인증 프로토콜
SASL 메커니즘
지원되는 SASL 인증 메커니즘:
- PLAIN: 평문 비밀번호 (TLS 필요)
- LOGIN: 로그인 인증
- CRAM-MD5: 챌린지-응답 인증
- SCRAM-SHA-256: 보안 인증
- BLOCKCHAIN: 커스텀 블록체인 인증
구성 예제
toml
[auth.sasl]
mechanisms = ["PLAIN", "LOGIN", "BLOCKCHAIN"]
require_tls = true액세스 제어
IP 화이트리스트
toml
[auth.access_control]
allowed_ips = ["192.168.1.0/24", "10.0.0.0/8"]IP 블랙리스트
toml
[auth.access_control]
blocked_ips = ["203.0.113.0/24"]지리적 제한
toml
[auth.geo]
enabled = true
allowed_countries = ["US", "GB", "CA"]세션 관리
세션 구성
toml
[auth.session]
# 세션 타임아웃 (초)
timeout = 3600
# 최대 동시 세션
max_sessions = 10
# 세션 토큰 길이
token_length = 32세션 스토리지
- Memory: 빠르지만 영구적이지 않음
- Redis: 분산 세션 관리
- Database: 영구 스토리지
toml
[auth.session.storage]
type = "redis"
redis_url = "redis://localhost:6379/0"비밀번호 정책
비밀번호 요구 사항
toml
[auth.password_policy]
min_length = 12
require_uppercase = true
require_lowercase = true
require_digits = true
require_special = true비밀번호 기록
toml
[auth.password_policy]
remember_count = 5 # 마지막 5개 비밀번호 기억
expiry_days = 90 # 90일 후 만료보안 기능
무차별 대입 공격 방지
toml
[auth.security]
max_attempts = 5
lockout_duration = 300 # 5분이상 징후 탐지
toml
[auth.anomaly_detection]
enabled = true
alert_on_new_ip = true
alert_on_new_device = true감사 로그
기록되는 이벤트
- 로그인 시도 (성공/실패)
- 비밀번호 변경
- MFA 상태 변경
- 세션 생성/삭제
로그 형식
json
{
"timestamp": "2025-01-15T10:30:00Z",
"event": "login_success",
"user": "user@example.com",
"ip": "192.168.1.100",
"method": "blockchain"
}API 인증
API 키
bash
sirrchatd api-key create --user user@example.comOAuth 2.0
toml
[auth.oauth]
enabled = true
provider = "custom"
client_id = "sirrchat"
client_secret = "secret"모범 사례
- 항상 TLS 사용: 전송 중인 인증 자격 증명 암호화
- MFA 활성화: 계정 보안 향상
- 정기적으로 키 교체: API 키 및 비밀번호 업데이트
- 이상 징후 모니터링: 알림 설정
- 최소 권한 원칙: 필요한 권한만 부여
관련 문서: