change encryption to be on by default (repokey mode)

it's 2015, let's be safe-by-default and unsafe-as-option.

also: show default mode in builtin help
This commit is contained in:
Thomas Waldmann 2015-12-19 14:30:05 +01:00
parent 169634f2ca
commit 6d615ec30a
5 changed files with 10 additions and 8 deletions

View file

@ -64,7 +64,6 @@ class Archiver:
repository = RemoteRepository(location, create=create, lock_wait=self.lock_wait, lock=lock, args=args)
else:
repository = Repository(location.path, create=create, exclusive=exclusive, lock_wait=self.lock_wait, lock=lock)
repository._location = location
return repository
def print_error(self, msg, *args):
@ -797,8 +796,8 @@ class Archiver:
type=location_validator(archive=False),
help='repository to create')
subparser.add_argument('-e', '--encryption', dest='encryption',
choices=('none', 'keyfile', 'repokey', 'passphrase'), default='none',
help='select encryption key mode')
choices=('none', 'keyfile', 'repokey', 'passphrase'), default='repokey',
help='select encryption key mode (default: "%(default)s")')
check_epilog = textwrap.dedent("""
The check command verifies the consistency of a repository and the corresponding archives.

View file

@ -129,7 +129,7 @@ class RemoteRepository:
self.name = name
def __init__(self, location, create=False, lock_wait=None, lock=True, args=None):
self.location = location
self.location = self._location = location
self.preload_ids = []
self.msgid = 0
self.to_send = b''

View file

@ -11,7 +11,7 @@ import struct
from zlib import crc32
import msgpack
from .helpers import Error, ErrorWithTraceback, IntegrityError, ProgressIndicatorPercent
from .helpers import Error, ErrorWithTraceback, IntegrityError, Location, ProgressIndicatorPercent
from .hashindex import NSIndex
from .locking import UpgradableLock, LockError, LockErrorT
from .lrucache import LRUCache
@ -54,6 +54,7 @@ class Repository:
def __init__(self, path, create=False, exclusive=False, lock_wait=None, lock=True):
self.path = os.path.abspath(path)
self._location = Location('file://%s' % self.path)
self.io = None
self.lock = None
self.index = None

View file

@ -92,7 +92,7 @@ def test_return_codes(cmd, tmpdir):
input = tmpdir.mkdir('input')
output = tmpdir.mkdir('output')
input.join('test_file').write('content')
rc, out = cmd('init', '%s' % str(repo))
rc, out = cmd('init', '--encryption=none', '%s' % str(repo))
assert rc == EXIT_SUCCESS
rc, out = cmd('create', '%s::archive' % repo, str(input))
assert rc == EXIT_SUCCESS
@ -192,6 +192,7 @@ class ArchiverTestCaseBase(BaseTestCase):
def setUp(self):
os.environ['BORG_CHECK_I_KNOW_WHAT_I_AM_DOING'] = '1'
os.environ['BORG_DELETE_I_KNOW_WHAT_I_AM_DOING'] = '1'
os.environ['BORG_PASSPHRASE'] = 'waytooeasyonlyfortests'
self.archiver = not self.FORK_DEFAULT and Archiver() or None
self.tmpdir = tempfile.mkdtemp()
self.repository_path = os.path.join(self.tmpdir, 'repository')

View file

@ -146,9 +146,10 @@ Keep an eye on CPU load and throughput.
Repository encryption
---------------------
Repository encryption is enabled at repository creation time::
Repository encryption can be enabled or disabled at repository creation time
(the default is enabled, with `repokey` method)::
$ borg init --encryption=repokey|keyfile PATH
$ borg init --encryption=none|repokey|keyfile PATH
When repository encryption is enabled all data is encrypted using 256-bit AES_
encryption and the integrity and authenticity is verified using `HMAC-SHA256`_.