From 3adf880eb3896e34ace1538d98e8b81d00411653 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 21 2015 17:24:47 +0000 Subject: [PATCH 1/4] Add an endpoint presenting the ssh hostkey and fingerprint set in the configuration This allows admin to specify in their configuration the ssh hostkey and fingerprint of the git server they are using. This configuration is then displayed to the user. Fixes https://pagure.io/pagure/issue/140 --- diff --git a/files/pagure.cfg.sample b/files/pagure.cfg.sample index 2c8fcac..d49cac5 100644 --- a/files/pagure.cfg.sample +++ b/files/pagure.cfg.sample @@ -87,6 +87,14 @@ GL_RC = None GL_BINDIR = None +# SSH Information + +### The ssh certificates of the git server to be provided to the user +### /!\ format is important +# SSH_CERTS = {'RSA': {'fingerprint': '', 'pubkey': ''}} + + + # Optional configuration ### Number of items displayed per page diff --git a/pagure/templates/doc_ssh_keys.html b/pagure/templates/doc_ssh_keys.html new file mode 100644 index 0000000..064c2eb --- /dev/null +++ b/pagure/templates/doc_ssh_keys.html @@ -0,0 +1,33 @@ +{% extends "master.html" %} + +{% block title %}Doc: SSH hostkeys/Fingerprints{% endblock %} +{%block tag %}home{% endblock %} + + +{% block content %} + +

SSH Hostkeys/Fingerprints

+ +SSH host keys and fingerprints can be use to ensure you are connecting to +pagure's server and not someone else's. + +Here below are the SSH Hostkey and the Fingerprint of this current pagure +instance: + +{% if config.get('SSH_CERTS') %} + +{% for cert in config.get('SSH_CERTS') %} +

{{ cert }} Fingerprint

+{{ config['SSH_CERTS'][cert]['fingerprint'] }} + +

{{ cert }} Hostkey

+{{ config['SSH_CERTS'][cert]['pubkey'] }} +{% endfor %} + +{% else %} +

No SSH certificates have been specified in the configuration file.

+

You should ask an admin to fill this information.

+{% endif %} + + +{% endblock %} diff --git a/pagure/ui/app.py b/pagure/ui/app.py index f8d00cb..94571ba 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -497,3 +497,13 @@ def confirm_email(token): APP.logger.exception(err) return flask.redirect(flask.url_for('.user_settings')) + + +@APP.route('/ssh_info') +def ssh_hostkey(): + """ Endpoint returning information about the SSH hostkey and fingerprint + of the current pagure instance. + """ + return flask.render_template( + 'doc_ssh_keys.html', + ) From bdae13e12713c5209438d74ca52560462b64b03e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 21 2015 17:25:35 +0000 Subject: [PATCH 2/4] Link to the page listing the SSH hostkey/fingerprints from the repo page --- diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index bed0d8f..5be6bca 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -169,8 +169,12 @@ - - + + From 1d610d438405b53a1046e7f4a57ebf98c57cdec0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 21 2015 17:33:21 +0000 Subject: [PATCH 3/4] Rename the configuration key from SSH_CERTS to SSH_KEYS --- diff --git a/files/pagure.cfg.sample b/files/pagure.cfg.sample index d49cac5..d610db1 100644 --- a/files/pagure.cfg.sample +++ b/files/pagure.cfg.sample @@ -91,7 +91,7 @@ GL_BINDIR = None ### The ssh certificates of the git server to be provided to the user ### /!\ format is important -# SSH_CERTS = {'RSA': {'fingerprint': '', 'pubkey': ''}} +# SSH_KEYS = {'RSA': {'fingerprint': '', 'pubkey': ''}} diff --git a/pagure/templates/doc_ssh_keys.html b/pagure/templates/doc_ssh_keys.html index 064c2eb..03d7991 100644 --- a/pagure/templates/doc_ssh_keys.html +++ b/pagure/templates/doc_ssh_keys.html @@ -14,14 +14,14 @@ pagure's server and not someone else's. Here below are the SSH Hostkey and the Fingerprint of this current pagure instance: -{% if config.get('SSH_CERTS') %} +{% if config.get('SSH_KEYS') %} -{% for cert in config.get('SSH_CERTS') %} +{% for cert in config.get('SSH_KEYS') %}

{{ cert }} Fingerprint

-{{ config['SSH_CERTS'][cert]['fingerprint'] }} +{{ config['SSH_KEYS'][cert]['fingerprint'] }}

{{ cert }} Hostkey

-{{ config['SSH_CERTS'][cert]['pubkey'] }} +{{ config['SSH_KEYS'][cert]['pubkey'] }} {% endfor %} {% else %} From c3df40822c00370214bcab574564903e8d932a08 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 21 2015 17:38:48 +0000 Subject: [PATCH 4/4] Here as well, not certificates but keys --- diff --git a/pagure/templates/doc_ssh_keys.html b/pagure/templates/doc_ssh_keys.html index 03d7991..94d073f 100644 --- a/pagure/templates/doc_ssh_keys.html +++ b/pagure/templates/doc_ssh_keys.html @@ -25,7 +25,7 @@ instance: {% endfor %} {% else %} -

No SSH certificates have been specified in the configuration file.

+

No SSH keys have been specified in the configuration file.

You should ask an admin to fill this information.

{% endif %}
Git URLsmoremore | + + SSH Hostkey/Fingerprint + +