file_hook_server_timestamping

`file_hook_server_timestamping.py` is a file hook for a GitLab instance. It is used to automatically create timestamped commits for every push to the default branch of a repository. This can be useful for a number of reasons.

https://github.com/dlr-pa/file_hook_server_timestamping

Science Score: 75.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
    Organization dlr-pa has institutional domain (www.dlr.de)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.9%) to scientific vocabulary

Keywords

data-integrity gitlab gitlab-file-hook gpg python server-side timestamping
Last synced: 6 months ago · JSON representation ·

Repository

`file_hook_server_timestamping.py` is a file hook for a GitLab instance. It is used to automatically create timestamped commits for every push to the default branch of a repository. This can be useful for a number of reasons.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
data-integrity gitlab gitlab-file-hook gpg python server-side timestamping
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md


author: Daniel Mohr date: 2024-11-29 license: BSD-3-Clause home: https://gitlab.com/dlr-pa/filehookservertimestamping mirror: https://github.com/dlr-pa/filehookservertimestamping

doi: 10.5281/zenodo.14234977

file hook server timestamping

general information

This script, file_hook_server_timestamping.py, enables the automatic creation of timestamped commits for a GitLab repository. Each time a push is made to the default branch, the script creates an empty commit with a timestamp that marks the time of the push event. This can be useful for a number of purposes, including auditing, tracking changes to the repository, and ensuring the integrity and authenticity of the data.

Cryptographic timestamping on the server prevents silent changes to the history, whether by a user or otherwise. The cryptographic signature represents the time at which the data reaches the server, and subsequent changes to the history are not possible without the private GPG key stored on the server. This provides an additional layer of security to ensure the integrity and authenticity of the data.

The script uses GPG keys to sign commits, which helps to ensure the authenticity and integrity of the timestamps. It can be easily customized through a configuration file and can be used on a single GitLab instance.

In addition to being used in a standalone GitLab environment, this script could also be used inside the riaf environment based on GitLab, as mentioned in doi.org/10.5281/zenodo.13987885.

introduction and overview

file_hook_server_timestamping.py is a file hook for a GitLab instance. It is used to automatically create timestamped commits for every push to the default branch of a repository. This can be useful for a number of reasons, including:

  • tracking changes: By creating a timestamped commit for every push, it is easy to see when changes were made to the repository and who made them.
  • ensuring the integrity of the data: Timestamped commits provide an additional layer of security, as they make it difficult for anyone to silently alter the history of the repository.
  • auditing: In certain industries, it may be necessary to keep detailed records of all changes to a repository. Timestamped commits can help meet these requirements.

The script uses GPG keys to sign commits, which adds an additional layer of security and helps ensure the authenticity of the commits. It can be easily customized through a configuration file, which is located at "$HOME/.file_hook_server_timestamping.cfg" by default.

To use the script, simply install it and optionally configure it with your GPG key and other settings. The script will then run automatically on every push to the default branch, creating a timestamped, signed commit in the "server_timestamping" branch.

For more information on how to install and configure the script, as well as additional details, please see the following sections.

installation

Sometimes gpg cannot create /var/opt/gitlab/.gnupg due to permissions. Workaround:

sh install --directory --group=git --owner=git --mode=700 /var/opt/gitlab/.gnupg

Sometimes /var/opt/gitlab/ is owned by root and the configuration files cannot be created due to permissions. Workaround:

sh touch /var/opt/gitlab/.file_hook_server_timestamping_gpgkey.cfg chown git:git /var/opt/gitlab/.file_hook_server_timestamping_gpgkey.cfg chmod 640 /var/opt/gitlab/.file_hook_server_timestamping_gpgkey.cfg

And finally you have to install the script, e. g.:

sh install --group=git --owner=git --mode=700 file_hook_server_timestamping.py /opt/gitlab/embedded/service/gitlab-rails/file_hooks/file_hook_server_timestamping.py

On first run the script will create a GPG key. Otherwise you can do this on your own and provide the key in the configuration file -- see next subsection.

configuration

If you provide a configuration file ~/.file_hook_server_timestamping.cfg this will be used. An example configuration file is given as example_config.cfg.

