2021-04-18 15:41:13 -04:00
|
|
|
// Copyright (c) 2015-2021 MinIO, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of MinIO Object Storage stack
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
|
2016-08-18 19:23:42 -04:00
|
|
|
package cmd
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
|
|
|
|
import (
|
2020-12-04 12:32:35 -05:00
|
|
|
"context"
|
2021-04-22 11:45:30 -04:00
|
|
|
"errors"
|
2019-12-04 18:32:37 -05:00
|
|
|
"fmt"
|
2019-10-08 01:47:56 -04:00
|
|
|
"strings"
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
"sync"
|
|
|
|
|
2023-06-19 20:53:08 -04:00
|
|
|
"github.com/minio/madmin-go/v3"
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/config"
|
|
|
|
"github.com/minio/minio/internal/config/api"
|
|
|
|
"github.com/minio/minio/internal/config/cache"
|
2022-06-06 19:14:52 -04:00
|
|
|
"github.com/minio/minio/internal/config/callhome"
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/config/compress"
|
|
|
|
"github.com/minio/minio/internal/config/dns"
|
|
|
|
"github.com/minio/minio/internal/config/etcd"
|
|
|
|
"github.com/minio/minio/internal/config/heal"
|
|
|
|
xldap "github.com/minio/minio/internal/config/identity/ldap"
|
|
|
|
"github.com/minio/minio/internal/config/identity/openid"
|
2022-05-26 20:58:09 -04:00
|
|
|
idplugin "github.com/minio/minio/internal/config/identity/plugin"
|
2021-09-07 22:03:48 -04:00
|
|
|
xtls "github.com/minio/minio/internal/config/identity/tls"
|
2023-03-07 11:12:41 -05:00
|
|
|
"github.com/minio/minio/internal/config/lambda"
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/config/notify"
|
|
|
|
"github.com/minio/minio/internal/config/policy/opa"
|
2022-05-10 20:14:55 -04:00
|
|
|
polplugin "github.com/minio/minio/internal/config/policy/plugin"
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/config/scanner"
|
|
|
|
"github.com/minio/minio/internal/config/storageclass"
|
2021-09-15 00:54:25 -04:00
|
|
|
"github.com/minio/minio/internal/config/subnet"
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/crypto"
|
|
|
|
xhttp "github.com/minio/minio/internal/http"
|
|
|
|
"github.com/minio/minio/internal/kms"
|
|
|
|
"github.com/minio/minio/internal/logger"
|
2021-05-28 18:17:01 -04:00
|
|
|
"github.com/minio/pkg/env"
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
)
|
|
|
|
|
2019-12-04 18:32:37 -05:00
|
|
|
func initHelp() {
|
2022-01-02 12:15:06 -05:00
|
|
|
kvs := map[string]config.KVS{
|
2019-11-27 12:36:08 -05:00
|
|
|
config.EtcdSubSys: etcd.DefaultKVS,
|
|
|
|
config.CacheSubSys: cache.DefaultKVS,
|
|
|
|
config.CompressionSubSys: compress.DefaultKVS,
|
|
|
|
config.IdentityLDAPSubSys: xldap.DefaultKVS,
|
|
|
|
config.IdentityOpenIDSubSys: openid.DefaultKVS,
|
2021-09-07 22:03:48 -04:00
|
|
|
config.IdentityTLSSubSys: xtls.DefaultKVS,
|
2022-05-26 20:58:09 -04:00
|
|
|
config.IdentityPluginSubSys: idplugin.DefaultKVS,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.PolicyOPASubSys: opa.DefaultKVS,
|
2022-05-10 20:14:55 -04:00
|
|
|
config.PolicyPluginSubSys: polplugin.DefaultKVS,
|
2021-11-25 16:06:25 -05:00
|
|
|
config.SiteSubSys: config.DefaultSiteKVS,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.RegionSubSys: config.DefaultRegionKVS,
|
2020-04-14 15:46:37 -04:00
|
|
|
config.APISubSys: api.DefaultKVS,
|
2021-12-20 16:16:53 -05:00
|
|
|
config.LoggerWebhookSubSys: logger.DefaultLoggerWebhookKVS,
|
2021-07-13 12:39:13 -04:00
|
|
|
config.AuditWebhookSubSys: logger.DefaultAuditWebhookKVS,
|
|
|
|
config.AuditKafkaSubSys: logger.DefaultAuditKafkaKVS,
|
2021-02-17 15:04:11 -05:00
|
|
|
config.ScannerSubSys: scanner.DefaultKVS,
|
2021-09-15 00:54:25 -04:00
|
|
|
config.SubnetSubSys: subnet.DefaultKVS,
|
2022-06-06 19:14:52 -04:00
|
|
|
config.CallhomeSubSys: callhome.DefaultKVS,
|
2019-11-27 12:36:08 -05:00
|
|
|
}
|
|
|
|
for k, v := range notify.DefaultNotificationKVS {
|
|
|
|
kvs[k] = v
|
|
|
|
}
|
2023-03-07 11:12:41 -05:00
|
|
|
for k, v := range lambda.DefaultLambdaKVS {
|
|
|
|
kvs[k] = v
|
|
|
|
}
|
2020-06-12 23:04:01 -04:00
|
|
|
if globalIsErasure {
|
2019-12-04 18:32:37 -05:00
|
|
|
kvs[config.StorageClassSubSys] = storageclass.DefaultKVS
|
2022-09-26 12:04:54 -04:00
|
|
|
kvs[config.HealSubSys] = heal.DefaultKVS
|
2019-12-04 18:32:37 -05:00
|
|
|
}
|
2019-11-27 12:36:08 -05:00
|
|
|
config.RegisterDefaultKVS(kvs)
|
|
|
|
|
|
|
|
// Captures help for each sub-system
|
2022-01-02 12:15:06 -05:00
|
|
|
helpSubSys := config.HelpKVS{
|
2022-12-01 10:50:08 -05:00
|
|
|
config.HelpKV{
|
|
|
|
Key: config.SubnetSubSys,
|
|
|
|
Type: "string",
|
|
|
|
Description: "register the cluster to MinIO SUBNET",
|
|
|
|
Optional: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.CallhomeSubSys,
|
|
|
|
Type: "string",
|
|
|
|
Description: "enable callhome to MinIO SUBNET",
|
|
|
|
Optional: true,
|
|
|
|
},
|
2019-11-27 12:36:08 -05:00
|
|
|
config.HelpKV{
|
2021-11-25 16:06:25 -05:00
|
|
|
Key: config.SiteSubSys,
|
|
|
|
Description: "label the server and its location",
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
|
|
|
config.HelpKV{
|
2022-12-01 10:50:08 -05:00
|
|
|
Key: config.APISubSys,
|
|
|
|
Description: "manage global HTTP API call specific features, such as throttling, authentication types, etc.",
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
|
|
|
config.HelpKV{
|
2022-12-01 10:50:08 -05:00
|
|
|
Key: config.ScannerSubSys,
|
|
|
|
Description: "manage namespace scanning for usage calculation, lifecycle, healing and more",
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
|
|
|
config.HelpKV{
|
2022-12-01 10:50:08 -05:00
|
|
|
Key: config.CompressionSubSys,
|
|
|
|
Description: "enable server side compression of objects",
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
|
|
|
config.HelpKV{
|
2022-04-28 21:27:09 -04:00
|
|
|
Key: config.IdentityOpenIDSubSys,
|
|
|
|
Description: "enable OpenID SSO support",
|
|
|
|
MultipleTargets: true,
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.IdentityLDAPSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "enable LDAP SSO support",
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
2021-09-07 22:03:48 -04:00
|
|
|
config.HelpKV{
|
|
|
|
Key: config.IdentityTLSSubSys,
|
|
|
|
Description: "enable X.509 TLS certificate SSO support",
|
|
|
|
},
|
2022-05-26 20:58:09 -04:00
|
|
|
config.HelpKV{
|
|
|
|
Key: config.IdentityPluginSubSys,
|
|
|
|
Description: "enable Identity Plugin via external hook",
|
|
|
|
},
|
2019-11-27 12:36:08 -05:00
|
|
|
config.HelpKV{
|
2022-05-10 20:14:55 -04:00
|
|
|
Key: config.PolicyPluginSubSys,
|
|
|
|
Description: "enable Access Management Plugin for policy enforcement",
|
2019-11-27 12:36:08 -05:00
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.LoggerWebhookSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "send server logs to webhook endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.AuditWebhookSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "send audit logs to webhook endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
2021-07-13 12:39:13 -04:00
|
|
|
config.HelpKV{
|
|
|
|
Key: config.AuditKafkaSubSys,
|
|
|
|
Description: "send audit logs to kafka endpoints",
|
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
2019-11-27 12:36:08 -05:00
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyWebhookSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "publish bucket notifications to webhook endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyAMQPSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "publish bucket notifications to AMQP endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyKafkaSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "publish bucket notifications to Kafka endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyMQTTSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "publish bucket notifications to MQTT endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyNATSSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "publish bucket notifications to NATS endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyNSQSubSys,
|
2019-12-04 18:32:37 -05:00
|
|
|
Description: "publish bucket notifications to NSQ endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyMySQLSubSys,
|
2019-12-06 16:53:51 -05:00
|
|
|
Description: "publish bucket notifications to MySQL databases",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
|
|
|
Key: config.NotifyPostgresSubSys,
|
2019-12-06 16:53:51 -05:00
|
|
|
Description: "publish bucket notifications to Postgres databases",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
2019-12-06 16:53:51 -05:00
|
|
|
Key: config.NotifyESSubSys,
|
|
|
|
Description: "publish bucket notifications to Elasticsearch endpoints",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
|
|
|
config.HelpKV{
|
2019-12-06 16:53:51 -05:00
|
|
|
Key: config.NotifyRedisSubSys,
|
|
|
|
Description: "publish bucket notifications to Redis datastores",
|
2019-11-27 12:36:08 -05:00
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
2023-03-07 11:12:41 -05:00
|
|
|
config.HelpKV{
|
|
|
|
Key: config.LambdaWebhookSubSys,
|
|
|
|
Description: "manage remote lambda functions",
|
|
|
|
MultipleTargets: true,
|
|
|
|
},
|
2021-09-15 00:54:25 -04:00
|
|
|
config.HelpKV{
|
2022-12-01 10:50:08 -05:00
|
|
|
Key: config.EtcdSubSys,
|
|
|
|
Description: "persist IAM assets externally to etcd",
|
2021-09-15 00:54:25 -04:00
|
|
|
},
|
2022-06-06 19:14:52 -04:00
|
|
|
config.HelpKV{
|
2022-12-01 10:50:08 -05:00
|
|
|
Key: config.CacheSubSys,
|
|
|
|
Description: "[DEPRECATED] add caching storage tier",
|
2022-06-06 19:14:52 -04:00
|
|
|
},
|
2019-11-27 12:36:08 -05:00
|
|
|
}
|
|
|
|
|
2020-06-12 23:04:01 -04:00
|
|
|
if globalIsErasure {
|
2022-09-26 12:04:54 -04:00
|
|
|
helpSubSys = append(helpSubSys, config.HelpKV{
|
2019-12-04 18:32:37 -05:00
|
|
|
Key: config.StorageClassSubSys,
|
|
|
|
Description: "define object level redundancy",
|
2022-09-26 12:04:54 -04:00
|
|
|
}, config.HelpKV{
|
|
|
|
Key: config.HealSubSys,
|
|
|
|
Description: "manage object healing frequency and bitrot verification checks",
|
|
|
|
})
|
2019-12-04 18:32:37 -05:00
|
|
|
}
|
|
|
|
|
2022-01-02 12:15:06 -05:00
|
|
|
helpMap := map[string]config.HelpKVS{
|
2019-11-27 12:36:08 -05:00
|
|
|
"": helpSubSys, // Help for all sub-systems.
|
2021-11-25 16:06:25 -05:00
|
|
|
config.SiteSubSys: config.SiteHelp,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.RegionSubSys: config.RegionHelp,
|
2020-04-14 15:46:37 -04:00
|
|
|
config.APISubSys: api.Help,
|
2019-12-04 18:32:37 -05:00
|
|
|
config.StorageClassSubSys: storageclass.Help,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.EtcdSubSys: etcd.Help,
|
|
|
|
config.CacheSubSys: cache.Help,
|
|
|
|
config.CompressionSubSys: compress.Help,
|
2020-10-14 16:51:51 -04:00
|
|
|
config.HealSubSys: heal.Help,
|
2021-02-17 15:04:11 -05:00
|
|
|
config.ScannerSubSys: scanner.Help,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.IdentityOpenIDSubSys: openid.Help,
|
|
|
|
config.IdentityLDAPSubSys: xldap.Help,
|
2021-09-07 22:03:48 -04:00
|
|
|
config.IdentityTLSSubSys: xtls.Help,
|
2022-05-26 20:58:09 -04:00
|
|
|
config.IdentityPluginSubSys: idplugin.Help,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.PolicyOPASubSys: opa.Help,
|
2022-05-10 20:14:55 -04:00
|
|
|
config.PolicyPluginSubSys: polplugin.Help,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.LoggerWebhookSubSys: logger.Help,
|
2021-07-13 12:39:13 -04:00
|
|
|
config.AuditWebhookSubSys: logger.HelpWebhook,
|
|
|
|
config.AuditKafkaSubSys: logger.HelpKafka,
|
2019-11-27 12:36:08 -05:00
|
|
|
config.NotifyAMQPSubSys: notify.HelpAMQP,
|
|
|
|
config.NotifyKafkaSubSys: notify.HelpKafka,
|
|
|
|
config.NotifyMQTTSubSys: notify.HelpMQTT,
|
|
|
|
config.NotifyNATSSubSys: notify.HelpNATS,
|
|
|
|
config.NotifyNSQSubSys: notify.HelpNSQ,
|
|
|
|
config.NotifyMySQLSubSys: notify.HelpMySQL,
|
|
|
|
config.NotifyPostgresSubSys: notify.HelpPostgres,
|
|
|
|
config.NotifyRedisSubSys: notify.HelpRedis,
|
|
|
|
config.NotifyWebhookSubSys: notify.HelpWebhook,
|
|
|
|
config.NotifyESSubSys: notify.HelpES,
|
2023-03-07 11:12:41 -05:00
|
|
|
config.LambdaWebhookSubSys: lambda.HelpWebhook,
|
2021-12-03 12:32:11 -05:00
|
|
|
config.SubnetSubSys: subnet.HelpSubnet,
|
2022-06-06 19:14:52 -04:00
|
|
|
config.CallhomeSubSys: callhome.HelpCallhome,
|
2019-11-27 12:36:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
config.RegisterHelpSubSys(helpMap)
|
2021-11-25 16:06:25 -05:00
|
|
|
|
|
|
|
// save top-level help for deprecated sub-systems in a separate map.
|
|
|
|
deprecatedHelpKVMap := map[string]config.HelpKV{
|
|
|
|
config.RegionSubSys: {
|
|
|
|
Key: config.RegionSubSys,
|
|
|
|
Description: "[DEPRECATED - use `site` instead] label the location of the server",
|
|
|
|
},
|
2022-05-10 20:14:55 -04:00
|
|
|
config.PolicyOPASubSys: {
|
|
|
|
Key: config.PolicyOPASubSys,
|
|
|
|
Description: "[DEPRECATED - use `policy_plugin` instead] enable external OPA for policy enforcement",
|
|
|
|
},
|
2021-11-25 16:06:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
config.RegisterHelpDeprecatedSubSys(deprecatedHelpKVMap)
|
2019-11-27 12:36:08 -05:00
|
|
|
}
|
|
|
|
|
2017-03-31 01:26:24 -04:00
|
|
|
var (
|
2017-11-29 16:12:47 -05:00
|
|
|
// globalServerConfig server config.
|
2019-10-23 01:59:13 -04:00
|
|
|
globalServerConfig config.Config
|
2017-11-29 16:12:47 -05:00
|
|
|
globalServerConfigMu sync.RWMutex
|
2017-03-31 01:26:24 -04:00
|
|
|
)
|
|
|
|
|
2023-05-25 01:57:37 -04:00
|
|
|
func validateSubSysConfig(ctx context.Context, s config.Config, subSys string, objAPI ObjectLayer) error {
|
2022-02-08 13:36:41 -05:00
|
|
|
switch subSys {
|
|
|
|
case config.SiteSubSys:
|
|
|
|
if _, err := config.LookupSite(s[config.SiteSubSys][config.Default], s[config.RegionSubSys][config.Default]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
case config.APISubSys:
|
|
|
|
if _, err := api.LookupConfig(s[config.APISubSys][config.Default]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
case config.StorageClassSubSys:
|
2022-09-26 12:04:54 -04:00
|
|
|
if objAPI == nil {
|
|
|
|
return errServerNotInitialized
|
|
|
|
}
|
|
|
|
for _, setDriveCount := range objAPI.SetDriveCounts() {
|
|
|
|
if _, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount); err != nil {
|
|
|
|
return err
|
2021-01-22 15:09:24 -05:00
|
|
|
}
|
2018-08-19 16:57:18 -04:00
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
case config.CacheSubSys:
|
|
|
|
if _, err := cache.LookupConfig(s[config.CacheSubSys][config.Default]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
case config.CompressionSubSys:
|
2023-01-17 09:07:47 -05:00
|
|
|
if _, err := compress.LookupConfig(s[config.CompressionSubSys][config.Default]); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
2020-12-04 12:32:35 -05:00
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
case config.HealSubSys:
|
|
|
|
if _, err := heal.LookupConfig(s[config.HealSubSys][config.Default]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
case config.ScannerSubSys:
|
|
|
|
if _, err := scanner.LookupConfig(s[config.ScannerSubSys][config.Default]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
case config.EtcdSubSys:
|
2019-11-09 12:27:23 -05:00
|
|
|
etcdCfg, err := etcd.LookupConfig(s[config.EtcdSubSys][config.Default], globalRootCAs)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if etcdCfg.Enabled {
|
|
|
|
etcdClnt, err := etcd.New(etcdCfg)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
etcdClnt.Close()
|
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
case config.IdentityOpenIDSubSys:
|
2022-06-17 14:39:21 -04:00
|
|
|
if _, err := openid.LookupConfig(s,
|
2022-10-24 20:44:15 -04:00
|
|
|
NewHTTPTransport(), xhttp.DrainBody, globalSite.Region); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
case config.IdentityLDAPSubSys:
|
2022-10-08 01:12:36 -04:00
|
|
|
cfg, err := xldap.Lookup(s, globalRootCAs)
|
2020-03-22 01:47:26 -04:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-10-08 01:12:36 -04:00
|
|
|
if cfg.Enabled() {
|
|
|
|
conn, cerr := cfg.LDAP.Connect()
|
2020-03-22 01:47:26 -04:00
|
|
|
if cerr != nil {
|
|
|
|
return cerr
|
|
|
|
}
|
|
|
|
conn.Close()
|
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
case config.IdentityTLSSubSys:
|
|
|
|
if _, err := xtls.Lookup(s[config.IdentityTLSSubSys][config.Default]); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-05-26 20:58:09 -04:00
|
|
|
case config.IdentityPluginSubSys:
|
|
|
|
if _, err := idplugin.LookupConfig(s[config.IdentityPluginSubSys][config.Default],
|
2022-10-24 20:44:15 -04:00
|
|
|
NewHTTPTransport(), xhttp.DrainBody, globalSite.Region); err != nil {
|
2022-05-26 20:58:09 -04:00
|
|
|
return err
|
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
case config.SubnetSubSys:
|
2022-06-27 06:58:25 -04:00
|
|
|
if _, err := subnet.LookupConfig(s[config.SubnetSubSys][config.Default], nil); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
|
|
|
}
|
2022-06-06 19:14:52 -04:00
|
|
|
case config.CallhomeSubSys:
|
2022-10-27 03:20:01 -04:00
|
|
|
cfg, err := callhome.LookupConfig(s[config.CallhomeSubSys][config.Default])
|
|
|
|
if err != nil {
|
2022-06-06 19:14:52 -04:00
|
|
|
return err
|
|
|
|
}
|
2022-10-27 03:20:01 -04:00
|
|
|
// callhome cannot be enabled if license is not registered yet, throw an error.
|
|
|
|
if cfg.Enabled() && !globalSubnetConfig.Registered() {
|
|
|
|
return errors.New("Deployment is not registered with SUBNET. Please register the deployment via 'mc license register ALIAS'")
|
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
case config.PolicyOPASubSys:
|
2022-05-10 20:14:55 -04:00
|
|
|
// In case legacy OPA config is being set, we treat it as if the
|
|
|
|
// AuthZPlugin is being set.
|
|
|
|
subSys = config.PolicyPluginSubSys
|
|
|
|
fallthrough
|
|
|
|
case config.PolicyPluginSubSys:
|
2022-12-13 17:28:48 -05:00
|
|
|
if ppargs, err := polplugin.LookupConfig(s, GetDefaultConnSettings(), xhttp.DrainBody); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
2022-05-10 20:14:55 -04:00
|
|
|
} else if ppargs.URL == nil {
|
|
|
|
// Check if legacy opa is configured.
|
|
|
|
if _, err := opa.LookupConfig(s[config.PolicyOPASubSys][config.Default],
|
2022-10-24 20:44:15 -04:00
|
|
|
NewHTTPTransport(), xhttp.DrainBody); err != nil {
|
2022-05-10 20:14:55 -04:00
|
|
|
return err
|
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
if config.LoggerSubSystems.Contains(subSys) {
|
2023-08-03 05:47:07 -04:00
|
|
|
if err := logger.ValidateSubSysConfig(ctx, s, subSys); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2018-07-18 14:22:29 -04:00
|
|
|
}
|
2022-02-08 13:36:41 -05:00
|
|
|
|
|
|
|
if config.NotifySubSystems.Contains(subSys) {
|
2023-05-25 01:57:37 -04:00
|
|
|
if err := notify.TestSubSysNotificationTargets(ctx, s, subSys, NewHTTPTransport()); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
|
|
|
}
|
2018-07-18 14:22:29 -04:00
|
|
|
}
|
2023-03-07 11:12:41 -05:00
|
|
|
|
|
|
|
if config.LambdaSubSystems.Contains(subSys) {
|
|
|
|
if err := lambda.TestSubSysLambdaTargets(GlobalContext, s, subSys, NewHTTPTransport()); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-08 13:36:41 -05:00
|
|
|
return nil
|
|
|
|
}
|
2019-11-09 12:27:23 -05:00
|
|
|
|
2023-05-25 01:57:37 -04:00
|
|
|
func validateConfig(ctx context.Context, s config.Config, subSys string) error {
|
2022-02-08 13:36:41 -05:00
|
|
|
objAPI := newObjectLayerFn()
|
|
|
|
|
|
|
|
// We must have a global lock for this so nobody else modifies env while we do.
|
|
|
|
defer env.LockSetEnv()()
|
|
|
|
|
|
|
|
// Disable merging env values with config for validation.
|
|
|
|
env.SetEnvOff()
|
|
|
|
|
|
|
|
// Enable env values to validate KMS.
|
|
|
|
defer env.SetEnvOn()
|
|
|
|
if subSys != "" {
|
2023-05-25 01:57:37 -04:00
|
|
|
return validateSubSysConfig(ctx, s, subSys, objAPI)
|
2018-07-18 14:22:29 -04:00
|
|
|
}
|
2019-11-09 12:27:23 -05:00
|
|
|
|
2022-02-08 13:36:41 -05:00
|
|
|
// No sub-system passed. Validate all of them.
|
|
|
|
for _, ss := range config.SubSystems.ToSlice() {
|
2023-05-25 01:57:37 -04:00
|
|
|
if err := validateSubSysConfig(ctx, s, ss, objAPI); err != nil {
|
2022-02-08 13:36:41 -05:00
|
|
|
return err
|
|
|
|
}
|
2022-02-01 12:52:38 -05:00
|
|
|
}
|
|
|
|
|
2022-02-08 13:36:41 -05:00
|
|
|
return nil
|
2019-10-23 01:59:13 -04:00
|
|
|
}
|
2018-07-18 14:22:29 -04:00
|
|
|
|
2021-09-01 14:34:07 -04:00
|
|
|
func lookupConfigs(s config.Config, objAPI ObjectLayer) {
|
2020-04-09 12:30:02 -04:00
|
|
|
ctx := GlobalContext
|
2019-12-14 20:27:57 -05:00
|
|
|
|
2021-09-01 14:34:07 -04:00
|
|
|
dnsURL, dnsUser, dnsPass, err := env.LookupEnv(config.EnvDNSWebhook)
|
|
|
|
if err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize remote webhook DNS config %w", err))
|
2021-09-01 14:34:07 -04:00
|
|
|
}
|
|
|
|
if err == nil && dnsURL != "" {
|
2023-03-07 11:12:41 -05:00
|
|
|
bootstrapTrace("initialize remote bucket DNS store")
|
2020-09-10 17:19:32 -04:00
|
|
|
globalDNSConfig, err = dns.NewOperatorDNS(dnsURL,
|
|
|
|
dns.Authentication(dnsUser, dnsPass),
|
|
|
|
dns.RootCAs(globalRootCAs))
|
|
|
|
if err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize remote webhook DNS config %w", err))
|
2020-09-10 17:19:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-18 19:19:29 -04:00
|
|
|
etcdCfg, err := etcd.LookupConfig(s[config.EtcdSubSys][config.Default], globalRootCAs)
|
2019-10-30 03:04:39 -04:00
|
|
|
if err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err))
|
2019-10-30 03:04:39 -04:00
|
|
|
}
|
|
|
|
|
2019-12-14 20:27:57 -05:00
|
|
|
if etcdCfg.Enabled {
|
2023-03-07 11:12:41 -05:00
|
|
|
bootstrapTrace("initialize etcd store")
|
2022-08-08 19:16:27 -04:00
|
|
|
globalEtcdClient, err = etcd.New(etcdCfg)
|
|
|
|
if err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err))
|
2020-06-16 23:15:21 -04:00
|
|
|
}
|
2020-06-18 20:31:56 -04:00
|
|
|
|
2020-09-10 17:19:32 -04:00
|
|
|
if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil {
|
|
|
|
if globalDNSConfig != nil {
|
|
|
|
// if global DNS is already configured, indicate with a warning, incase
|
|
|
|
// users are confused.
|
2022-08-08 19:16:27 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("DNS store is already configured with %s, etcd is not used for DNS store", globalDNSConfig))
|
2020-09-10 17:19:32 -04:00
|
|
|
} else {
|
|
|
|
globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config,
|
|
|
|
dns.DomainNames(globalDomainNames),
|
|
|
|
dns.DomainIPs(globalDomainIPs),
|
|
|
|
dns.DomainPort(globalMinioPort),
|
|
|
|
dns.CoreDNSPath(etcdCfg.CoreDNSPath),
|
|
|
|
)
|
|
|
|
if err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize DNS config for %s: %w",
|
|
|
|
globalDomainNames, err))
|
2020-06-16 01:09:39 -04:00
|
|
|
}
|
|
|
|
}
|
2020-06-16 23:15:21 -04:00
|
|
|
}
|
2019-10-30 03:04:39 -04:00
|
|
|
}
|
|
|
|
|
2019-12-29 11:56:45 -05:00
|
|
|
// Bucket federation is 'true' only when IAM assets are not namespaced
|
|
|
|
// per tenant and all tenants interested in globally available users
|
|
|
|
// if namespace was requested such as specifying etcdPathPrefix then
|
|
|
|
// we assume that users are interested in global bucket support
|
|
|
|
// but not federation.
|
|
|
|
globalBucketFederation = etcdCfg.PathPrefix == "" && etcdCfg.Enabled
|
|
|
|
|
2021-11-25 16:06:25 -05:00
|
|
|
globalSite, err = config.LookupSite(s[config.SiteSubSys][config.Default], s[config.RegionSubSys][config.Default])
|
2019-10-23 01:59:13 -04:00
|
|
|
if err != nil {
|
2021-11-25 16:06:25 -05:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Invalid site configuration: %w", err))
|
2018-08-15 00:41:47 -04:00
|
|
|
}
|
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
globalCacheConfig, err = cache.LookupConfig(s[config.CacheSubSys][config.Default])
|
2019-10-04 13:35:33 -04:00
|
|
|
if err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to setup cache: %w", err))
|
2018-08-15 00:41:47 -04:00
|
|
|
}
|
2018-08-17 15:52:14 -04:00
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
if globalCacheConfig.Enabled {
|
2021-04-22 11:45:30 -04:00
|
|
|
if cacheEncKey := env.Get(cache.EnvCacheEncryptionKey, ""); cacheEncKey != "" {
|
|
|
|
globalCacheKMS, err = kms.Parse(cacheEncKey)
|
2019-10-04 13:35:33 -04:00
|
|
|
if err != nil {
|
2019-12-14 20:27:57 -05:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to setup encryption cache: %w", err))
|
2019-10-04 13:35:33 -04:00
|
|
|
}
|
|
|
|
}
|
2018-08-17 15:52:14 -04:00
|
|
|
}
|
2018-09-27 23:36:17 -04:00
|
|
|
|
2021-04-22 11:45:30 -04:00
|
|
|
globalAutoEncryption = crypto.LookupAutoEncryption() // Enable auto-encryption if enabled
|
|
|
|
if globalAutoEncryption && GlobalKMS == nil {
|
|
|
|
logger.Fatal(errors.New("no KMS configured"), "MINIO_KMS_AUTO_ENCRYPTION requires a valid KMS configuration")
|
2020-09-03 15:43:45 -04:00
|
|
|
}
|
2018-10-12 14:32:18 -04:00
|
|
|
|
2022-10-24 20:44:15 -04:00
|
|
|
transport := NewHTTPTransport()
|
2022-08-08 19:16:27 -04:00
|
|
|
|
2023-03-07 11:12:41 -05:00
|
|
|
bootstrapTrace("initialize the event notification targets")
|
|
|
|
globalNotifyTargetList, err = notify.FetchEnabledTargets(GlobalContext, s, transport)
|
2020-03-14 03:01:15 -04:00
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize notification target(s): %w", err))
|
|
|
|
}
|
2020-12-04 12:32:35 -05:00
|
|
|
|
2023-03-07 11:12:41 -05:00
|
|
|
bootstrapTrace("initialize the lambda targets")
|
|
|
|
globalLambdaTargetList, err = lambda.FetchEnabledTargets(GlobalContext, s, transport)
|
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize lambda target(s): %w", err))
|
|
|
|
}
|
|
|
|
|
2022-12-21 18:52:29 -05:00
|
|
|
bootstrapTrace("applying the dynamic configuration")
|
2020-12-04 12:32:35 -05:00
|
|
|
// Apply dynamic config values
|
2021-09-01 14:34:07 -04:00
|
|
|
if err := applyDynamicConfig(ctx, objAPI, s); err != nil {
|
2022-10-24 20:44:15 -04:00
|
|
|
logger.LogIf(ctx, err)
|
2021-09-01 14:34:07 -04:00
|
|
|
}
|
2020-12-04 12:32:35 -05:00
|
|
|
}
|
|
|
|
|
2022-02-22 13:59:28 -05:00
|
|
|
func applyDynamicConfigForSubSys(ctx context.Context, objAPI ObjectLayer, s config.Config, subSys string) error {
|
2022-09-26 12:04:54 -04:00
|
|
|
if objAPI == nil {
|
|
|
|
return errServerNotInitialized
|
|
|
|
}
|
|
|
|
|
|
|
|
setDriveCounts := objAPI.SetDriveCounts()
|
2022-02-22 13:59:28 -05:00
|
|
|
switch subSys {
|
|
|
|
case config.APISubSys:
|
|
|
|
apiConfig, err := api.LookupConfig(s[config.APISubSys][config.Default])
|
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Invalid api configuration: %w", err))
|
2021-09-01 14:34:07 -04:00
|
|
|
}
|
2022-09-26 12:04:54 -04:00
|
|
|
|
2022-02-22 13:59:28 -05:00
|
|
|
globalAPIConfig.init(apiConfig, setDriveCounts)
|
2022-08-08 19:16:27 -04:00
|
|
|
|
|
|
|
// Initialize remote instance transport once.
|
|
|
|
getRemoteInstanceTransportOnce.Do(func() {
|
2022-12-12 23:31:21 -05:00
|
|
|
getRemoteInstanceTransport = NewHTTPTransportWithTimeout(apiConfig.RemoteTransportDeadline)
|
2022-08-08 19:16:27 -04:00
|
|
|
})
|
2022-02-22 13:59:28 -05:00
|
|
|
case config.CompressionSubSys:
|
|
|
|
cmpCfg, err := compress.LookupConfig(s[config.CompressionSubSys][config.Default])
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Unable to setup Compression: %w", err)
|
|
|
|
}
|
|
|
|
globalCompressConfigMu.Lock()
|
|
|
|
globalCompressConfig = cmpCfg
|
|
|
|
globalCompressConfigMu.Unlock()
|
|
|
|
case config.HealSubSys:
|
|
|
|
healCfg, err := heal.LookupConfig(s[config.HealSubSys][config.Default])
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Unable to apply heal config: %w", err)
|
|
|
|
}
|
|
|
|
globalHealConfig.Update(healCfg)
|
|
|
|
case config.ScannerSubSys:
|
|
|
|
scannerCfg, err := scanner.LookupConfig(s[config.ScannerSubSys][config.Default])
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Unable to apply scanner config: %w", err)
|
|
|
|
}
|
|
|
|
// update dynamic scanner values.
|
2022-06-06 19:14:52 -04:00
|
|
|
scannerCycle.Store(scannerCfg.Cycle)
|
2022-02-22 13:59:28 -05:00
|
|
|
logger.LogIf(ctx, scannerSleeper.Update(scannerCfg.Delay, scannerCfg.MaxWait))
|
|
|
|
case config.LoggerWebhookSubSys:
|
2023-08-03 05:47:07 -04:00
|
|
|
loggerCfg, err := logger.LookupConfigForSubSys(ctx, s, config.LoggerWebhookSubSys)
|
2022-02-22 13:59:28 -05:00
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to load logger webhook config: %w", err))
|
|
|
|
}
|
|
|
|
userAgent := getUserAgent(getMinioMode())
|
|
|
|
for n, l := range loggerCfg.HTTP {
|
|
|
|
if l.Enabled {
|
2022-05-12 10:20:58 -04:00
|
|
|
l.LogOnce = logger.LogOnceConsoleIf
|
2022-02-22 13:59:28 -05:00
|
|
|
l.UserAgent = userAgent
|
2022-10-24 20:44:15 -04:00
|
|
|
l.Transport = NewHTTPTransportWithClientCerts(l.ClientCert, l.ClientKey)
|
2022-02-22 13:59:28 -05:00
|
|
|
}
|
2022-11-28 11:03:26 -05:00
|
|
|
loggerCfg.HTTP[n] = l
|
2022-02-22 13:59:28 -05:00
|
|
|
}
|
2023-05-09 00:20:31 -04:00
|
|
|
if errs := logger.UpdateSystemTargets(ctx, loggerCfg); len(errs) > 0 {
|
2022-11-28 11:03:26 -05:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to update logger webhook config: %v", errs))
|
2022-02-17 14:11:15 -05:00
|
|
|
}
|
2022-02-24 12:05:33 -05:00
|
|
|
case config.AuditWebhookSubSys:
|
2023-08-03 05:47:07 -04:00
|
|
|
loggerCfg, err := logger.LookupConfigForSubSys(ctx, s, config.AuditWebhookSubSys)
|
2022-02-24 12:05:33 -05:00
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to load audit webhook config: %w", err))
|
|
|
|
}
|
|
|
|
userAgent := getUserAgent(getMinioMode())
|
|
|
|
for n, l := range loggerCfg.AuditWebhook {
|
|
|
|
if l.Enabled {
|
2022-05-12 10:20:58 -04:00
|
|
|
l.LogOnce = logger.LogOnceConsoleIf
|
2022-02-24 12:05:33 -05:00
|
|
|
l.UserAgent = userAgent
|
2022-10-24 20:44:15 -04:00
|
|
|
l.Transport = NewHTTPTransportWithClientCerts(l.ClientCert, l.ClientKey)
|
2022-02-24 12:05:33 -05:00
|
|
|
}
|
2022-11-28 11:03:26 -05:00
|
|
|
loggerCfg.AuditWebhook[n] = l
|
2022-02-24 12:05:33 -05:00
|
|
|
}
|
|
|
|
|
2023-05-09 00:20:31 -04:00
|
|
|
if errs := logger.UpdateAuditWebhookTargets(ctx, loggerCfg); len(errs) > 0 {
|
2022-11-28 11:03:26 -05:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to update audit webhook targets: %v", errs))
|
2022-02-24 12:05:33 -05:00
|
|
|
}
|
|
|
|
case config.AuditKafkaSubSys:
|
2023-08-03 05:47:07 -04:00
|
|
|
loggerCfg, err := logger.LookupConfigForSubSys(ctx, s, config.AuditKafkaSubSys)
|
2022-02-24 12:05:33 -05:00
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to load audit kafka config: %w", err))
|
|
|
|
}
|
|
|
|
for n, l := range loggerCfg.AuditKafka {
|
|
|
|
if l.Enabled {
|
2023-06-21 13:50:40 -04:00
|
|
|
if l.TLS.Enable {
|
|
|
|
l.TLS.RootCAs = globalRootCAs
|
|
|
|
}
|
2022-02-24 12:05:33 -05:00
|
|
|
l.LogOnce = logger.LogOnceIf
|
|
|
|
loggerCfg.AuditKafka[n] = l
|
|
|
|
}
|
|
|
|
}
|
2023-05-09 00:20:31 -04:00
|
|
|
if errs := logger.UpdateAuditKafkaTargets(ctx, loggerCfg); len(errs) > 0 {
|
2022-11-28 11:03:26 -05:00
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to update audit kafka targets: %v", errs))
|
2022-02-24 12:05:33 -05:00
|
|
|
}
|
2022-04-21 15:07:33 -04:00
|
|
|
case config.StorageClassSubSys:
|
2022-09-26 12:04:54 -04:00
|
|
|
for i, setDriveCount := range setDriveCounts {
|
|
|
|
sc, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount)
|
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize storage class config: %w", err))
|
|
|
|
break
|
|
|
|
}
|
|
|
|
// if we validated all setDriveCounts and it was successful
|
|
|
|
// proceed to store the correct storage class globally.
|
|
|
|
if i == len(setDriveCounts)-1 {
|
|
|
|
globalStorageClass.Update(sc)
|
2022-04-21 15:07:33 -04:00
|
|
|
}
|
|
|
|
}
|
2022-10-27 03:20:01 -04:00
|
|
|
case config.SubnetSubSys:
|
|
|
|
subnetConfig, err := subnet.LookupConfig(s[config.SubnetSubSys][config.Default], globalProxyTransport)
|
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to parse subnet configuration: %w", err))
|
|
|
|
} else {
|
|
|
|
globalSubnetConfig.Update(subnetConfig)
|
|
|
|
globalSubnetConfig.ApplyEnv() // update environment settings for Console UI
|
|
|
|
}
|
2022-06-06 19:14:52 -04:00
|
|
|
case config.CallhomeSubSys:
|
|
|
|
callhomeCfg, err := callhome.LookupConfig(s[config.CallhomeSubSys][config.Default])
|
|
|
|
if err != nil {
|
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to load callhome config: %w", err))
|
|
|
|
} else {
|
2022-10-27 03:20:01 -04:00
|
|
|
enable := callhomeCfg.Enable && !globalCallhomeConfig.Enabled()
|
|
|
|
globalCallhomeConfig.Update(callhomeCfg)
|
|
|
|
if enable {
|
|
|
|
initCallhome(ctx, objAPI)
|
|
|
|
}
|
2022-06-06 19:14:52 -04:00
|
|
|
}
|
2022-02-17 14:11:15 -05:00
|
|
|
}
|
2020-12-04 12:32:35 -05:00
|
|
|
globalServerConfigMu.Lock()
|
|
|
|
defer globalServerConfigMu.Unlock()
|
|
|
|
if globalServerConfig != nil {
|
2022-02-22 13:59:28 -05:00
|
|
|
globalServerConfig[subSys] = s[subSys]
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// applyDynamicConfig will apply dynamic config values.
|
|
|
|
// Dynamic systems should be in config.SubSystemsDynamic as well.
|
|
|
|
func applyDynamicConfig(ctx context.Context, objAPI ObjectLayer, s config.Config) error {
|
|
|
|
for subSys := range config.SubSystemsDynamic {
|
|
|
|
err := applyDynamicConfigForSubSys(ctx, objAPI, s, subSys)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2020-12-04 12:32:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
2017-03-31 01:26:24 -04:00
|
|
|
}
|
|
|
|
|
2019-11-19 16:48:13 -05:00
|
|
|
// Help - return sub-system level help
|
|
|
|
type Help struct {
|
|
|
|
SubSys string `json:"subSys"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
MultipleTargets bool `json:"multipleTargets"`
|
|
|
|
KeysHelp config.HelpKVS `json:"keysHelp"`
|
|
|
|
}
|
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
// GetHelp - returns help for sub-sys, a key for a sub-system or all the help.
|
2019-11-19 16:48:13 -05:00
|
|
|
func GetHelp(subSys, key string, envOnly bool) (Help, error) {
|
2019-10-23 01:59:13 -04:00
|
|
|
if len(subSys) == 0 {
|
2019-11-27 12:36:08 -05:00
|
|
|
return Help{KeysHelp: config.HelpSubSysMap[subSys]}, nil
|
2018-09-06 11:03:18 -04:00
|
|
|
}
|
2019-10-30 03:04:39 -04:00
|
|
|
subSystemValue := strings.SplitN(subSys, config.SubSystemSeparator, 2)
|
|
|
|
if len(subSystemValue) == 0 {
|
2019-12-14 20:27:57 -05:00
|
|
|
return Help{}, config.Errorf("invalid number of arguments %s", subSys)
|
2019-10-30 03:04:39 -04:00
|
|
|
}
|
|
|
|
|
2019-11-27 12:36:08 -05:00
|
|
|
subSys = subSystemValue[0]
|
|
|
|
|
|
|
|
subSysHelp, ok := config.HelpSubSysMap[""].Lookup(subSys)
|
|
|
|
if !ok {
|
2021-11-25 16:06:25 -05:00
|
|
|
subSysHelp, ok = config.HelpDeprecatedSubSysMap[subSys]
|
|
|
|
if !ok {
|
|
|
|
return Help{}, config.Errorf("unknown sub-system %s", subSys)
|
|
|
|
}
|
2018-09-06 11:03:18 -04:00
|
|
|
}
|
2019-10-30 03:04:39 -04:00
|
|
|
|
2019-11-27 12:36:08 -05:00
|
|
|
h, ok := config.HelpSubSysMap[subSys]
|
|
|
|
if !ok {
|
2019-12-14 20:27:57 -05:00
|
|
|
return Help{}, config.Errorf("unknown sub-system %s", subSys)
|
2019-11-27 12:36:08 -05:00
|
|
|
}
|
2019-10-23 01:59:13 -04:00
|
|
|
if key != "" {
|
2019-11-19 16:48:13 -05:00
|
|
|
value, ok := h.Lookup(key)
|
2019-10-23 01:59:13 -04:00
|
|
|
if !ok {
|
2019-12-14 20:27:57 -05:00
|
|
|
return Help{}, config.Errorf("unknown key %s for sub-system %s",
|
|
|
|
key, subSys)
|
2019-10-30 03:04:39 -04:00
|
|
|
}
|
2019-11-19 16:48:13 -05:00
|
|
|
h = config.HelpKVS{value}
|
2018-11-07 13:23:13 -05:00
|
|
|
}
|
|
|
|
|
2023-02-03 08:52:52 -05:00
|
|
|
help := config.HelpKVS{}
|
|
|
|
|
|
|
|
// Only for multiple targets, make sure
|
|
|
|
// to list the ENV, for regular k/v EnableKey is
|
|
|
|
// implicit, for ENVs we cannot make it implicit.
|
|
|
|
if subSysHelp.MultipleTargets {
|
|
|
|
key := madmin.EnableKey
|
|
|
|
if envOnly {
|
|
|
|
key = config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(madmin.EnableKey)
|
|
|
|
}
|
|
|
|
help = append(help, config.HelpKV{
|
|
|
|
Key: key,
|
|
|
|
Description: fmt.Sprintf("enable %s target, default is 'off'", subSys),
|
|
|
|
Optional: false,
|
|
|
|
Type: "on|off",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, hkv := range h {
|
|
|
|
key := hkv.Key
|
|
|
|
if envOnly {
|
|
|
|
key = config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(hkv.Key)
|
|
|
|
}
|
|
|
|
help = append(help, config.HelpKV{
|
|
|
|
Key: key,
|
|
|
|
Description: hkv.Description,
|
|
|
|
Optional: hkv.Optional,
|
|
|
|
Type: hkv.Type,
|
|
|
|
})
|
2019-11-19 16:48:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return Help{
|
|
|
|
SubSys: subSys,
|
|
|
|
Description: subSysHelp.Description,
|
|
|
|
MultipleTargets: subSysHelp.MultipleTargets,
|
2023-02-03 08:52:52 -05:00
|
|
|
KeysHelp: help,
|
2019-11-19 16:48:13 -05:00
|
|
|
}, nil
|
2019-10-23 01:59:13 -04:00
|
|
|
}
|
2018-09-06 11:03:18 -04:00
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
func newServerConfig() config.Config {
|
2019-11-13 20:38:05 -05:00
|
|
|
return config.New()
|
2017-03-01 12:17:04 -05:00
|
|
|
}
|
|
|
|
|
2018-10-09 17:00:01 -04:00
|
|
|
// newSrvConfig - initialize a new server config, saves env parameters if
|
2018-08-15 00:41:47 -04:00
|
|
|
// found, otherwise use default parameters
|
2018-10-09 17:00:01 -04:00
|
|
|
func newSrvConfig(objAPI ObjectLayer) error {
|
2018-08-15 00:41:47 -04:00
|
|
|
// Initialize server config.
|
|
|
|
srvCfg := newServerConfig()
|
|
|
|
|
2017-02-07 15:51:43 -05:00
|
|
|
// hold the mutex lock before a new config is assigned.
|
2017-11-29 16:12:47 -05:00
|
|
|
globalServerConfigMu.Lock()
|
|
|
|
globalServerConfig = srvCfg
|
|
|
|
globalServerConfigMu.Unlock()
|
2017-02-07 15:51:43 -05:00
|
|
|
|
|
|
|
// Save config into file.
|
2022-08-08 19:16:27 -04:00
|
|
|
return saveServerConfig(GlobalContext, objAPI, srvCfg)
|
2017-02-07 15:51:43 -05:00
|
|
|
}
|
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
func getValidConfig(objAPI ObjectLayer) (config.Config, error) {
|
2022-12-19 14:10:14 -05:00
|
|
|
return readServerConfig(GlobalContext, objAPI, nil)
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
}
|
|
|
|
|
2019-10-30 03:04:39 -04:00
|
|
|
// loadConfig - loads a new config from disk, overrides params
|
|
|
|
// from env if found and valid
|
2022-12-19 14:10:14 -05:00
|
|
|
// data is optional. If nil it will be loaded from backend.
|
|
|
|
func loadConfig(objAPI ObjectLayer, data []byte) error {
|
2022-12-21 18:52:29 -05:00
|
|
|
bootstrapTrace("load the configuration")
|
2022-12-19 14:10:14 -05:00
|
|
|
srvCfg, err := readServerConfig(GlobalContext, objAPI, data)
|
2020-12-01 14:59:03 -05:00
|
|
|
if err != nil {
|
|
|
|
return err
|
2017-03-16 14:06:17 -04:00
|
|
|
}
|
2016-12-07 06:41:54 -05:00
|
|
|
|
2022-12-21 18:52:29 -05:00
|
|
|
bootstrapTrace("lookup the configuration")
|
2018-08-15 00:41:47 -04:00
|
|
|
// Override any values from ENVs.
|
2021-09-01 14:34:07 -04:00
|
|
|
lookupConfigs(srvCfg, objAPI)
|
2018-03-29 17:38:26 -04:00
|
|
|
|
2017-03-31 01:26:24 -04:00
|
|
|
// hold the mutex lock before a new config is assigned.
|
2017-11-29 16:12:47 -05:00
|
|
|
globalServerConfigMu.Lock()
|
|
|
|
globalServerConfig = srvCfg
|
|
|
|
globalServerConfigMu.Unlock()
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
|
2017-03-31 01:26:24 -04:00
|
|
|
return nil
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
}
|