--- title: SFTPGo (SFTP/SSH 서버) updated: 2026-03-27 tags: [infra, sftp, ssh, k3s] --- ## 개요 SFTPGo - 고객용 SFTP/SSH/WebDAV 서버. 사용자 관리, 키 관리, 웹 파일 관리 UI 내장. ## 배포 정보 K3s 클러스터(kr3 컨텍스트)에 Helm으로 설치 (2026-03-27) | 항목 | 값 | |------|-----| | Namespace | sftpgo | | Chart | oci://ghcr.io/sftpgo/helm-charts/sftpgo 0.44.0 | | App | SFTPGo 2.7.1 | | SFTP | LoadBalancer 192.168.9.55:22 | | Web UI | 8080 (Traefik HTTPRoute 경유) | | 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) | ## 외부 접근 경로 ### 웹 UI (HTTPS) ``` sftp.inouter.com → Cloudflare (proxied) → 220.120.65.245 → OpenWrt HAProxy :443 → Traefik 192.168.9.53:443 → HTTPRoute → SFTPGo 8080 ``` ### SFTP (포트 22) ``` sftp.inouter.com:22 (또는 52.79.45.166:22) → relay4wd:22 → iptables REDIRECT :9022 → APISIX stream_route → 192.168.9.55:22 → SFTPGo Pod ``` ## 웹 UI | URL | 용도 | |-----|------| | 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":{"/":["*"]}, "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}}}' ``` ## 관련 문서 - [[apisix]] - relay4wd stream_route로 SFTP 포워딩 - [[sshpiper]] - SSH 리버스 프록시 (내부 서버 접근용) - [[teleport]] - 관리자 SSH/K8s 접근 관리