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

Reset mtime of source private keys to default creation time #6270

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Feb 14, 2022

Status

Ready for review

Description of Changes

We set the GPG key creation time to 2013-05-14 to hide when they
were created, revealing when a source started using SecureDrop. However
this information was being leaked via the file modification time of the
private key material in the $keydir/private-keys-v1.d/ folder.

We set the GPG key creation time to 2013-05-14 to hide when they
were created, revealing when a source started using SecureDrop. However
this information was being leaked via the file modification time of the
private key material in the $keydir/private-keys-v1.d/ folder.

While we can easily change a file's mtime to a past date, faking the
ctime really isn't possible. So instead we touch each private key when
the source app starts to mask the real creation time. Because of the
nightly restarts, this will be updated within 24 hours of source
creation.

Fixes https://github.com/freedomofpress/securedrop-security/issues/71.

Testing

  • Start dev container, look at mtime+ctime of private keys in /var/lib/securedrop/keys/private-keys-v1.d, wait a minute, make a whitespace-only change to source_app/__init__.py so the auto reloader restarts the app. Look at mtime+ctime of private keys, they should be different.
  • On staging/prod, install SD, create a source. See mtime+ctime of private keys are the time of creation. Reboot the server, look again and see that mtime+ctime of private keys is now when the server was rebooted.

Deployment

Any special considerations for deployment? Not really.

Checklist

  • Linting (make lint) and tests (make test) pass in the development container
  • I have written a test plan and validated it for this PR
  • These changes do not require documentation

@legoktm legoktm requested a review from a team as a code owner February 14, 2022 21:35
@codecov-commenter
Copy link

codecov-commenter commented Feb 14, 2022

Codecov Report

Merging #6270 (bff89a3) into develop (1d37d20) will decrease coverage by 0.01%.
The diff coverage is 77.77%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6270      +/-   ##
===========================================
- Coverage    84.09%   84.07%   -0.02%     
===========================================
  Files           60       60              
  Lines         4199     4208       +9     
  Branches       506      508       +2     
===========================================
+ Hits          3531     3538       +7     
- Misses         548      549       +1     
- Partials       120      121       +1     
Impacted Files Coverage Δ
securedrop/source_app/__init__.py 90.32% <77.77%> (-1.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d37d20...bff89a3. Read the comment docs.

@zenmonkeykstop zenmonkeykstop self-assigned this Feb 14, 2022
We set the GPG key creation time to 2013-05-14 to hide when they
were created, revealing when a source started using SecureDrop. However
this information was being leaked via the file modification time of the
private key material in the $keydir/private-keys-v1.d/ folder.

While we can easily change a file's mtime to a past date, faking the
ctime really isn't possible. So instead we touch each private key when
the source app starts to mask the real creation time. Because of the
nightly restarts, this will be updated within 24 hours of source
creation.

Fixes freedomofpress/securedrop-security#71.
Copy link
Contributor

@zenmonkeykstop zenmonkeykstop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in both dev and staging environments, verified mtime and ctimes changes with stat - looking good!

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.

3 participants