1 |
On 02/01/2018 04:17 AM, Michał Górny wrote: |
2 |
> Issue an explicit warning if the Manifest timestamp is 24 hours behind |
3 |
> the system clock. This is meant to detect attacks based on preventing |
4 |
> the user from upgrading. |
5 |
> --- |
6 |
> pym/portage/sync/modules/rsync/rsync.py | 6 ++++++ |
7 |
> 1 file changed, 6 insertions(+) |
8 |
> |
9 |
> diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
10 |
> index b7758c2c3..9c352b139 100644 |
11 |
> --- a/pym/portage/sync/modules/rsync/rsync.py |
12 |
> +++ b/pym/portage/sync/modules/rsync/rsync.py |
13 |
> @@ -6,6 +6,7 @@ import logging |
14 |
> import time |
15 |
> import signal |
16 |
> import socket |
17 |
> +import datetime |
18 |
> import io |
19 |
> import re |
20 |
> import random |
21 |
> @@ -339,6 +340,11 @@ class RsyncSync(NewBase): |
22 |
> ts = m.find_timestamp() |
23 |
> if ts is None: |
24 |
> raise RuntimeError('Timestamp not found in Manifest') |
25 |
> + if (datetime.datetime.utcnow() - ts.ts).days > 1: |
26 |
> + out.ewarn('Manifest is over 24 hours old, this is suspicious!') |
27 |
> + out.ewarn('You may want to try using another mirror and/or reporting this one:') |
28 |
> + out.ewarn(' %s' % (dosyncuri,)) |
29 |
> + out.ewarn('') |
30 |
> |
31 |
> out.einfo('Manifest timestamp: %s UTC' % (ts.ts,)) |
32 |
> out.einfo('Valid OpenPGP signature found:') |
33 |
> |
34 |
|
35 |
This warning is gentoo-centric. We probably want to be able to override |
36 |
the number of days via layout.conf and repos.conf. |
37 |
-- |
38 |
Thanks, |
39 |
Zac |