Disable printing access/secrets in systemd (#6621)

Minio when run as a service in `systemd` should
avoid printing access/secret keys.
master
Harshavardhana 6 years ago committed by Dee Koder
parent 1e7e5e297c
commit 21c8693d9c
  1. 6
      cmd/gateway-startup-msg.go
  2. 26
      cmd/server-startup-msg.go

@ -57,8 +57,10 @@ func printGatewayCommonMsg(apiEndpoints []string) {
apiEndpointStr := strings.Join(apiEndpoints, " ") apiEndpointStr := strings.Join(apiEndpoints, " ")
// Colorize the message and print. // Colorize the message and print.
logger.StartupMessage(colorBlue("\nEndpoint: ") + colorBold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr))) logger.StartupMessage(colorBlue("\nEndpoint: ") + colorBold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr)))
logger.StartupMessage(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKey))) if isTerminal() {
logger.StartupMessage(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretKey))) logger.StartupMessage(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKey)))
logger.StartupMessage(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretKey)))
}
if globalIsBrowserEnabled { if globalIsBrowserEnabled {
logger.StartupMessage(colorBlue("\nBrowser Access:")) logger.StartupMessage(colorBlue("\nBrowser Access:"))

@ -116,10 +116,12 @@ func printServerCommonMsg(apiEndpoints []string) {
// Colorize the message and print. // Colorize the message and print.
logger.StartupMessage(colorBlue("Endpoint: ") + colorBold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr))) logger.StartupMessage(colorBlue("Endpoint: ") + colorBold(fmt.Sprintf(getFormatStr(len(apiEndpointStr), 1), apiEndpointStr)))
logger.StartupMessage(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKey))) if isTerminal() {
logger.StartupMessage(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretKey))) logger.StartupMessage(colorBlue("AccessKey: ") + colorBold(fmt.Sprintf("%s ", cred.AccessKey)))
if region != "" { logger.StartupMessage(colorBlue("SecretKey: ") + colorBold(fmt.Sprintf("%s ", cred.SecretKey)))
logger.StartupMessage(colorBlue("Region: ") + colorBold(fmt.Sprintf(getFormatStr(len(region), 3), region))) if region != "" {
logger.StartupMessage(colorBlue("Region: ") + colorBold(fmt.Sprintf(getFormatStr(len(region), 3), region)))
}
} }
printEventNotifiers() printEventNotifiers()
@ -151,13 +153,15 @@ func printCLIAccessMsg(endPoint string, alias string) {
cred := globalServerConfig.GetCredential() cred := globalServerConfig.GetCredential()
// Configure 'mc', following block prints platform specific information for minio client. // Configure 'mc', following block prints platform specific information for minio client.
logger.StartupMessage(colorBlue("\nCommand-line Access: ") + mcQuickStartGuide) if isTerminal() {
if runtime.GOOS == globalWindowsOSName { logger.StartupMessage(colorBlue("\nCommand-line Access: ") + mcQuickStartGuide)
mcMessage := fmt.Sprintf("$ mc.exe config host add %s %s %s %s", alias, endPoint, cred.AccessKey, cred.SecretKey) if runtime.GOOS == globalWindowsOSName {
logger.StartupMessage(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage)) mcMessage := fmt.Sprintf("$ mc.exe config host add %s %s %s %s", alias, endPoint, cred.AccessKey, cred.SecretKey)
} else { logger.StartupMessage(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage))
mcMessage := fmt.Sprintf("$ mc config host add %s %s %s %s", alias, endPoint, cred.AccessKey, cred.SecretKey) } else {
logger.StartupMessage(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage)) mcMessage := fmt.Sprintf("$ mc config host add %s %s %s %s", alias, endPoint, cred.AccessKey, cred.SecretKey)
logger.StartupMessage(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage))
}
} }
} }

Loading…
Cancel
Save