Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

volume server directly support https

Chris Lu7bbe24dd2857
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go
index cb0a726cef..9e45d73813 100644
--- a/weed/command/scaffold.go
+++ b/weed/command/scaffold.go
@@ -255,8 +255,6 @@ directory = "/" # destination directory
[jwt.signing]
key = ""
-# volume server also uses grpc that should be secured.
-
# all grpc tls authentications are mutual
# the values for the following ca, cert, and key are paths to the PERM files.
[grpc]
@@ -280,5 +278,16 @@ key = ""
cert = ""
key = ""
+
+# volume server https options
+# Note: work in progress!
+# this does not work with other clients, e.g., "weed filer|mount" etc, yet.
+[https.client]
+enabled = true
+[https.volume]
+cert = ""
+key = ""
+
+
`
)
diff --git a/weed/command/volume.go b/weed/command/volume.go
index 32ec7819bc..2ee6bb11ad 100644
--- a/weed/command/volume.go
+++ b/weed/command/volume.go
@@ -195,8 +195,15 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
reflection.Register(grpcS)
go grpcS.Serve(grpcL)
- if e := http.Serve(listener, volumeMux); e != nil {
- glog.Fatalf("Volume server fail to serve: %v", e)
+ if viper.GetString("https.volume.key") != "" {
+ if e := http.ServeTLS(listener, volumeMux,
+ viper.GetString("https.volume.cert"), viper.GetString("https.volume.key")); e != nil {
+ glog.Fatalf("Volume server fail to serve: %v", e)
+ }
+ } else {
+ if e := http.Serve(listener, volumeMux); e != nil {
+ glog.Fatalf("Volume server fail to serve: %v", e)
+ }
}
}