mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
mini: bind Admin and WebDAV to -ip.bind by default (#12971)
weed mini is a single-host sandbox whose other components already listen on -ip.bind without authentication. Moving the unauthenticated Admin UI and WebDAV to loopback broke setups that open them from another machine on a private network. -admin.allowInsecureBind and -webdav.allowInsecureBind now default to true; set them to false to keep an unauthenticated Admin or WebDAV on loopback. The Admin worker gRPC control plane still defaults to loopback. Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1
This commit is contained in:
1 parent
85fcde9b0d
commit
e22704d25e
3 files changed
+19
-5
No files matched your search
@@ -87,7 +87,7 @@ AWS_ACCESS_KEY_ID=admin AWS_SECRET_ACCESS_KEY=secret \
|
||||
|
||||
The same process also runs the master, a volume server, the filer, WebDAV, the Iceberg REST catalog, and the Admin UI. Add `S3_TABLE_BUCKET=warehouse` to also create an Iceberg table bucket, or `warehouse:LANCE` for a Lance one. Drop the AWS keys to run without authentication for development.
|
||||
|
||||
Without Admin authentication or mTLS, `weed mini` binds the Admin UI/API and its worker gRPC control plane to loopback rather than `-ip.bind`. Set `WEED_ADMIN_PASSWORD` or configure `https.admin` mTLS to keep the network bind. Remote workers must opt in with `-admin.worker.ip=<address>` and should configure `grpc.admin` mTLS. `-admin.allowInsecureBind` restores the legacy unauthenticated network bind and should only be used on an isolated network.
|
||||
`weed mini` binds the Admin UI/API and WebDAV to `-ip.bind` like its other components, even without authentication, so use it on a trusted network or set `WEED_ADMIN_PASSWORD` or `https.admin` mTLS. Pass `-admin.allowInsecureBind=false` or `-webdav.allowInsecureBind=false` to keep an unauthenticated Admin or WebDAV on loopback. The Admin worker gRPC control plane stays on loopback; remote workers must opt in with `-admin.worker.ip=<address>` and should configure `grpc.admin` mTLS.
|
||||
|
||||
> macOS: if the binary is quarantined, run `xattr -d com.apple.quarantine ./weed` first.
|
||||
|
||||
|
||||
@@ -595,7 +595,7 @@ func initMiniWebDAVFlags() {
|
||||
miniWebDavOptions.maxMB = cmdMini.Flag.Int("webdav.maxMB", 4, "split files larger than the limit")
|
||||
miniWebDavOptions.filerRootPath = cmdMini.Flag.String("webdav.filer.path", "/", "use this remote path from filer server")
|
||||
miniWebDavOptions.idleTimeout = cmdMini.Flag.Int("webdav.idleTimeout", 10, "connection idle seconds")
|
||||
miniWebDavAllowInsecureBind = cmdMini.Flag.Bool("webdav.allowInsecureBind", false, "INSECURE: allow WebDAV without [webdav.basic_auth] to bind to -ip.bind instead of loopback")
|
||||
miniWebDavAllowInsecureBind = cmdMini.Flag.Bool("webdav.allowInsecureBind", true, "INSECURE: allow WebDAV without [webdav.basic_auth] to bind to -ip.bind; set to false to keep it on loopback")
|
||||
}
|
||||
|
||||
// initMiniAdminFlags initializes Admin server flag options
|
||||
@@ -611,7 +611,7 @@ func initMiniAdminFlags() {
|
||||
miniAdminOptions.adminPassword = cmdMini.Flag.String("admin.password", "", "admin interface password (if empty, auth is disabled)")
|
||||
miniAdminOptions.readOnlyUser = cmdMini.Flag.String("admin.readOnlyUser", "", "read-only user username (optional, for view-only access)")
|
||||
miniAdminOptions.readOnlyPassword = cmdMini.Flag.String("admin.readOnlyPassword", "", "read-only user password (optional, for view-only access; requires admin.password to be set)")
|
||||
miniAdminOptions.allowInsecureBind = cmdMini.Flag.Bool("admin.allowInsecureBind", false, "INSECURE: allow the unauthenticated admin interface to bind to -ip.bind instead of loopback")
|
||||
miniAdminOptions.allowInsecureBind = cmdMini.Flag.Bool("admin.allowInsecureBind", true, "INSECURE: allow the unauthenticated admin interface to bind to -ip.bind; set to false to keep it on loopback")
|
||||
miniAdminWorkerBindIP = cmdMini.Flag.String("admin.worker.ip", "127.0.0.1", "worker gRPC bind address; expose only with grpc.admin mTLS configured")
|
||||
miniAdminOptions.urlPrefix = cmdMini.Flag.String("admin.urlPrefix", "", "URL path prefix when running the admin UI behind a reverse proxy under a subdirectory (e.g. /seaweedfs)")
|
||||
miniAdminOptions.uploadMaxSizeMB = cmdMini.Flag.Int("admin.uploadMaxSizeMB", dash.DefaultUploadMaxSizeMB, "maximum total size in MB of one file browser upload (0 for no limit)")
|
||||
@@ -1935,7 +1935,7 @@ func applyMiniAdminCredentialFallback(options *AdminOptions) {
|
||||
}
|
||||
|
||||
// miniAdminBindIP selects a loopback HTTP bind unless Admin authentication,
|
||||
// mTLS, or an explicit insecure opt-out permits the requested address.
|
||||
// mTLS, or allowInsecure (mini's default) permits the requested address.
|
||||
func miniAdminBindIP(requestedIP string, passwordConfigured, mtlsConfigured, allowInsecure bool) string {
|
||||
if isLoopbackIp(requestedIP) || passwordConfigured || mtlsConfigured || allowInsecure {
|
||||
return requestedIP
|
||||
@@ -1944,7 +1944,7 @@ func miniAdminBindIP(requestedIP string, passwordConfigured, mtlsConfigured, all
|
||||
}
|
||||
|
||||
// miniWebDavBindIP keeps WebDAV on loopback unless [webdav.basic_auth] or
|
||||
// -webdav.allowInsecureBind permits the requested address.
|
||||
// -webdav.allowInsecureBind (the default) permits the requested address.
|
||||
func miniWebDavBindIP(requestedIP string) string {
|
||||
return miniAdminBindIP(requestedIP, webDavBasicAuth() != nil, false, *miniWebDavAllowInsecureBind)
|
||||
}
|
||||
|
||||
@@ -31,3 +31,17 @@ func TestMiniWebDavBindIP(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// mini is a single-host sandbox, so its unauthenticated Admin and WebDAV
|
||||
// listen on -ip.bind like every other component unless an operator opts out.
|
||||
func TestMiniAllowsInsecureBindByDefault(t *testing.T) {
|
||||
for name, flag := range map[string]string{"admin": "admin.allowInsecureBind", "webdav": "webdav.allowInsecureBind"} {
|
||||
f := cmdMini.Flag.Lookup(flag)
|
||||
if f == nil {
|
||||
t.Fatalf("%s: flag -%s is not defined", name, flag)
|
||||
}
|
||||
if f.DefValue != "true" {
|
||||
t.Fatalf("%s: -%s defaults to %s, want true", name, flag, f.DefValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user