Skip to content

인증 시스템 ​

SirrMesh는 기존 비밀번호부터 현대적인 블록체인 서명까지 다양하고 유연한 인증 방식을 제공합니다.

인증 방식 ​

블록체인 인증 ​

블록체인 지갑을 사용한 비밀번호 없는 인증.

작동 방식 ​

  1. 클라이언트가 개인 키로 무작위 메시지에 서명
  2. 서버가 서명을 검증하고 지갑 주소를 복구
  3. 주소가 사용자 계정과 일치하는지 확인

설정 예제 ​

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 SirrMesh: ${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
sirrmeshd user create \
  --username [email protected] \
  --password secretpassword

다중 인증 (MFA) ​

TOTP ​

시간 기반 일회용 비밀번호.

toml
[auth.mfa]
enabled = true
issuer = "SirrMesh"

MFA 활성화 ​

bash
sirrmeshd mfa enable --user [email protected]

하드웨어 키 ​

FIDO2/WebAuthn 하드웨어 키 지원.

toml
[auth.mfa.webauthn]
enabled = true
rp_name = "SirrMesh 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": "[email protected]",
  "ip": "192.168.1.100",
  "method": "blockchain"
}

API 인증 ​

API 키 ​

bash
sirrmeshd api-key create --user [email protected]

OAuth 2.0 ​

toml
[auth.oauth]
enabled = true
provider = "custom"
client_id = "sirrchat"
client_secret = "secret"

모범 사례 ​

  1. 항상 TLS 사용: 인증 자격 증명 전송 암호화
  2. MFA 활성화: 계정 보안 향상
  3. 정기적인 키 교체: API 키 및 비밀번호 업데이트
  4. 이상 징후 모니터링: 알림 설정
  5. 최소 권한 원칙: 필요한 권한만 부여

관련 문서:

Released under the GPL 3.0 License.