Skip to content

Commit

Permalink
🐛 Hotfix for workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelWaldvogel committed Feb 23, 2022
1 parent 71131ae commit 9d6890e
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 98 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/) and this
project adheres to [Semantic Versioning](https://semver.org/).

# 1.1.4 - 2022-02-20
# 1.1.5 - 2022-02-23

## Added

## Fixed

- Hotfix: Bug in workaround from 1.1.4

## Changed

# 1.1.4 - 2022-02-22

## Added

Expand Down
71 changes: 36 additions & 35 deletions tests/50-mailtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand All @@ -20,6 +20,9 @@

# Test mail sending

import zeitgitter.mail
import zeitgitter.stamper
import zeitgitter.config
from datetime import datetime, timezone
import os
from pathlib import Path
Expand All @@ -31,27 +34,24 @@
import sys
sys.path.append('.')

import zeitgitter.config
import zeitgitter.stamper
import zeitgitter.mail

def mailtest():
tmpdir = tempfile.TemporaryDirectory()
zeitgitter.config.get_args(args=[
'-c', 'tests/mailtest.conf',
'--debug', '2',
'--gnupg-home',
str(Path(os.path.dirname(os.path.realpath(__file__)),
'gnupg')),
'--keyid', '353DFEC512FA47C7',
'--own-url', 'https://hagrid.snakeoil',
'--contact', '?',
'--owner', '?',
'--country', '?',
'--max-parallel-timeout', '1',
'--repository', tmpdir.name,
])
zeitgitter.mail.send('''Stamper is a service provided free of charge to Internet users.
tmpdir = tempfile.TemporaryDirectory()
zeitgitter.config.get_args(args=[
'-c', 'tests/mailtest.conf',
'--debug', '2',
'--gnupg-home',
str(Path(os.path.dirname(os.path.realpath(__file__)),
'gnupg')),
'--keyid', '353DFEC512FA47C7',
'--own-url', 'https://hagrid.snakeoil',
'--contact', '?',
'--owner', '?',
'--country', '?',
'--max-parallel-timeout', '1',
'--repository', tmpdir.name,
])
zeitgitter.mail.send('''Stamper is a service provided free of charge to Internet users.
You are very welcome to use Stamper, but you may only do so if
you have first read our Terms of use, which exclude liability on
Expand Down Expand Up @@ -102,9 +102,9 @@ def mailtest():
-----END PGP SIGNATURE-----
''')

p = Path(zeitgitter.config.arg.repository, 'hashes.log')
with open(p, 'w') as f:
f.write('''40324f75a41642f1abf9cf9305f46aa6bfa567e2
p = Path(zeitgitter.config.arg.repository, 'hashes.log')
with open(p, 'w') as f:
f.write('''40324f75a41642f1abf9cf9305f46aa6bfa567e2
73abac26438e48d2af7476f564b97a7baba14645
3f4f63f7dde84822b24e348fd16d50b0aec93fb9
4cd7b8798a6e4c0a9c76ade2b6041b8e1a779458
Expand All @@ -113,18 +113,19 @@ def mailtest():
303cc43ce91547a89daea16c7a695d9896585f17
fa94ffe675454658bd11219693d60844b995a74d
''')
ftime = datetime(year=2019, month=3, day=11,
hour=16, minute=55, second=0,
tzinfo=timezone.utc).timestamp()
os.utime(p, times=(ftime, ftime))
subprocess.run(['git', 'init'],
cwd=zeitgitter.config.arg.repository).check_returncode()
subprocess.run(['git', 'add', 'hashes.log'],
cwd=zeitgitter.config.arg.repository).check_returncode()
subprocess.run(['git', 'commit', '-m', "First commit"],
cwd=zeitgitter.config.arg.repository).check_returncode()
repo = git.Repository(zeitgitter.config.arg.repository)
zeitgitter.mail.wait_for_receive(repo, repo.head, p)
ftime = datetime(year=2019, month=3, day=11,
hour=16, minute=55, second=0,
tzinfo=timezone.utc).timestamp()
os.utime(p, times=(ftime, ftime))
subprocess.run(['git', 'init'],
cwd=zeitgitter.config.arg.repository).check_returncode()
subprocess.run(['git', 'add', 'hashes.log'],
cwd=zeitgitter.config.arg.repository).check_returncode()
subprocess.run(['git', 'commit', '-m', "First commit"],
cwd=zeitgitter.config.arg.repository).check_returncode()
repo = git.Repository(zeitgitter.config.arg.repository)
zeitgitter.mail.wait_for_receive(repo, repo.head, p)


if os.path.isfile('tests/mailtest.conf'):
mailtest()
Expand Down
3 changes: 2 additions & 1 deletion zeitgitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand All @@ -20,5 +20,6 @@

import os


def moddir(to=''):
return os.path.join(__path__[0], to)
2 changes: 1 addition & 1 deletion zeitgitter/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand Down
2 changes: 1 addition & 1 deletion zeitgitter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitter — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand Down
4 changes: 2 additions & 2 deletions zeitgitter/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand Down Expand Up @@ -308,7 +308,7 @@ def check_for_stamper_mail(imap, stat, logfile):
f"#bodies+1={len(contents)}, #msgids={len(remaining_msgids)}")
for m in contents:
if m != b')':
if len(msgid) == 0:
if len(remaining_msgids) == 0:
logging.error(
f"More bodies returned ({len(contents)}) than requested ({len(mseq.split(b','))})")
msgid = "99999999999"
Expand Down
2 changes: 1 addition & 1 deletion zeitgitter/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand Down
13 changes: 8 additions & 5 deletions zeitgitter/stamper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand Down Expand Up @@ -133,7 +133,8 @@ def gpg(self):
Create one, if less than `number-of-gpg-agents` are available."""
with self.gpg_serialize:
if len(self.gpgs) < self.max_threads:
home = Path('%s-%d' % (zeitgitter.config.arg.gnupg_home, len(self.gpgs)))
home = Path('%s-%d' %
(zeitgitter.config.arg.gnupg_home, len(self.gpgs)))
# Create copy if needed; to trick an additional gpg-agent
# being started for the same directory
if home.exists():
Expand All @@ -152,15 +153,17 @@ def gpg(self):
home, ignore=shutil.ignore_patterns("S.*", "*~"))
nextgpg = gnupg.GPG(gnupghome=home.as_posix())
self.gpgs.append(nextgpg)
logging.debug("Returning new %r (gnupghome=%s)" % (nextgpg, nextgpg.gnupghome))
logging.debug("Returning new %r (gnupghome=%s)" %
(nextgpg, nextgpg.gnupghome))
return nextgpg
else:
# Rotate list left and return element wrapped around (if the list
# just became full, this is the one least recently used)
nextgpg = self.gpgs[0]
self.gpgs = self.gpgs[1:]
self.gpgs.append(nextgpg)
logging.debug("Returning old %r (gnupghome=%s)" % (nextgpg, nextgpg.gnupghome))
logging.debug("Returning old %r (gnupghome=%s)" %
(nextgpg, nextgpg.gnupghome))
return nextgpg

def sig_time(self):
Expand Down Expand Up @@ -227,7 +230,7 @@ def stamp_tag(self, commit, tagname):
:watch: %s tag timestamp
""" % (commit, tagname, self.fullid, now,
self.url)
self.url)

