commit - e0b4bebd3276f6c8e04fd80efc48145413ed1090e77e36c2c58c3c5da38cb4d0
commit + 0e23f911fba42726916fbd5ef96ef8f9d60aa9f1227e14de0054dac38d63c86d
blob - d4b1395baa34b604ad92778435057efad6a77c246a0701d6c57ca37763281299
blob + 08fe0a7d31a2d80af0c262a6b2a8436f412582305199945590429a73e751909a
--- gotwebd/gotwebd.conf.5
+++ gotwebd/gotwebd.conf.5
sockets created by
.Xr gotwebd 8 .
If not specified, the user www will be used.
+.It Ic ssh_hostkey_ecdsa Ar string
+Set the server's SSH ECDSA host key fingerprint to be displayed beneath
+login hints and beneath clone URLs which use the SSH protocol.
+.It Ic ssh_hostkey_ed25519 Ar string
+Set the server's SSH ED25519 host key fingerprint to be displayed beneath
+login hints and beneath clone URLs which use the SSH protocol.
+.It Ic ssh_hostkey_rsa Ar string
+Set the server's SSH RSA host key fingerprint to be displayed beneath
+login hints and beneath clone URLs which use the SSH protocol.
.El
.Pp
If no
.Cm chroot
directive must be used before the server declaration in order to
take effect.
+.It Ic ssh_hostkey_ecdsa Ar string
+Set the server's SSH ECDSA host key fingerprint to be displayed beneath
+login hints and beneath clone URLs which use the SSH protocol.
+If not set then SSH fingerprints found in the global configuration context
+will be used.
+.It Ic ssh_hostkey_ed25519 Ar string
+Set the server's SSH ED25519 host key fingerprint to be displayed beneath
+login hints and beneath clone URLs which use the SSH protocol.
+If not set then SSH fingerprints found in the global configuration context
+will be used.
+.It Ic ssh_hostkey_rsa Ar string
+Set the server's SSH RSA host key fingerprint to be displayed beneath
+login hints and beneath clone URLs which use the SSH protocol.
+If not set then SSH fingerprints found in the global configuration context
+will be used.
.It Ic repository Ar name Brq ...
Set options which apply to a particular repository served by this server.
.Pp
Set the server's SSH ECDSA host key fingerprint to be displayed beneath
the clone URL.
Should be set when the clone URL uses the SSH protocol.
+If not set then SSH fingerprints found in the server or global configuration
+context will be used.
.It Ic ssh_hostkey_ed25519 Ar string
Set the server's SSH ED25519 host key fingerprint to be displayed beneath
the clone URL.
Should be set when the clone URL uses the SSH protocol.
+If not set then SSH fingerprints found in the server or global configuration
+context will be used.
.It Ic ssh_hostkey_rsa Ar string
Set the server's SSH RSA host key fingerprint to be displayed beneath
the clone URL.
Should be set when the clone URL uses the SSH protocol.
+If not set then SSH fingerprints found in the server or global configuration
+context will be used.
.It Ic description Ar string
Sets the repository description shown on the repository listing page.
The
blob - 521d17ad10808a101361c034491da7847ab21c258784152aa84648122ef470da
blob + 0d93057916fb19a5e672b41593c08242564928944be48a241fb7b2d5cf3b5503
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
char name[GOTWEBD_MAXTEXT];
char htdocs_path[PATH_MAX];
char gotweb_url_root[MAX_DOCUMENT_URI];
+ char sshfp[GOTWEBD_NUM_SSHFP][GOTWEBD_MAX_SSHFP];
char repos_path[PATH_MAX];
char repos_url_path[MAX_DOCUMENT_URI];
enum gotwebd_auth_config auth_config;
struct gotwebd_access_rule_list access_rules;
+ char sshfp[GOTWEBD_NUM_SSHFP][GOTWEBD_MAX_SSHFP];
+
struct mediatypes mediatypes;
int pack_fds[GOTWEB_PACK_NUM_TEMPFILES];
blob - dcaae7ec4a6954f2f977527fe14a9187faec968610731805bb2f832f1b83f3f4
blob + 9688d9e288f654ceeb75559a3266938ca90733666bae766c6e58a93964f64c33
--- gotwebd/parse.y
+++ gotwebd/parse.y
free(h);
free($3);
}
+ | SSH_HOSTKEY_ECDSA STRING {
+ int i = GOTWEBD_SSHFP_ECDSA;
+
+ if (*$2 == '\0') {
+ yyerror("ssh host key fingerprint cannot be "
+ "an empty string");
+ free($2);
+ YYERROR;
+ }
+
+ if (strlcpy(gotwebd->sshfp[i], $2,
+ sizeof(gotwebd->sshfp[i])) >=
+ sizeof(gotwebd->sshfp[i])) {
+ yyerror("ssh host key fingerprint too long, "
+ "exceeds " "%zd bytes: %s",
+ sizeof(gotwebd->sshfp[i]), $2);
+ free($2);
+ YYERROR;
+ }
+
+ free($2);
+ }
+ | SSH_HOSTKEY_ED25519 STRING {
+ int i = GOTWEBD_SSHFP_ED25519;
+
+ if (*$2 == '\0') {
+ yyerror("ssh host key fingerprint cannot be "
+ "an empty string");
+ free($2);
+ YYERROR;
+ }
+
+ if (strlcpy(gotwebd->sshfp[i], $2,
+ sizeof(gotwebd->sshfp[i])) >=
+ sizeof(gotwebd->sshfp[i])) {
+ yyerror("ssh host key fingerprint too long, "
+ "exceeds " "%zd bytes: %s",
+ sizeof(gotwebd->sshfp[i]), $2);
+ free($2);
+ YYERROR;
+ }
+
+ free($2);
+ }
+ | SSH_HOSTKEY_RSA STRING {
+ int i = GOTWEBD_SSHFP_RSA;
+
+ if (*$2 == '\0') {
+ yyerror("ssh host key fingerprint cannot be "
+ "an empty string");
+ free($2);
+ YYERROR;
+ }
+
+ if (strlcpy(gotwebd->sshfp[i], $2,
+ sizeof(gotwebd->sshfp[i])) >=
+ sizeof(gotwebd->sshfp[i])) {
+ yyerror("ssh host key fingerprint too long, "
+ "exceeds " "%zd bytes: %s",
+ sizeof(gotwebd->sshfp[i]), $2);
+ free($2);
+ YYERROR;
+ }
+
+ free($2);
+ }
;
server : SERVER STRING {
free($2);
}
+ | SSH_HOSTKEY_ECDSA STRING {
+ int i = GOTWEBD_SSHFP_ECDSA;
+
+ if (*$2 == '\0') {
+ yyerror("ssh host key fingerprint cannot be "
+ "an empty string");
+ free($2);
+ YYERROR;
+ }
+
+ if (strlcpy(new_srv->sshfp[i], $2,
+ sizeof(new_srv->sshfp[i])) >=
+ sizeof(new_srv->sshfp[i])) {
+ yyerror("ssh host key fingerprint too long, "
+ "exceeds " "%zd bytes: %s",
+ sizeof(new_srv->sshfp[i]), $2);
+ free($2);
+ YYERROR;
+ }
+
+ free($2);
+ }
+ | SSH_HOSTKEY_ED25519 STRING {
+ int i = GOTWEBD_SSHFP_ED25519;
+
+ if (*$2 == '\0') {
+ yyerror("ssh host key fingerprint cannot be "
+ "an empty string");
+ free($2);
+ YYERROR;
+ }
+
+ if (strlcpy(new_srv->sshfp[i], $2,
+ sizeof(new_srv->sshfp[i])) >=
+ sizeof(new_srv->sshfp[i])) {
+ yyerror("ssh host key fingerprint too long, "
+ "exceeds " "%zd bytes: %s",
+ sizeof(new_srv->sshfp[i]), $2);
+ free($2);
+ YYERROR;
+ }
+
+ free($2);
+ }
+ | SSH_HOSTKEY_RSA STRING {
+ int i = GOTWEBD_SSHFP_RSA;
+
+ if (*$2 == '\0') {
+ yyerror("ssh host key fingerprint cannot be "
+ "an empty string");
+ free($2);
+ YYERROR;
+ }
+
+ if (strlcpy(new_srv->sshfp[i], $2,
+ sizeof(new_srv->sshfp[i])) >=
+ sizeof(new_srv->sshfp[i])) {
+ yyerror("ssh host key fingerprint too long, "
+ "exceeds " "%zd bytes: %s",
+ sizeof(new_srv->sshfp[i]), $2);
+ free($2);
+ YYERROR;
+ }
+
+ free($2);
+ }
| repository
| website
;
struct sym *sym, *next;
struct server *srv;
struct gotwebd_repo *repo;
+ size_t i;
if (config_init(env) == -1)
fatalx("failed to initialize configuration");
/* Inherit implicit configuration from parent scope. */
TAILQ_FOREACH(srv, &env->servers, entry) {
+ for (i = 0; i < GOTWEBD_NUM_SSHFP; i++) {
+ if (srv->sshfp[i][0] == '\0' &&
+ env->sshfp[i][0] != '\0' &&
+ strlcpy(srv->sshfp[i], env->sshfp[i],
+ sizeof(srv->sshfp[i])) >= sizeof(srv->sshfp[i])) {
+ fprintf(stderr, "ssh host key fingerprint too "
+ "long, exceeds %zd bytes: %s",
+ sizeof(srv->sshfp[i]), env->sshfp[i]);
+ return -1;
+ }
+ }
+
if (srv->auth_config == 0)
srv->auth_config = env->auth_config;
TAILQ_FOREACH(repo, &srv->repos, entry) {
repo->auth_config = srv->auth_config;
if (repo->hidden == -1)
repo->hidden = srv->hide_repositories;
+
+ for (i = 0; i < GOTWEBD_NUM_SSHFP; i++) {
+ if (repo->clone_url_hostkey[i][0] == '\0' &&
+ srv->sshfp[i][0] != '\0' &&
+ strlcpy(repo->clone_url_hostkey[i],
+ srv->sshfp[i],
+ sizeof(repo->clone_url_hostkey[i])) >=
+ sizeof(repo->clone_url_hostkey[i])) {
+ fprintf(stderr, "ssh host key "
+ "fingerprint too long, exceeds "
+ "%zd bytes: %s",
+ sizeof(repo->clone_url_hostkey[i]),
+ srv->sshfp[i]);
+ return -1;
+ }
+ }
}
if (srv->login_hint_user[0] == '\0') {