mirror of
https://github.com/minio/minio.git
synced 2025-04-23 20:05:55 -04:00
Add common validation for compression and encryption (#7978)
This commit is contained in:
parent
efb8b00db0
commit
007a52b546
@ -38,6 +38,25 @@ import (
|
|||||||
xnet "github.com/minio/minio/pkg/net"
|
xnet "github.com/minio/minio/pkg/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func verifyObjectLayerFeatures(name string, objAPI ObjectLayer) {
|
||||||
|
if (globalAutoEncryption || GlobalKMS != nil) && !objAPI.IsEncryptionSupported() {
|
||||||
|
logger.Fatal(errInvalidArgument,
|
||||||
|
"Encryption support is requested but '%s' does not support encryption", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(name, "gateway") {
|
||||||
|
if GlobalGatewaySSE.IsSet() && GlobalKMS == nil {
|
||||||
|
uiErr := uiErrInvalidGWSSEEnvValue(nil).Msg("MINIO_GATEWAY_SSE set but KMS is not configured")
|
||||||
|
logger.Fatal(uiErr, "Unable to start gateway with SSE")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if globalIsCompressionEnabled && !objAPI.IsCompressionSupported() {
|
||||||
|
logger.Fatal(errInvalidArgument,
|
||||||
|
"Compression support is requested but '%s' does not support compression", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for updates and print a notification message
|
// Check for updates and print a notification message
|
||||||
func checkUpdate(mode string) {
|
func checkUpdate(mode string) {
|
||||||
// Its OK to ignore any errors during doUpdate() here.
|
// Its OK to ignore any errors during doUpdate() here.
|
||||||
|
@ -278,23 +278,14 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
|
|
||||||
// Create new notification system.
|
// Create new notification system.
|
||||||
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints)
|
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints)
|
||||||
if globalEtcdClient != nil && newObject.IsNotificationSupported() {
|
if enableConfigOps && newObject.IsNotificationSupported() {
|
||||||
logger.LogIf(context.Background(), globalNotificationSys.Init(newObject))
|
logger.LogIf(context.Background(), globalNotificationSys.Init(newObject))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encryption support checks in gateway mode.
|
// Verify if object layer supports
|
||||||
{
|
// - encryption
|
||||||
|
// - compression
|
||||||
if (globalAutoEncryption || GlobalKMS != nil) && !newObject.IsEncryptionSupported() {
|
verifyObjectLayerFeatures("gateway "+gatewayName, newObject)
|
||||||
logger.Fatal(errInvalidArgument,
|
|
||||||
"Encryption support is requested but (%s) gateway does not support encryption", gw.Name())
|
|
||||||
}
|
|
||||||
|
|
||||||
if GlobalGatewaySSE.IsSet() && GlobalKMS == nil {
|
|
||||||
logger.Fatal(uiErrInvalidGWSSEEnvValue(nil).Msg("MINIO_GATEWAY_SSE set but KMS is not configured"),
|
|
||||||
"Unable to start gateway with SSE")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Once endpoints are finalized, initialize the new object api.
|
// Once endpoints are finalized, initialize the new object api.
|
||||||
globalObjLayerMutex.Lock()
|
globalObjLayerMutex.Lock()
|
||||||
|
@ -19,7 +19,6 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -380,9 +379,11 @@ func serverMain(ctx *cli.Context) {
|
|||||||
if err = globalNotificationSys.Init(newObject); err != nil {
|
if err = globalNotificationSys.Init(newObject); err != nil {
|
||||||
logger.LogIf(context.Background(), err)
|
logger.LogIf(context.Background(), err)
|
||||||
}
|
}
|
||||||
if globalAutoEncryption && !newObject.IsEncryptionSupported() {
|
|
||||||
logger.Fatal(errors.New("Invalid KMS configuration"), "auto-encryption is enabled but server does not support encryption")
|
// Verify if object layer supports
|
||||||
}
|
// - encryption
|
||||||
|
// - compression
|
||||||
|
verifyObjectLayerFeatures("server", newObject)
|
||||||
|
|
||||||
if globalIsXL {
|
if globalIsXL {
|
||||||
initBackgroundHealing()
|
initBackgroundHealing()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user