PLT-7360 Adding SSE to compliance (#7165)
* Adding SSE to E20 * Fixing UI bug * Fixing loc strings
Этот коммит содержится в:
коммит произвёл
Saturnino Abril
родитель
3ff4719d46
Коммит
48741434aa
11
app/file.go
11
app/file.go
@@ -115,8 +115,11 @@ func MoveFile(oldPath, newPath string) *model.AppError {
|
|||||||
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
|
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
|
||||||
secure := *utils.Cfg.FileSettings.AmazonS3SSL
|
secure := *utils.Cfg.FileSettings.AmazonS3SSL
|
||||||
signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2
|
signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2
|
||||||
encrypt := *utils.Cfg.FileSettings.AmazonS3SSE
|
|
||||||
region := utils.Cfg.FileSettings.AmazonS3Region
|
region := utils.Cfg.FileSettings.AmazonS3Region
|
||||||
|
encrypt := false
|
||||||
|
if *utils.Cfg.FileSettings.AmazonS3SSE && utils.IsLicensed && *utils.License.Features.Compliance {
|
||||||
|
encrypt = true
|
||||||
|
}
|
||||||
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2, region)
|
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2, region)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewLocAppError("moveFile", "api.file.write_file.s3.app_error", nil, err.Error())
|
return model.NewLocAppError("moveFile", "api.file.write_file.s3.app_error", nil, err.Error())
|
||||||
@@ -156,8 +159,12 @@ func WriteFile(f []byte, path string) *model.AppError {
|
|||||||
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
|
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
|
||||||
secure := *utils.Cfg.FileSettings.AmazonS3SSL
|
secure := *utils.Cfg.FileSettings.AmazonS3SSL
|
||||||
signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2
|
signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2
|
||||||
encrypt := *utils.Cfg.FileSettings.AmazonS3SSE
|
|
||||||
region := utils.Cfg.FileSettings.AmazonS3Region
|
region := utils.Cfg.FileSettings.AmazonS3Region
|
||||||
|
encrypt := false
|
||||||
|
if *utils.Cfg.FileSettings.AmazonS3SSE && utils.IsLicensed && *utils.License.Features.Compliance {
|
||||||
|
encrypt = true
|
||||||
|
}
|
||||||
|
|
||||||
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2, region)
|
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2, region)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewLocAppError("WriteFile", "api.file.write_file.s3.app_error", nil, err.Error())
|
return model.NewLocAppError("WriteFile", "api.file.write_file.s3.app_error", nil, err.Error())
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export default class StorageSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderSettings() {
|
renderSettings() {
|
||||||
|
let amazonSSEComp;
|
||||||
const mobileUploadDownloadSettings = [];
|
const mobileUploadDownloadSettings = [];
|
||||||
if (window.mm_license.IsLicensed === 'true' && window.mm_license.Compliance === 'true') {
|
if (window.mm_license.IsLicensed === 'true' && window.mm_license.Compliance === 'true') {
|
||||||
mobileUploadDownloadSettings.push(
|
mobileUploadDownloadSettings.push(
|
||||||
@@ -113,6 +114,29 @@ export default class StorageSettings extends AdminSettings {
|
|||||||
disabled={!this.state.enableFileAttachments}
|
disabled={!this.state.enableFileAttachments}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
amazonSSEComp =
|
||||||
|
(
|
||||||
|
<BooleanSetting
|
||||||
|
id='amazonS3SSE'
|
||||||
|
label={
|
||||||
|
<FormattedMessage
|
||||||
|
id='admin.image.amazonS3SSETitle'
|
||||||
|
defaultMessage='Enable Server-Side Encryption for Amazon S3:'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
placeholder={Utils.localizeMessage('admin.image.amazonS3SSEExample', 'Ex "false"')}
|
||||||
|
helpText={
|
||||||
|
<FormattedHTMLMessage
|
||||||
|
id='admin.image.amazonS3SSEDescription'
|
||||||
|
defaultMessage='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" target="_blank">documentation</a> to learn more.'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value={this.state.amazonS3SSE}
|
||||||
|
onChange={this.handleChange}
|
||||||
|
disabled={this.state.driverName !== DRIVER_S3}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -254,25 +278,7 @@ export default class StorageSettings extends AdminSettings {
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
disabled={this.state.driverName !== DRIVER_S3}
|
disabled={this.state.driverName !== DRIVER_S3}
|
||||||
/>
|
/>
|
||||||
<BooleanSetting
|
{amazonSSEComp}
|
||||||
id='AmazonSSE'
|
|
||||||
label={
|
|
||||||
<FormattedMessage
|
|
||||||
id='admin.image.AmazonSSETitle'
|
|
||||||
defaultMessage='Enable Server-Side Encryption for Amazon S3:'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
placeholder={Utils.localizeMessage('admin.image.AmazonSSEExample', 'Ex "false"')}
|
|
||||||
helpText={
|
|
||||||
<FormattedMessage
|
|
||||||
id='admin.image.AmazonSSEDescription'
|
|
||||||
defaultMessage='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" target="_blank">documentation</a> to learn more.'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
value={this.state.AmazonSSE}
|
|
||||||
onChange={this.handleChange}
|
|
||||||
disabled={this.state.driverName !== DRIVER_S3}
|
|
||||||
/>
|
|
||||||
<BooleanSetting
|
<BooleanSetting
|
||||||
id='enableFileAttachments'
|
id='enableFileAttachments'
|
||||||
label={
|
label={
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user