Commit 958af6f5 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'master' into 'master'

Add support for AWS S3 Server-Side Encryption support

This adds support for AWS S3 SSE with S3 managed keys, this means the
data is encrypted at rest and the encryption is handled transparently to
the end user as well as in the AWS Console.

## Points to double check
I'm unsure on the best way to the handle the default. I've followed the `multipart_upload` de facto in the app. I'm happy to change this if required or if it will impact elsewhere e.g. omnibus packages

I also think I've managed to catch all of the documentation for this change as well.

### Why is this required
Many enterprises require good backup support but also for this to be encrypted. By default backups aren't encrypted, this allows at rest encryption to be supported in GitLab backups providing a layer of security should the physical media not be properly disposed of.

Relates to issue #2478.


See merge request !1280
parents e1b7fced 253d2320
...@@ -33,6 +33,7 @@ v 8.0.2 ...@@ -33,6 +33,7 @@ v 8.0.2
- Use standard Markdown font in Markdown preview instead of fixed-width font (Stan Hu) - Use standard Markdown font in Markdown preview instead of fixed-width font (Stan Hu)
- Fix Reply by email for non-UTF-8 messages. - Fix Reply by email for non-UTF-8 messages.
- Add option to use StartTLS with Reply by email IMAP server. - Add option to use StartTLS with Reply by email IMAP server.
- Allow AWS S3 Server-Side Encryption with Amazon S3-Managed Keys for backups (Paul Beattie)
v 8.0.1 v 8.0.1
- Remove git refs used internally by GitLab from network graph (Stan Hu) - Remove git refs used internally by GitLab from network graph (Stan Hu)
......
...@@ -319,6 +319,8 @@ production: &base ...@@ -319,6 +319,8 @@ production: &base
# # Use multipart uploads when file size reaches 100MB, see # # Use multipart uploads when file size reaches 100MB, see
# # http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html # # http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
# multipart_chunk_size: 104857600 # multipart_chunk_size: 104857600
# # Turns on AWS Server-Side Encryption with Amazon S3-Managed Keys for backups, this is optional
# # encryption: 'AES256'
## GitLab Shell settings ## GitLab Shell settings
gitlab_shell: gitlab_shell:
......
...@@ -229,6 +229,7 @@ if Settings.backup['upload']['connection'] ...@@ -229,6 +229,7 @@ if Settings.backup['upload']['connection']
Settings.backup['upload']['connection'] = Hash[Settings.backup['upload']['connection'].map { |k, v| [k.to_sym, v] }] Settings.backup['upload']['connection'] = Hash[Settings.backup['upload']['connection'].map { |k, v| [k.to_sym, v] }]
end end
Settings.backup['upload']['multipart_chunk_size'] ||= 104857600 Settings.backup['upload']['multipart_chunk_size'] ||= 104857600
Settings.backup['upload']['encryption'] ||= nil
# #
# Git # Git
......
...@@ -95,6 +95,8 @@ For installations from source: ...@@ -95,6 +95,8 @@ For installations from source:
aws_secret_access_key: 'secret123' aws_secret_access_key: 'secret123'
# The remote 'directory' to store your backups. For S3, this would be the bucket name. # The remote 'directory' to store your backups. For S3, this would be the bucket name.
remote_directory: 'my.s3.bucket' remote_directory: 'my.s3.bucket'
# Turns on AWS Server-Side Encryption with Amazon S3-Managed Keys for backups, this is optional
# encryption: 'AES256'
``` ```
If you are uploading your backups to S3 you will probably want to create a new If you are uploading your backups to S3 you will probably want to create a new
......
...@@ -45,7 +45,8 @@ module Backup ...@@ -45,7 +45,8 @@ module Backup
directory = connection.directories.get(remote_directory) directory = connection.directories.get(remote_directory)
if directory.files.create(key: tar_file, body: File.open(tar_file), public: false, if directory.files.create(key: tar_file, body: File.open(tar_file), public: false,
multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size) multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
encryption: Gitlab.config.backup.upload.encryption)
$progress.puts "done".green $progress.puts "done".green
else else
puts "uploading backup to #{remote_directory} failed".red puts "uploading backup to #{remote_directory} failed".red
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment