Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple keys / seamless key rotation #49

Merged
merged 6 commits into from
Jul 5, 2015
Merged

Support for multiple keys / seamless key rotation #49

merged 6 commits into from
Jul 5, 2015

Conversation

jedisct1
Copy link
Contributor

@jedisct1 jedisct1 commented Jul 5, 2015

Accept multiple keys.

I still need to update the README file, but here is how to seamlessly switch to a new key:

1) Create the first key and its related certificate:

$ dnscrypt-wrapper --gen-crypt-keypair --crypt-secretkey-file=1.key
$ dnscrypt-wrapper --gen-cert-file --crypt-secretkey-file=1.key --provider-cert-file=1.cert

Run the server:

$ dnscrypt-wrapper --resolver-address=114.114.114.114 \
                   --provider-name=2.dnscrypt-example.org \
                   --listen-address=0.0.0.0:443 \
                   --crypt-secretkey-file=1.key \
                   --provider-cert-file=1.cert

2) Before 1.key expires, create a fresh new key and a certificate for it:

$ dnscrypt-wrapper --gen-crypt-keypair --crypt-secretkey-file=2.key
$ dnscrypt-wrapper --gen-cert-file --crypt-secretkey-file=2.key --provider-cert-file=2.cert

Run a new instance of the server, which is going to publish the certificate
for the new key, but still accept queries using the previous key in addition
to the new one (notice the --crypt-secretkey-file= line, which can now include
an arbitrary number of keys):

$ dnscrypt-wrapper --resolver-address=114.114.114.114 \
                   --provider-name=2.dnscrypt-example.org \
                   --listen-address=0.0.0.0:443 \
                   --crypt-secretkey-file=1.key,2.key \
                   --provider-cert-file=2.cert

3) Wait 1 hour and remove the old key:

$ dnscrypt-wrapper --resolver-address=114.114.114.114 \
                   --provider-name=2.dnscrypt-example.org \
                   --listen-address=0.0.0.0:443 \
                   --crypt-secretkey-file=2.key \
                   --provider-cert-file=2.cert

Here is how to seamlessly switch to a new key:

1) Create the first key and its related certificate:

$ dnscrypt-wrapper --gen-crypt-keypair --crypt-secretkey-file=1.key
$ dnscrypt-wrapper --gen-cert-file --crypt-secretkey-file=1.key --provider-cert-file=1.cert

Run the server:

$ dnscrypt-wrapper --resolver-address=114.114.114.114 \
                   --provider-name=2.dnscrypt-example.org \
                   --listen-address=0.0.0.0:443 \
                   --crypt-secretkey-file=1.key \
                   --provider-cert-file=1.cert

2) Before 1.key expires, create a fresh new key and a certificate for it:

$ dnscrypt-wrapper --gen-crypt-keypair --crypt-secretkey-file=2.key
$ dnscrypt-wrapper --gen-cert-file --crypt-secretkey-file=2.key --provider-cert-file=2.cert

Run a new instance of the server, which is going to publish the certificate
for the new key, but still accept queries using the previous key in addition
to the new one (notice the --crypt-secretkey-file= line, which can now include
an arbitrary number of keys):

$ dnscrypt-wrapper --resolver-address=114.114.114.114 \
                   --provider-name=2.dnscrypt-example.org \
                   --listen-address=0.0.0.0:443 \
                   --crypt-secretkey-file=1.key,2.key \
                   --provider-cert-file=2.cert

3) Wait 1 hour and remove the old key:

$ dnscrypt-wrapper --resolver-address=114.114.114.114 \
                   --provider-name=2.dnscrypt-example.org \
                   --listen-address=0.0.0.0:443 \
                   --crypt-secretkey-file=2.key \
                   --provider-cert-file=2.cert
Which is old as well, but what Debian-stable has.
Also make sure that everything works with a minimal Sodium build.
@pysiak
Copy link
Contributor

pysiak commented Jul 5, 2015

This is fantastic! Thanks!

cofyc added a commit that referenced this pull request Jul 5, 2015
Support for multiple keys / seamless key rotation
@cofyc cofyc merged commit e659173 into cofyc:master Jul 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants