SFTPGo: R2 백엔드, token_validation/proxy_allowed 설정, API 사용법 추가
This commit is contained in:
@@ -19,7 +19,9 @@ K3s 클러스터(kr3 컨텍스트)에 Helm으로 설치 (2026-03-27)
|
||||
| App | SFTPGo 2.7.1 |
|
||||
| SFTP | LoadBalancer 192.168.9.55:22 |
|
||||
| Web UI | 8080 (Traefik HTTPRoute 경유) |
|
||||
| Storage | Longhorn 1Gi (SQLite DB) |
|
||||
| Storage (DB) | Longhorn 1Gi (SQLite) |
|
||||
| Storage (파일) | R2 `sftpgo-storage` 버킷 (APAC), 사용자별 S3 filesystem |
|
||||
| R2 API 키 | Vault `secret/cloud/r2-sftpgo` |
|
||||
| 관리자 | Vault `secret/apps/sftpgo` (admin_user, admin_password) |
|
||||
|
||||
## 외부 접근 경로
|
||||
@@ -46,20 +48,47 @@ sftp.inouter.com:22 (또는 52.79.45.166:22)
|
||||
| https://sftp.inouter.com/web/admin | 관리자 - 사용자/설정 관리 |
|
||||
| https://sftp.inouter.com/web/client | 고객 - 파일 업로드/다운로드, 패스워드 변경 |
|
||||
|
||||
## R2 백엔드 설정
|
||||
|
||||
사용자별 S3 filesystem으로 R2에 파일 저장. 고객이 SFTP로 업로드하면 R2에 직접 저장됨.
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|-----|
|
||||
| 버킷 | `sftpgo-storage` (APAC) |
|
||||
| 엔드포인트 | `https://d8e5997eb4040f8b489f09095c0f623c.r2.cloudflarestorage.com` |
|
||||
| API 키 | Vault `secret/cloud/r2-sftpgo` (access_key_id, secret_access_key) |
|
||||
| 사용자별 경로 | `key_prefix: {username}/` |
|
||||
| provider | 1 (S3) |
|
||||
|
||||
사용자 생성 시 filesystem.provider를 1로 설정하고 s3config에 위 정보를 넣으면 됨.
|
||||
|
||||
## 주요 설정
|
||||
|
||||
| 설정 | 값 | 이유 |
|
||||
|------|-----|------|
|
||||
| `token_validation` | 1 (IP 바인딩 없음) | Cloudflare proxy 경유 시 IP 변동으로 토큰 거부 방지 |
|
||||
| `proxy_allowed` | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Traefik → SFTPGo 프록시 헤더 신뢰 |
|
||||
|
||||
## API
|
||||
|
||||
```bash
|
||||
# 토큰 발급
|
||||
# 토큰 발급 (패스워드: Vault secret/apps/sftpgo)
|
||||
TOKEN=$(curl -s https://sftp.inouter.com/api/v2/token -u 'kaffa:패스워드' | jq -r .access_token)
|
||||
|
||||
# 사용자 목록
|
||||
curl -s -H "Authorization: Bearer $TOKEN" https://sftp.inouter.com/api/v2/users
|
||||
|
||||
# 사용자 생성
|
||||
# 사용자 생성 (R2 백엔드)
|
||||
curl -s -X POST https://sftp.inouter.com/api/v2/users \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"username":"user1","password":"pass","status":1,"home_dir":"/srv/sftpgo/data/user1","permissions":{"/":["*"]}}'
|
||||
-d '{"username":"user1","password":"pass","status":1,"home_dir":"/srv/sftpgo/data/user1","permissions":{"/":["*"]},
|
||||
"filesystem":{"provider":1,"s3config":{
|
||||
"bucket":"sftpgo-storage","region":"auto",
|
||||
"access_key":"(Vault에서 확인)",
|
||||
"access_secret":{"status":"Plain","payload":"(Vault에서 확인)"},
|
||||
"endpoint":"https://d8e5997eb4040f8b489f09095c0f623c.r2.cloudflarestorage.com",
|
||||
"key_prefix":"user1/","force_path_style":true}}}'
|
||||
```
|
||||
|
||||
## 관련 문서
|
||||
|
||||
Reference in New Issue
Block a user