sig = self.limited_sign(now, commit, tagobj)
if sig == None:
Expand Down
4 changes: 2 additions & 2 deletions zeitgitter/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# zeitgitterd — Independent GIT Timestamping, HTTPS server
#
# Copyright (C) 2019-2021 Marcel Waldvogel
# Copyright (C) 2019-2022 Marcel Waldvogel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
Expand All @@ -18,4 +18,4 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

VERSION = '1.1.4'
VERSION = '1.1.5'
6 changes: 4 additions & 2 deletions zeitgitter/web/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!--
Zeitgitter — Independent GIT Timestamping
Copyright 2019-2021 Marcel Waldvogel <[email protected]>
Copyright 2019-2022 Marcel Waldvogel <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -35,7 +35,9 @@
<li><a href="contact.html" class="active">Contact Information</a></li>
</ul>

<h1 class="top">Maintainer Contact • Zeitgitter Server at ZEITGITTER_DOMAIN</h1>
<h1 class="top">
Maintainer Contact • Zeitgitter Server at ZEITGITTER_DOMAIN
</h1>
<p>This service is operated by:</p>
<p>ZEITGITTER_CONTACT</p>
</body>
Expand Down
2 changes: 1 addition & 1 deletion zeitgitter/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!--
Zeitgitter — Independent GIT Timestamping
Copyright 2019-2021 Marcel Waldvogel <[email protected]>
Copyright 2019-21 Marcel Waldvogel <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
40 changes: 25 additions & 15 deletions zeitgitter/web/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!--
Zeitgitter — Independent GIT Timestamping
Copyright 2019-2021 Marcel Waldvogel <[email protected]>
Copyright 2019-2022 Marcel Waldvogel <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -38,37 +38,47 @@
<h1 class="top">Privacy Policy</h1>
<p>
To provide this timestamping service in a trustworthy manner, the service
<b>irrevocably</b> creates, maintains, and publishes a log file of its timestamping activity.
<b>irrevocably</b> creates, maintains, and publishes a log file of its
timestamping activity.
</p>

<p>
Therefore, the service
<b>records and publishes the following information permanently and irrevocably:</b>
<b
>records and publishes the following information permanently and
irrevocably:</b
>
</p>
<ul>
<li>
The <b>commit ID</b> of all the commits you requested timestamping for, in the sequence it
was processed. This sequence, together with the timestamps on the log, will also give
insight into the timestamp returned.<br />
<b>Not</b> stored will be the IDs of the documents within your repository.
The <b>commit ID</b> of all the commits you requested timestamping for,
in the sequence it was processed. This sequence, together with the
timestamps on the log, will also give insight into the timestamp
returned.<br />
<b>Not</b> stored will be the IDs of the documents within your
repository.
</li>
</ul>

<p>
In order to maintain the service, we record the following information for up to 7 days,
In order to maintain the service, we record the following information for
up to 7 days,
<b>after which it will be deleted:</b>
</p>
<ul>
<li><b>For all requests:</b> Time, IP address, and URL of the request.</li>
<li>
<b>For branch timestamps:</b> The ID of the timestamping branch's previous HEAD commit
("parent") and the SHA-1 hash of the
<a href="https://git-scm.com/book/en/v2/Git-Internals-Git-Objects">GIT tree object</a>. (In
addition to time, IP address, URL, and commit ID).
<b>For all requests:</b> Time, IP address, and URL of the request.
</li>
<li>
<b>For tag timestamps:</b> The name of the tag. (In addition to time, IP address, URL, and
commit ID).
<b>For branch timestamps:</b> The ID of the timestamping branch's
previous HEAD commit ("parent") and the SHA-1 hash of the
<a href="https://git-scm.com/book/en/v2/Git-Internals-Git-Objects"
>GIT tree object</a
>. (In addition to time, IP address, URL, and commit ID).
</li>
<li>
<b>For tag timestamps:</b> The name of the tag. (In addition to time, IP
address, URL, and commit ID).
</li>
</ul>
</body>
Expand Down
Loading

0 comments on commit 9d6890e

Please sign in to comment.