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

セッションストレージ ​

  • メモリ: 高速だが永続化されない
  • Redis: 分散セッション管理
  • データベース: 永続ストレージ
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.