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/>.
|
2015-12-07 17:12:47 -05:00
|
|
|
|
|
2016-08-18 19:23:42 -04:00
|
|
|
|
package cmd
|
2015-12-07 17:12:47 -05:00
|
|
|
|
|
2016-07-08 23:34:27 -04:00
|
|
|
|
import (
|
2016-11-11 10:18:44 -05:00
|
|
|
|
"crypto/x509"
|
2021-03-31 12:11:37 -04:00
|
|
|
|
"errors"
|
2020-11-02 10:43:11 -05:00
|
|
|
|
"net/http"
|
2017-07-12 19:33:21 -04:00
|
|
|
|
"os"
|
2020-12-04 12:32:35 -05:00
|
|
|
|
"sync"
|
2021-11-23 15:02:16 -05:00
|
|
|
|
"sync/atomic"
|
2016-09-09 18:33:35 -04:00
|
|
|
|
"time"
|
|
|
|
|
|
2021-08-31 21:52:48 -04:00
|
|
|
|
"github.com/minio/console/restapi"
|
2022-07-12 13:12:47 -04:00
|
|
|
|
minio "github.com/minio/minio-go/v7"
|
2020-07-14 12:38:05 -04:00
|
|
|
|
"github.com/minio/minio-go/v7/pkg/set"
|
2021-06-01 17:59:40 -04:00
|
|
|
|
"github.com/minio/minio/internal/bucket/bandwidth"
|
2021-11-25 16:06:25 -05:00
|
|
|
|
"github.com/minio/minio/internal/config"
|
2021-06-01 17:59:40 -04:00
|
|
|
|
"github.com/minio/minio/internal/handlers"
|
|
|
|
|
"github.com/minio/minio/internal/kms"
|
2021-10-05 13:13:04 -04:00
|
|
|
|
"github.com/rs/dnscache"
|
2018-05-11 15:02:30 -04:00
|
|
|
|
|
2021-04-19 11:44:18 -04:00
|
|
|
|
"github.com/dustin/go-humanize"
|
2021-06-01 17:59:40 -04:00
|
|
|
|
"github.com/minio/minio/internal/auth"
|
|
|
|
|
"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"
|
|
|
|
|
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"
|
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/storageclass"
|
2021-09-15 00:54:25 -04:00
|
|
|
|
"github.com/minio/minio/internal/config/subnet"
|
2021-06-01 17:59:40 -04:00
|
|
|
|
xhttp "github.com/minio/minio/internal/http"
|
2021-05-28 13:31:42 -04:00
|
|
|
|
etcd "go.etcd.io/etcd/client/v3"
|
2020-04-30 18:55:54 -04:00
|
|
|
|
|
2021-06-01 17:59:40 -04:00
|
|
|
|
"github.com/minio/minio/internal/event"
|
|
|
|
|
"github.com/minio/minio/internal/pubsub"
|
2021-05-28 18:17:01 -04:00
|
|
|
|
"github.com/minio/pkg/certs"
|
2021-07-09 17:27:09 -04:00
|
|
|
|
xnet "github.com/minio/pkg/net"
|
2016-07-08 23:34:27 -04:00
|
|
|
|
)
|
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
|
|
|
|
|
|
|
|
|
// minio configuration related constants.
|
|
|
|
|
const (
|
2020-05-17 11:46:23 -04:00
|
|
|
|
GlobalMinioDefaultPort = "9000"
|
2018-12-18 19:08:11 -05:00
|
|
|
|
|
2017-06-20 18:01:13 -04:00
|
|
|
|
globalMinioDefaultRegion = ""
|
|
|
|
|
// This is a sha256 output of ``arn:aws:iam::minio:user/admin``,
|
|
|
|
|
// this is kept in present form to be compatible with S3 owner ID
|
|
|
|
|
// requirements -
|
|
|
|
|
//
|
|
|
|
|
// ```
|
|
|
|
|
// The canonical user ID is the Amazon S3–only concept.
|
|
|
|
|
// It is 64-character obfuscated version of the account ID.
|
|
|
|
|
// ```
|
|
|
|
|
// http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example4.html
|
|
|
|
|
globalMinioDefaultOwnerID = "02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4"
|
2017-01-18 15:24:34 -05:00
|
|
|
|
globalMinioDefaultStorageClass = "STANDARD"
|
|
|
|
|
globalWindowsOSName = "windows"
|
2019-10-01 13:42:18 -04:00
|
|
|
|
globalMacOSName = "darwin"
|
2017-03-16 15:21:58 -04:00
|
|
|
|
globalMinioModeFS = "mode-server-fs"
|
2022-05-30 13:58:37 -04:00
|
|
|
|
globalMinioModeErasureSD = "mode-server-xl-single"
|
2020-06-12 23:04:01 -04:00
|
|
|
|
globalMinioModeErasure = "mode-server-xl"
|
|
|
|
|
globalMinioModeDistErasure = "mode-server-distributed-xl"
|
2020-09-19 11:39:41 -04:00
|
|
|
|
globalDirSuffix = "__XLDIR__"
|
|
|
|
|
globalDirSuffixWithSlash = globalDirSuffix + slashSeparator
|
2017-09-19 19:08:08 -04:00
|
|
|
|
|
2016-05-09 19:18:56 -04:00
|
|
|
|
// Add new global values here.
|
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-11-22 23:13:20 -05:00
|
|
|
|
const (
|
|
|
|
|
// Limit fields size (except file) to 1Mib since Policy document
|
|
|
|
|
// can reach that size according to https://aws.amazon.com/articles/1434
|
|
|
|
|
maxFormFieldSize = int64(1 * humanize.MiByte)
|
|
|
|
|
|
2017-02-02 13:45:00 -05:00
|
|
|
|
// Limit memory allocation to store multipart data
|
|
|
|
|
maxFormMemory = int64(5 * humanize.MiByte)
|
|
|
|
|
|
2017-09-07 14:16:45 -04:00
|
|
|
|
// The maximum allowed time difference between the incoming request
|
|
|
|
|
// date and server date during signature verification.
|
|
|
|
|
globalMaxSkewTime = 15 * time.Minute // 15 minutes skew allowed.
|
|
|
|
|
|
2021-10-04 13:52:28 -04:00
|
|
|
|
// GlobalStaleUploadsExpiry - Expiry duration after which the uploads in multipart,
|
|
|
|
|
// tmp directory are deemed stale.
|
2020-09-08 18:55:40 -04:00
|
|
|
|
GlobalStaleUploadsExpiry = time.Hour * 24 // 24 hrs.
|
2021-02-26 12:52:27 -05:00
|
|
|
|
|
2020-09-08 18:55:40 -04:00
|
|
|
|
// GlobalStaleUploadsCleanupInterval - Cleanup interval when the stale uploads cleanup is initiated.
|
2021-10-04 13:52:28 -04:00
|
|
|
|
GlobalStaleUploadsCleanupInterval = time.Hour * 6 // 6 hrs.
|
2019-07-19 16:20:33 -04:00
|
|
|
|
|
2018-10-09 17:00:01 -04:00
|
|
|
|
// Refresh interval to update in-memory iam config cache.
|
2022-03-30 20:02:59 -04:00
|
|
|
|
globalRefreshIAMInterval = 10 * time.Minute
|
2018-05-04 14:16:14 -04:00
|
|
|
|
|
2021-02-26 12:52:27 -05:00
|
|
|
|
// Limit of location constraint XML for unauthenticated PUT bucket operations.
|
2018-05-04 14:16:14 -04:00
|
|
|
|
maxLocationConstraintSize = 3 * humanize.MiByte
|
2020-02-05 04:42:34 -05:00
|
|
|
|
|
|
|
|
|
// Maximum size of default bucket encryption configuration allowed
|
|
|
|
|
maxBucketSSEConfigSize = 1 * humanize.MiByte
|
2020-06-20 09:36:44 -04:00
|
|
|
|
|
|
|
|
|
// diskFillFraction is the fraction of a disk we allow to be filled.
|
2021-08-04 18:23:39 -04:00
|
|
|
|
diskFillFraction = 0.99
|
2021-06-07 11:13:15 -04:00
|
|
|
|
|
2022-05-25 16:20:20 -04:00
|
|
|
|
// diskReserveFraction is the fraction of a disk where we will fill other server pools first.
|
|
|
|
|
// If all pools reach this, we will use all pools with regular placement.
|
|
|
|
|
diskReserveFraction = 0.15
|
|
|
|
|
|
2021-06-07 11:13:15 -04:00
|
|
|
|
// diskAssumeUnknownSize is the size to assume when an unknown size upload is requested.
|
|
|
|
|
diskAssumeUnknownSize = 1 << 30
|
|
|
|
|
|
|
|
|
|
// diskMinInodes is the minimum number of inodes we want free on a disk to perform writes.
|
|
|
|
|
diskMinInodes = 1000
|
2022-01-06 14:34:02 -05:00
|
|
|
|
|
|
|
|
|
// tlsClientSessionCacheSize is the cache size for client sessions.
|
|
|
|
|
tlsClientSessionCacheSize = 100
|
2016-11-22 23:13:20 -05:00
|
|
|
|
)
|
|
|
|
|
|
2018-12-18 19:08:11 -05:00
|
|
|
|
var globalCLIContext = struct {
|
2019-05-08 21:35:40 -04:00
|
|
|
|
JSON, Quiet bool
|
|
|
|
|
Anonymous bool
|
|
|
|
|
StrictS3Compat bool
|
2018-12-18 19:08:11 -05:00
|
|
|
|
}{}
|
|
|
|
|
|
2016-03-24 20:20:49 -04:00
|
|
|
|
var (
|
2017-01-16 20:05:00 -05:00
|
|
|
|
// Indicates if the running minio server is distributed setup.
|
2020-06-12 23:04:01 -04:00
|
|
|
|
globalIsDistErasure = false
|
2016-11-28 15:15:36 -05:00
|
|
|
|
|
2017-01-23 03:32:55 -05:00
|
|
|
|
// Indicates if the running minio server is an erasure-code backend.
|
2020-06-12 23:04:01 -04:00
|
|
|
|
globalIsErasure = false
|
2017-01-23 03:32:55 -05:00
|
|
|
|
|
2022-05-30 13:58:37 -04:00
|
|
|
|
// Indicates if the running minio server is in single drive XL mode.
|
|
|
|
|
globalIsErasureSD = false
|
|
|
|
|
|
2022-05-16 08:36:00 -04:00
|
|
|
|
// Indicates if server code should go through testing path.
|
|
|
|
|
globalIsTesting = false
|
|
|
|
|
|
2021-04-29 22:01:43 -04:00
|
|
|
|
// This flag is set to 'true' by default
|
|
|
|
|
globalBrowserEnabled = true
|
|
|
|
|
|
2021-07-09 17:27:09 -04:00
|
|
|
|
// Custom browser redirect URL, not set by default
|
|
|
|
|
// and it is automatically deduced.
|
|
|
|
|
globalBrowserRedirectURL *xnet.URL
|
|
|
|
|
|
2017-12-15 15:33:42 -05:00
|
|
|
|
// This flag is set to 'true' when MINIO_UPDATE env is set to 'off'. Default is false.
|
|
|
|
|
globalInplaceUpdateDisabled = false
|
|
|
|
|
|
2021-11-25 16:06:25 -05:00
|
|
|
|
globalSite = config.Site{
|
|
|
|
|
Region: globalMinioDefaultRegion,
|
|
|
|
|
}
|
2017-04-09 13:44:10 -04:00
|
|
|
|
|
2019-04-09 14:39:42 -04:00
|
|
|
|
// MinIO local server address (in `host:port` format)
|
2021-06-21 02:04:47 -04:00
|
|
|
|
globalMinioAddr = ""
|
2021-06-17 23:27:04 -04:00
|
|
|
|
|
2019-04-09 14:39:42 -04:00
|
|
|
|
// MinIO default port, can be changed through command line.
|
2022-07-08 16:36:41 -04:00
|
|
|
|
globalMinioPort = GlobalMinioDefaultPort
|
|
|
|
|
globalMinioConsolePort = "13333"
|
2021-06-17 23:27:04 -04:00
|
|
|
|
|
2016-10-18 15:49:24 -04:00
|
|
|
|
// Holds the host that was passed using --address
|
|
|
|
|
globalMinioHost = ""
|
2021-06-17 23:27:04 -04:00
|
|
|
|
// Holds the host that was passed using --console-address
|
|
|
|
|
globalMinioConsoleHost = ""
|
|
|
|
|
|
2020-04-27 09:25:05 -04:00
|
|
|
|
// Holds the possible host endpoint.
|
|
|
|
|
globalMinioEndpoint = ""
|
2016-12-29 06:13:51 -05:00
|
|
|
|
|
2018-08-15 00:41:47 -04:00
|
|
|
|
// globalConfigSys server config system.
|
|
|
|
|
globalConfigSys *ConfigSys
|
|
|
|
|
|
2022-08-24 09:42:36 -04:00
|
|
|
|
globalNotificationSys *NotificationSys
|
|
|
|
|
|
|
|
|
|
globalEventNotifier *EventNotifier
|
2019-12-22 01:35:50 -05:00
|
|
|
|
globalConfigTargetList *event.TargetList
|
2020-03-14 03:01:15 -04:00
|
|
|
|
|
2020-05-19 16:53:54 -04:00
|
|
|
|
globalBucketMetadataSys *BucketMetadataSys
|
2020-10-09 23:36:00 -04:00
|
|
|
|
globalBucketMonitor *bandwidth.Monitor
|
2020-05-19 16:53:54 -04:00
|
|
|
|
globalPolicySys *PolicySys
|
|
|
|
|
globalIAMSys *IAMSys
|
2016-10-12 04:03:50 -04:00
|
|
|
|
|
2020-07-30 22:55:22 -04:00
|
|
|
|
globalLifecycleSys *LifecycleSys
|
|
|
|
|
globalBucketSSEConfigSys *BucketSSEConfigSys
|
|
|
|
|
globalBucketTargetSys *BucketTargetSys
|
2020-06-04 17:58:34 -04:00
|
|
|
|
// globalAPIConfig controls S3 API requests throttling,
|
|
|
|
|
// healthcheck readiness deadlines and cors settings.
|
2022-03-25 19:29:45 -04:00
|
|
|
|
globalAPIConfig = apiConfig{listQuorum: "strict"}
|
2020-04-14 15:46:37 -04:00
|
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
|
globalStorageClass storageclass.Config
|
2022-05-26 20:58:09 -04:00
|
|
|
|
|
2019-10-23 01:59:13 -04:00
|
|
|
|
globalLDAPConfig xldap.Config
|
|
|
|
|
globalOpenIDConfig openid.Config
|
2021-09-07 22:03:48 -04:00
|
|
|
|
globalSTSTLSConfig xtls.Config
|
2019-10-23 01:59:13 -04:00
|
|
|
|
|
2022-05-26 20:58:09 -04:00
|
|
|
|
globalAuthNPlugin *idplugin.AuthNPlugin
|
|
|
|
|
|
2016-11-11 10:18:44 -05:00
|
|
|
|
// CA root certificates, a nil value means system certs pool will be used
|
|
|
|
|
globalRootCAs *x509.CertPool
|
|
|
|
|
|
2017-01-11 16:59:51 -05:00
|
|
|
|
// IsSSL indicates if the server is configured with SSL.
|
2020-12-22 00:42:38 -05:00
|
|
|
|
globalIsTLS bool
|
2017-01-11 16:59:51 -05:00
|
|
|
|
|
certs: refactor cert manager to support multiple certificates (#10207)
This commit refactors the certificate management implementation
in the `certs` package such that multiple certificates can be
specified at the same time. Therefore, the following layout of
the `certs/` directory is expected:
```
certs/
│
├─ public.crt
├─ private.key
├─ CAs/ // CAs directory is ignored
│ │
│ ...
│
├─ example.com/
│ │
│ ├─ public.crt
│ └─ private.key
└─ foobar.org/
│
├─ public.crt
└─ private.key
...
```
However, directory names like `example.com` are just for human
readability/organization and don't have any meaning w.r.t whether
a particular certificate is served or not. This decision is made based
on the SNI sent by the client and the SAN of the certificate.
***
The `Manager` will pick a certificate based on the client trying
to establish a TLS connection. In particular, it looks at the client
hello (i.e. SNI) to determine which host the client tries to access.
If the manager can find a certificate that matches the SNI it
returns this certificate to the client.
However, the client may choose to not send an SNI or tries to access
a server directly via IP (`https://<ip>:<port>`). In this case, we
cannot use the SNI to determine which certificate to serve. However,
we also should not pick "the first" certificate that would be accepted
by the client (based on crypto. parameters - like a signature algorithm)
because it may be an internal certificate that contains internal hostnames.
We would disclose internal infrastructure details doing so.
Therefore, the `Manager` returns the "default" certificate when the
client does not specify an SNI. The default certificate the top-level
`public.crt` - i.e. `certs/public.crt`.
This approach has some consequences:
- It's the operator's responsibility to ensure that the top-level
`public.crt` does not disclose any information (i.e. hostnames)
that are not publicly visible. However, this was the case in the
past already.
- Any other `public.crt` - except for the top-level one - must not
contain any IP SAN. The reason for this restriction is that the
Manager cannot match a SNI to an IP b/c the SNI is the server host
name. The entire purpose of SNI is to indicate which host the client
tries to connect to when multiple hosts run on the same IP. So, a
client will not set the SNI to an IP.
If we would allow IP SANs in a lower-level `public.crt` a user would
expect that it is possible to connect to MinIO directly via IP address
and that the MinIO server would pick "the right" certificate. However,
the MinIO server cannot determine which certificate to serve, and
therefore always picks the "default" one. This may lead to all sorts
of confusing errors like:
"It works if I use `https:instance.minio.local` but not when I use
`https://10.0.2.1`.
These consequences/limitations should be pointed out / explained in our
docs in an appropriate way. However, the support for multiple
certificates should not have any impact on how deployment with a single
certificate function today.
Co-authored-by: Harshavardhana <harsha@minio.io>
2020-09-04 02:33:37 -04:00
|
|
|
|
globalTLSCerts *certs.Manager
|
2017-07-12 19:33:21 -04:00
|
|
|
|
|
2018-04-21 22:23:54 -04:00
|
|
|
|
globalHTTPServer *xhttp.Server
|
2017-07-12 19:33:21 -04:00
|
|
|
|
globalHTTPServerErrorCh = make(chan error)
|
|
|
|
|
globalOSSignalCh = make(chan os.Signal, 1)
|
|
|
|
|
|
2021-03-27 02:24:07 -04:00
|
|
|
|
// global Trace system to send HTTP request/response
|
|
|
|
|
// and Storage/OS calls info to registered listeners.
|
2022-06-05 17:29:12 -04:00
|
|
|
|
globalTrace = pubsub.New(8)
|
2017-10-24 22:04:51 -04:00
|
|
|
|
|
2019-12-12 13:01:23 -05:00
|
|
|
|
// global Listen system to send S3 API events to registered listeners
|
2022-07-05 17:45:49 -04:00
|
|
|
|
// Objects are expected to be event.Event
|
2022-06-05 17:29:12 -04:00
|
|
|
|
globalHTTPListen = pubsub.New(0)
|
2019-12-12 13:01:23 -05:00
|
|
|
|
|
2019-09-03 14:10:48 -04:00
|
|
|
|
// global console system to send console logs to
|
|
|
|
|
// registered listeners
|
|
|
|
|
globalConsoleSys *HTTPConsoleLoggerSys
|
|
|
|
|
|
2020-12-01 16:50:33 -05:00
|
|
|
|
globalEndpoints EndpointServerPools
|
2017-01-23 03:32:55 -05:00
|
|
|
|
|
2021-03-26 14:37:58 -04:00
|
|
|
|
// The name of this local node, fetched from arguments
|
|
|
|
|
globalLocalNodeName string
|
|
|
|
|
|
2021-09-15 00:54:25 -04:00
|
|
|
|
// The global subnet config
|
|
|
|
|
globalSubnetConfig subnet.Config
|
2021-08-17 14:56:01 -04:00
|
|
|
|
|
2022-06-06 19:14:52 -04:00
|
|
|
|
// The global callhome config
|
|
|
|
|
globalCallhomeConfig callhome.Config
|
|
|
|
|
|
2021-01-07 22:16:18 -05:00
|
|
|
|
globalRemoteEndpoints map[string]Endpoint
|
|
|
|
|
|
2017-02-06 12:29:53 -05:00
|
|
|
|
// Global server's network statistics
|
|
|
|
|
globalConnStats = newConnStats()
|
2017-02-08 03:13:02 -05:00
|
|
|
|
|
2017-02-06 12:29:53 -05:00
|
|
|
|
// Global HTTP request statisitics
|
|
|
|
|
globalHTTPStats = newHTTPStats()
|
|
|
|
|
|
2022-06-14 18:14:24 -04:00
|
|
|
|
// Global bucket network statistics
|
|
|
|
|
globalBucketConnStats = newBucketConnStats()
|
|
|
|
|
|
2020-03-17 19:37:28 -04:00
|
|
|
|
// Time when the server is started
|
|
|
|
|
globalBootTime = UTCNow()
|
2017-02-08 03:13:02 -05:00
|
|
|
|
|
2019-10-30 03:04:39 -04:00
|
|
|
|
globalActiveCred auth.Credentials
|
|
|
|
|
|
2018-02-02 13:17:13 -05:00
|
|
|
|
globalPublicCerts []*x509.Certificate
|
2017-11-14 19:56:24 -05:00
|
|
|
|
|
2019-02-22 22:18:01 -05:00
|
|
|
|
globalDomainNames []string // Root domains for virtual host style requests
|
2019-04-09 14:39:42 -04:00
|
|
|
|
globalDomainIPs set.StringSet // Root domain IP address(s) for a distributed MinIO deployment
|
2017-08-31 14:29:22 -04:00
|
|
|
|
|
2020-10-08 15:32:32 -04:00
|
|
|
|
globalOperationTimeout = newDynamicTimeout(10*time.Minute, 5*time.Minute) // default timeout for general ops
|
|
|
|
|
globalDeleteOperationTimeout = newDynamicTimeout(5*time.Minute, 1*time.Minute) // default time for delete ops
|
2016-03-24 20:20:49 -04:00
|
|
|
|
|
2020-05-08 16:44:44 -04:00
|
|
|
|
globalBucketObjectLockSys *BucketObjectLockSys
|
|
|
|
|
globalBucketQuotaSys *BucketQuotaSys
|
2020-06-12 23:04:01 -04:00
|
|
|
|
globalBucketVersioningSys *BucketVersioningSys
|
2020-04-30 18:55:54 -04:00
|
|
|
|
|
2018-03-28 17:14:06 -04:00
|
|
|
|
// Disk cache drives
|
2019-10-23 01:59:13 -04:00
|
|
|
|
globalCacheConfig cache.Config
|
2018-02-02 21:18:52 -05:00
|
|
|
|
|
2019-08-23 13:13:22 -04:00
|
|
|
|
// Initialized KMS configuration for disk cache
|
2021-04-15 11:47:33 -04:00
|
|
|
|
globalCacheKMS kms.KMS
|
2019-10-23 01:59:13 -04:00
|
|
|
|
|
2018-02-02 21:18:52 -05:00
|
|
|
|
// Allocated etcd endpoint for config and bucket DNS.
|
2018-07-12 17:12:40 -04:00
|
|
|
|
globalEtcdClient *etcd.Client
|
2018-02-02 21:18:52 -05:00
|
|
|
|
|
2021-10-06 19:36:31 -04:00
|
|
|
|
// Cluster replication manager.
|
|
|
|
|
globalSiteReplicationSys SiteReplicationSys
|
|
|
|
|
|
2019-12-29 11:56:45 -05:00
|
|
|
|
// Is set to true when Bucket federation is requested
|
|
|
|
|
// and is 'true' when etcdConfig.PathPrefix is empty
|
|
|
|
|
globalBucketFederation bool
|
|
|
|
|
|
2018-02-02 21:18:52 -05:00
|
|
|
|
// Allocated DNS config wrapper over etcd client.
|
2020-07-20 15:28:48 -04:00
|
|
|
|
globalDNSConfig dns.Store
|
2018-03-28 17:14:06 -04:00
|
|
|
|
|
2019-01-05 17:16:43 -05:00
|
|
|
|
// GlobalKMS initialized KMS configuration
|
2021-04-15 11:47:33 -04:00
|
|
|
|
GlobalKMS kms.KMS
|
2018-09-27 23:36:17 -04:00
|
|
|
|
|
2018-12-14 16:35:48 -05:00
|
|
|
|
// Auto-Encryption, if enabled, turns any non-SSE-C request
|
|
|
|
|
// into an SSE-S3 request. If enabled a valid, non-empty KMS
|
|
|
|
|
// configuration must be present.
|
|
|
|
|
globalAutoEncryption bool
|
|
|
|
|
|
2019-09-26 02:08:24 -04:00
|
|
|
|
// Is compression enabled?
|
2020-12-04 12:32:35 -05:00
|
|
|
|
globalCompressConfigMu sync.Mutex
|
|
|
|
|
globalCompressConfig compress.Config
|
2018-09-27 23:36:17 -04:00
|
|
|
|
|
|
|
|
|
// Some standard object extensions which we strictly dis-allow for compression.
|
2021-04-19 11:44:18 -04:00
|
|
|
|
standardExcludeCompressExtensions = []string{".gz", ".bz2", ".rar", ".zip", ".7z", ".xz", ".mp4", ".mkv", ".mov", ".jpg", ".png", ".gif"}
|
2018-09-27 23:36:17 -04:00
|
|
|
|
|
|
|
|
|
// Some standard content-types which we strictly dis-allow for compression.
|
|
|
|
|
standardExcludeCompressContentTypes = []string{"video/*", "audio/*", "application/zip", "application/x-gzip", "application/x-zip-compressed", " application/x-compress", "application/x-spoon"}
|
|
|
|
|
|
2022-05-10 20:14:55 -04:00
|
|
|
|
// AuthZ Plugin system.
|
|
|
|
|
globalAuthZPlugin *polplugin.AuthZPlugin
|
2018-10-09 17:00:01 -04:00
|
|
|
|
|
2018-11-19 17:47:03 -05:00
|
|
|
|
// Deployment ID - unique per deployment
|
|
|
|
|
globalDeploymentID string
|
|
|
|
|
|
2019-10-28 13:27:49 -04:00
|
|
|
|
globalAllHealState *allHealState
|
|
|
|
|
|
2019-06-09 01:14:07 -04:00
|
|
|
|
// The always present healing routine ready to heal objects
|
2019-10-28 13:27:49 -04:00
|
|
|
|
globalBackgroundHealRoutine *healRoutine
|
|
|
|
|
globalBackgroundHealState *allHealState
|
2019-06-09 01:14:07 -04:00
|
|
|
|
|
2021-07-26 11:00:59 -04:00
|
|
|
|
globalMRFState mrfState
|
2021-07-16 01:32:06 -04:00
|
|
|
|
|
2020-05-12 22:24:59 -04:00
|
|
|
|
// If writes to FS backend should be O_SYNC.
|
|
|
|
|
globalFSOSync bool
|
2020-05-23 20:38:39 -04:00
|
|
|
|
|
2020-07-03 14:53:03 -04:00
|
|
|
|
globalProxyEndpoints []ProxyEndpoint
|
2020-10-16 17:49:05 -04:00
|
|
|
|
|
2020-11-02 10:43:11 -05:00
|
|
|
|
globalInternodeTransport http.RoundTripper
|
|
|
|
|
|
2020-12-22 00:42:38 -05:00
|
|
|
|
globalProxyTransport http.RoundTripper
|
|
|
|
|
|
2022-06-22 19:28:25 -04:00
|
|
|
|
globalRemoteTargetTransport http.RoundTripper
|
|
|
|
|
|
2021-10-05 13:13:04 -04:00
|
|
|
|
globalDNSCache = &dnscache.Resolver{
|
|
|
|
|
Timeout: 5 * time.Second,
|
|
|
|
|
}
|
2021-01-22 18:37:41 -05:00
|
|
|
|
|
|
|
|
|
globalForwarder *handlers.Forwarder
|
2021-04-19 13:30:42 -04:00
|
|
|
|
|
|
|
|
|
globalTierConfigMgr *TierConfigMgr
|
|
|
|
|
|
|
|
|
|
globalTierJournal *tierJournal
|
|
|
|
|
|
2021-08-31 21:52:48 -04:00
|
|
|
|
globalConsoleSrv *restapi.Server
|
|
|
|
|
|
2021-11-23 15:02:16 -05:00
|
|
|
|
// handles service freeze or un-freeze S3 API calls.
|
|
|
|
|
globalServiceFreeze atomic.Value
|
|
|
|
|
|
|
|
|
|
// Only needed for tracking
|
|
|
|
|
globalServiceFreezeCnt int32
|
|
|
|
|
globalServiceFreezeMu sync.Mutex // Updates.
|
|
|
|
|
|
2022-01-24 14:28:45 -05:00
|
|
|
|
// List of local drives to this node, this is only set during server startup.
|
|
|
|
|
globalLocalDrives []StorageAPI
|
|
|
|
|
|
2022-01-24 20:09:12 -05:00
|
|
|
|
// Is MINIO_CI_CD set?
|
|
|
|
|
globalIsCICD bool
|
|
|
|
|
|
|
|
|
|
globalRootDiskThreshold uint64
|
2022-03-08 12:54:38 -05:00
|
|
|
|
|
|
|
|
|
// Used for collecting stats for netperf
|
2022-04-08 00:20:40 -04:00
|
|
|
|
globalNetPerfMinDuration = time.Second * 10
|
|
|
|
|
globalNetPerfRX netPerfRX
|
|
|
|
|
globalObjectPerfBucket = "minio-perf-test-tmp-bucket"
|
|
|
|
|
globalObjectPerfUserMetadata = "X-Amz-Meta-Minio-Object-Perf" // Clients can set this to bypass S3 API service freeze. Used by object pref tests.
|
2022-03-08 12:54:38 -05:00
|
|
|
|
|
2022-06-27 06:59:41 -04:00
|
|
|
|
// MinIO version unix timestamp
|
|
|
|
|
globalVersionUnix uint64
|
|
|
|
|
|
2022-07-12 13:12:47 -04:00
|
|
|
|
// MinIO client
|
|
|
|
|
globalMinioClient *minio.Client
|
|
|
|
|
|
2018-02-02 21:18:52 -05:00
|
|
|
|
// Add new variable global values here.
|
2016-09-09 18:33:35 -04:00
|
|
|
|
)
|
|
|
|
|
|
2022-08-08 19:16:27 -04:00
|
|
|
|
var globalAuthPluginMutex sync.Mutex
|
|
|
|
|
|
|
|
|
|
func newGlobalAuthNPluginFn() *idplugin.AuthNPlugin {
|
|
|
|
|
globalAuthPluginMutex.Lock()
|
|
|
|
|
defer globalAuthPluginMutex.Unlock()
|
|
|
|
|
return globalAuthNPlugin
|
|
|
|
|
}
|
2022-05-25 21:32:53 -04:00
|
|
|
|
|
|
|
|
|
func newGlobalAuthZPluginFn() *polplugin.AuthZPlugin {
|
2022-08-08 19:16:27 -04:00
|
|
|
|
globalAuthPluginMutex.Lock()
|
|
|
|
|
defer globalAuthPluginMutex.Unlock()
|
2022-05-25 21:32:53 -04:00
|
|
|
|
return globalAuthZPlugin
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-08 19:16:27 -04:00
|
|
|
|
func setGlobalAuthNPlugin(authn *idplugin.AuthNPlugin) {
|
|
|
|
|
globalAuthPluginMutex.Lock()
|
|
|
|
|
globalAuthNPlugin = authn
|
|
|
|
|
globalAuthPluginMutex.Unlock()
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-25 21:32:53 -04:00
|
|
|
|
func setGlobalAuthZPlugin(authz *polplugin.AuthZPlugin) {
|
2022-08-08 19:16:27 -04:00
|
|
|
|
globalAuthPluginMutex.Lock()
|
2022-05-25 21:32:53 -04:00
|
|
|
|
globalAuthZPlugin = authz
|
2022-08-08 19:16:27 -04:00
|
|
|
|
globalAuthPluginMutex.Unlock()
|
2022-05-25 21:32:53 -04:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-31 12:11:37 -04:00
|
|
|
|
var errSelfTestFailure = errors.New("self test failed. unsafe to start server")
|