Merge lp:~fredrik-loch/duplicity/duplicity-S3-SSE into lp:duplicity/0.6

Proposed by senjindarashiva
Status: Merged
Merged at revision: 968
Proposed branch: lp:~fredrik-loch/duplicity/duplicity-S3-SSE
Merge into: lp:duplicity/0.6
Diff against target: 64 lines (+16/-2)
4 files modified
duplicity/backends/_boto_multi.py (+1/-1)
duplicity/backends/_boto_single.py (+9/-1)
duplicity/commandline.py (+3/-0)
duplicity/globals.py (+3/-0)
To merge this branch: bzr merge lp:~fredrik-loch/duplicity/duplicity-S3-SSE
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+214949@code.launchpad.net

Description of the change

Adds support for server side encryption as requested in Bug #996660

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backends/_boto_multi.py'
2--- duplicity/backends/_boto_multi.py 2014-02-26 19:48:56 +0000
3+++ duplicity/backends/_boto_multi.py 2014-04-09 13:40:03 +0000
4@@ -125,7 +125,7 @@
5
6 log.Debug("Uploading %d bytes in %d chunks" % (bytes, chunks))
7
8- mp = self.bucket.initiate_multipart_upload(key.key, headers)
9+ mp = self.bucket.initiate_multipart_upload(key.key, headers,encrypt_key=globals.s3_use_sse)
10
11 # Initiate a queue to share progress data between the pool
12 # workers and a consumer thread, that will collect and report
13
14=== modified file 'duplicity/backends/_boto_single.py'
15--- duplicity/backends/_boto_single.py 2014-03-06 14:21:34 +0000
16+++ duplicity/backends/_boto_single.py 2014-04-09 13:40:03 +0000
17@@ -232,10 +232,18 @@
18 storage_class = 'STANDARD'
19 log.Info("Uploading %s/%s to %s Storage" % (self.straight_url, remote_filename, storage_class))
20 try:
21- headers = {
22+ if globals.s3_use_sse:
23+ headers = {
24+ 'Content-Type': 'application/octet-stream',
25+ 'x-amz-storage-class': storage_class,
26+ 'x-amz-server-side-encryption': 'AES256'
27+ }
28+ else:
29+ headers = {
30 'Content-Type': 'application/octet-stream',
31 'x-amz-storage-class': storage_class
32 }
33+
34 upload_start = time.time()
35 self.upload(source_path.name, key, headers)
36 upload_end = time.time()
37
38=== modified file 'duplicity/commandline.py'
39--- duplicity/commandline.py 2014-03-09 20:37:24 +0000
40+++ duplicity/commandline.py 2014-04-09 13:40:03 +0000
41@@ -511,6 +511,9 @@
42 if sys.version_info[:2] >= (2, 6):
43 parser.add_option("--s3-use-multiprocessing", action = "store_true")
44
45+ # Option to allow use of server side encryption in s3
46+ parser.add_option("--s3-use-server-side-encryption", action="store_true", dest="s3_use_sse")
47+
48 # scp command to use (ssh pexpect backend)
49 parser.add_option("--scp-command", metavar = _("command"))
50
51
52=== modified file 'duplicity/globals.py'
53--- duplicity/globals.py 2014-03-09 20:37:24 +0000
54+++ duplicity/globals.py 2014-04-09 13:40:03 +0000
55@@ -206,6 +206,9 @@
56 # Maximum time to wait for a part to finish when doig a multipart upload to S3
57 s3_multipart_max_timeout = None
58
59+# Use server side encryption in s3
60+s3_use_sse = False
61+
62 # Whether to use the full email address as the user name when
63 # logging into an imap server. If false just the user name
64 # part of the email address is used.

Subscribers

People subscribed via source and target branches