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