This commit adds support for custom DNS overwrites via one or multiple --resolve flags. It allows mc users to define custom DNS mappings from a HOST (and optional port) to an IP address.
For example:
mc --resolve foo.com:9000:10.1.2.3 ls myminio/mybucket
The --resolve syntax is taken from cURL. Ref. curl --help dns
Use cases:
DNS overwrites. If there are no DNS resolvers available, e.g. due to a temp. outage, this allows mc to connect to a defined alias as long as the IP of the one or multiple cluster nodes are known. It also allows mc to overwrite the current DNS responses. This is useful for various tests in dev and staging environments.
TLS certificate verification. Often TLS certificates are issued for some DNS names (via SAN) but not for IP addresses. IP addresses are usually not static and might change anytime. Accessing a MinIO cluster that serves a certificate containing only DNS SANs via an IP address results in a TLS certificate verification error - even if the certificate is issued by a trusted CA. The current workaround is the --insecure flag which disables TLS certification completely.
Example for TLS verification:
$ mc alias set 'myminio' 'https://192.168.188.118:9000' 'minioadmin' 'minioadmin'
mc: <ERROR> Unable to initialize new alias from the provided credentials.
Get "https://192.168.188.118:9000": tls: failed to verify certificate:
x509: cannot validate certificate for 192.168.188.118 because it doesn't contain any IP SANs.
mc alias set --resolve foo.com:9000:192.168.188.118 'myminio' 'https://foo.com:9000' 'minioadmin' 'minioadmin'
Added `myminio` successfully.
Motivation and Context
TLS
How to test this PR?
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Optimization (provides speedup with no functional changes)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[ ] Fixes a regression (If yes, please add commit-id or PR # here)
minio server /tmp/data &
mc alias set --resolve minio.train:9000=127.0.0.1 resolved http://minio.train:9000 minioadmin minioadmin
mc admin info resolved --resolve minio.train:9000=127.0.0.1
Description
This commit adds support for custom DNS overwrites via one or multiple
--resolve
flags. It allowsmc
users to define custom DNS mappings from a HOST (and optional port) to an IP address.For example:
The
--resolve
syntax is taken from cURL. Ref.curl --help dns
Use cases:
mc
to connect to a defined alias as long as the IP of the one or multiple cluster nodes are known. It also allowsmc
to overwrite the current DNS responses. This is useful for various tests in dev and staging environments.--insecure
flag which disables TLS certification completely.Example for TLS verification:
Motivation and Context
TLS
How to test this PR?
Types of changes
Checklist:
commit-id
orPR #
here)