PLT-7517 Added setting to enable tracing of Amazon S3 connections (#7349)
* PLT-7517 Added setting to enable tracing of Amazon S3 connections * Removed unnecessary placeholders on boolean settings * Added AmazonS3Trace to diagnostics * Updated AmazonS3Trace setting name in system console * Removing extra colon
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cc289d7061
Коммит
09f8267751
@@ -290,6 +290,7 @@ func trackConfig() {
|
||||
"amazon_s3_ssl": *utils.Cfg.FileSettings.AmazonS3SSL,
|
||||
"amazon_s3_sse": *utils.Cfg.FileSettings.AmazonS3SSE,
|
||||
"amazon_s3_signv2": *utils.Cfg.FileSettings.AmazonS3SignV2,
|
||||
"amazon_s3_trace": *utils.Cfg.FileSettings.AmazonS3Trace,
|
||||
"max_file_size": *utils.Cfg.FileSettings.MaxFileSize,
|
||||
"enable_file_attachments": *utils.Cfg.FileSettings.EnableFileAttachments,
|
||||
"enable_mobile_upload": *utils.Cfg.FileSettings.EnableMobileUpload,
|
||||
|
||||
@@ -131,7 +131,8 @@
|
||||
"AmazonS3Endpoint": "s3.amazonaws.com",
|
||||
"AmazonS3SSL": true,
|
||||
"AmazonS3SignV2": false,
|
||||
"AmazonS3SSE": false
|
||||
"AmazonS3SSE": false,
|
||||
"AmazonS3Trace": false
|
||||
},
|
||||
"EmailSettings": {
|
||||
"EnableSignUpWithEmail": true,
|
||||
|
||||
@@ -272,6 +272,7 @@ type FileSettings struct {
|
||||
AmazonS3SSL *bool
|
||||
AmazonS3SignV2 *bool
|
||||
AmazonS3SSE *bool
|
||||
AmazonS3Trace *bool
|
||||
}
|
||||
|
||||
type EmailSettings struct {
|
||||
@@ -607,6 +608,11 @@ func (o *Config) SetDefaults() {
|
||||
*o.FileSettings.AmazonS3SSE = false // Not Encrypted by default.
|
||||
}
|
||||
|
||||
if o.FileSettings.AmazonS3Trace == nil {
|
||||
o.FileSettings.AmazonS3Trace = new(bool)
|
||||
*o.FileSettings.AmazonS3Trace = false
|
||||
}
|
||||
|
||||
if o.FileSettings.EnableFileAttachments == nil {
|
||||
o.FileSettings.EnableFileAttachments = new(bool)
|
||||
*o.FileSettings.EnableFileAttachments = true
|
||||
|
||||
@@ -33,7 +33,17 @@ func s3New(endpoint, accessKey, secretKey string, secure bool, signV2 bool, regi
|
||||
} else {
|
||||
creds = credentials.NewStatic(accessKey, secretKey, "", credentials.SignatureV4)
|
||||
}
|
||||
return s3.NewWithCredentials(endpoint, creds, secure, region)
|
||||
|
||||
s3Clnt, err := s3.NewWithCredentials(endpoint, creds, secure, region)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if *Cfg.FileSettings.AmazonS3Trace {
|
||||
s3Clnt.TraceOn(os.Stdout)
|
||||
}
|
||||
|
||||
return s3Clnt, nil
|
||||
}
|
||||
|
||||
func TestFileConnection() *model.AppError {
|
||||
|
||||
@@ -37,6 +37,7 @@ export default class StorageSettings extends AdminSettings {
|
||||
config.FileSettings.AmazonS3Endpoint = this.state.amazonS3Endpoint;
|
||||
config.FileSettings.AmazonS3SSL = this.state.amazonS3SSL;
|
||||
config.FileSettings.AmazonS3SSE = this.state.amazonS3SSE;
|
||||
config.FileSettings.AmazonS3Trace = this.state.amazonS3Trace;
|
||||
|
||||
return config;
|
||||
}
|
||||
@@ -54,7 +55,8 @@ export default class StorageSettings extends AdminSettings {
|
||||
amazonS3Bucket: config.FileSettings.AmazonS3Bucket,
|
||||
amazonS3Endpoint: config.FileSettings.AmazonS3Endpoint,
|
||||
amazonS3SSL: config.FileSettings.AmazonS3SSL,
|
||||
amazonS3SSE: config.FileSettings.AmazonS3SSE
|
||||
amazonS3SSE: config.FileSettings.AmazonS3SSE,
|
||||
amazonS3Trace: config.FileSettings.AmazonS3Trace
|
||||
};
|
||||
}
|
||||
|
||||
@@ -125,7 +127,6 @@ export default class StorageSettings extends AdminSettings {
|
||||
defaultMessage='Enable Server-Side Encryption for Amazon S3:'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.image.amazonS3SSEExample', 'Ex "false"')}
|
||||
helpText={
|
||||
<FormattedHTMLMessage
|
||||
id='admin.image.amazonS3SSEDescription'
|
||||
@@ -267,7 +268,6 @@ export default class StorageSettings extends AdminSettings {
|
||||
defaultMessage='Enable Secure Amazon S3 Connections:'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.image.amazonS3SSLExample', 'Ex "true"')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.image.amazonS3SSLDescription'
|
||||
@@ -279,6 +279,24 @@ export default class StorageSettings extends AdminSettings {
|
||||
disabled={this.state.driverName !== DRIVER_S3}
|
||||
/>
|
||||
{amazonSSEComp}
|
||||
<BooleanSetting
|
||||
id='amazonS3Trace'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.image.amazonS3TraceTitle'
|
||||
defaultMessage='Enable Amazon S3 Debugging:'
|
||||
/>
|
||||
}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.image.amazonS3TraceDescription'
|
||||
defaultMessage='(Development Mode) When true, log additional debugging information to the system logs.'
|
||||
/>
|
||||
}
|
||||
value={this.state.amazonS3Trace}
|
||||
onChange={this.handleChange}
|
||||
disabled={this.state.driverName !== DRIVER_S3}
|
||||
/>
|
||||
<BooleanSetting
|
||||
id='enableFileAttachments'
|
||||
label={
|
||||
|
||||
@@ -479,14 +479,14 @@
|
||||
"admin.image.amazonS3RegionExample": "E.g.: \"us-east-1\"",
|
||||
"admin.image.amazonS3RegionTitle": "Amazon S3 Region:",
|
||||
"admin.image.amazonS3SSEDescription": "When true, encrypt files in Amazon S3 using server-side encryption with Amazon S3-managed keys. See <a href=\"https://about.mattermost.com/default-server-side-encryption\">documentation</a> to learn more.",
|
||||
"admin.image.amazonS3SSEExample": "E.g.: \"false\"",
|
||||
"admin.image.amazonS3SSETitle": "Enable Server-Side Encryption for Amazon S3:",
|
||||
"admin.image.amazonS3SSLDescription": "When false, allow insecure connections to Amazon S3. Defaults to secure connections only.",
|
||||
"admin.image.amazonS3SSLExample": "E.g.: \"true\"",
|
||||
"admin.image.amazonS3SSLTitle": "Enable Secure Amazon S3 Connections:",
|
||||
"admin.image.amazonS3SecretDescription": "Obtain this credential from your Amazon EC2 administrator.",
|
||||
"admin.image.amazonS3SecretExample": "E.g.: \"jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY\"",
|
||||
"admin.image.amazonS3SecretTitle": "Amazon S3 Secret Access Key:",
|
||||
"admin.image.amazonS3TraceDescription": "(Development Mode) When true, log additional debugging information to the system logs.",
|
||||
"admin.image.amazonS3TraceTitle": "Enable Amazon S3 Debugging:",
|
||||
"admin.image.localDescription": "Directory to which files and images are written. If blank, defaults to ./data/.",
|
||||
"admin.image.localExample": "E.g.: \"./data/\"",
|
||||
"admin.image.localTitle": "Local Storage Directory:",
|
||||
|
||||
Ссылка в новой задаче
Block a user