The configuration file consists of two sections:

  • logging: This section is used to configure the logger. It includes the following options:
    • name: The name of the logger.
    • filename: The name of the log file. If this option is not set, no file logging will be done.
    • do_console_logging: Whether or not to log to the console/stdout.
    • log_level: The logging level. Possible values are "debug", "info", "warning", "error", and "critical".
  • server_timestamping: This section is used to configure the server timestamping feature. It includes the following options:
    • branch_name: The name of the branch in which the server timestamping commits will be created.
    • gpgkey: The name of the GPG key to use for signing commits. If this option is not set, the script will create a new GPG key and store the name in another configuration file, $HOME/.file_hook_server_timestamping_gpgkey.cfg. However, if a value is set for this option, it will overwrite the configuration in the other file.

Hint: Sometimes /var/opt/gitlab/ is owned by root. Workaround:

sh touch /var/opt/gitlab/.file_hook_server_timestamping.cfg chown git:git /var/opt/gitlab/.file_hook_server_timestamping.cfg chmod 640 /var/opt/gitlab/.file_hook_server_timestamping.cfg

Or you can directly install the example_config.cfg and edit it afterwards:

sh install --group=git --owner=git --mode=640 example_config.cfg /var/opt/gitlab/.file_hook_server_timestamping.cfg

Typically in the configuration /var/opt/gitlab/.file_hook_server_timestamping_gpgkey.cfg the GPG key to use is described. But you can also overwrite this in the configuration /var/opt/gitlab/.file_hook_server_timestamping.cfg. See example configuration example_config.cfg for possible values and a short description.

limitation and hints

file_hook_server_timestamping.py works only on a single note GitLab instance.

GitLab UI signing commits is not comparable. It only signs commits done by using the web interface.

Owner

  • Name: DLR Institute of Atmospheric Physics
  • Login: dlr-pa
  • Kind: organization
  • Location: Oberpfaffenhofen, Germany

German Aerospace Center (DLR) e.V.

Citation (CITATION.cff)

cff-version: 1.2.0
title: file_hook_server_timestamping
message: Please cite this software using these metadata.
type: software
authors:
  - given-names: Daniel
    family-names: Mohr
    orcid: https://orcid.org/0000-0002-9382-6586
    affiliation: Deutsches Zentrum für Luft- und Raumfahrt e. V.
identifiers:
  - description: The DOI of this release.
    type: doi
    value: 10.5281/zenodo.14234977
repository-code: https://gitlab.com/projects/64912817
url: https://gitlab.com/dlr-pa/file_hook_server_timestamping
abstract: 'This script, `file_hook_server_timestamping.py`, enables the automatic
creation of timestamped commits for a GitLab repository. Each time a push is
made to the default branch, the script creates an empty commit with a
timestamp that marks the time of the push event. This can be useful for a
number of purposes, including auditing, tracking changes to the repository,
and ensuring the integrity and authenticity of the data.

Cryptographic timestamping on the server prevents silent changes to the
history, whether by a user or otherwise. The cryptographic signature
represents the time at which the data reaches the server, and subsequent
changes to the history are not possible without the private GPG key stored
on the server. This provides an additional layer of security to ensure the
integrity and authenticity of the data.

The script uses GPG keys to sign commits, which helps to ensure the
authenticity and integrity of the timestamps. It can be easily customized
through a configuration file and can be used on a single GitLab instance.

In addition to being used in a standalone GitLab environment, this script
could also be used inside the riaf environment based on GitLab, as mentioned
in [doi.org/10.5281/zenodo.13987885](https://doi.org/10.5281/zenodo.13987885).'
keywords:
  - GitLab File Hook
  - Timestamped Commits
  - timestamping
  - GPG Key Signing
  - Data Integrity
  - Python Script
  - GitLab
  - python
  - gpg
  - Server-side Functionality
license: BSD-3-Clause
doi: 10.5281/zenodo.14234977

GitHub Events

Total
  • Push event: 1
  • Public event: 1
  • Create event: 1
Last Year
  • Push event: 1
  • Public event: 1
  • Create event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 44
  • Total Committers: 1
  • Avg Commits per committer: 44.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 12
  • Committers: 1
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Daniel Mohr d****r@d****e 44
Committer Domains (Top 20 + Academic)
dlr.de: 1

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels