Commit Diff


commit - ed2f82904d5f4da047cb62aa90267fd0952836d2c65a51e84955f82fe8560d29
commit + 5dc151101d65858605544b62e6326bd72df20a4e7bb7c35f2b4e40a3717ad935
blob - 4bad67716d9cad88da63b5dc92f229a99439d66c23071fe2588d2888dc181c3f
blob + b1f55721cef7c2f60a46f71c1eeec112ba53ce38c34d0379e978b6851c844910
--- gotsysd/libexec/gotsys-write-conf/gotsys-write-conf.c	
+++ gotsysd/libexec/gotsys-write-conf/gotsys-write-conf.c	
@@ -1088,48 +1088,6 @@ write_webrepo(int *show_repo_description, int *login_h
 			    "short write to %s", path);
 		}
 		free(clone_url);
-
-		if (ssh_hostkeys[GOTWEBD_SSHFP_ECDSA][0]) {
-			ret = dprintf(fd, "\t\tssh_hostkey_ecdsa \"%s\"\n",
-			    ssh_hostkeys[GOTWEBD_SSHFP_ECDSA]);
-			if (ret == -1)  {
-				return got_error_from_errno2("dprintf", path);
-			}
-			if (ret != 22 +
-			    strlen(ssh_hostkeys[GOTWEBD_SSHFP_ECDSA]) + 1) {
-				return got_error_fmt(GOT_ERR_IO,
-				    "short write to %s", path);
-			}
-			
-		}
-
-		if (ssh_hostkeys[GOTWEBD_SSHFP_ED25519][0]) {
-			ret = dprintf(fd, "\t\tssh_hostkey_ed25519 \"%s\"\n",
-			    ssh_hostkeys[GOTWEBD_SSHFP_ED25519]);
-			if (ret == -1)  {
-				return got_error_from_errno2("dprintf", path);
-			}
-			if (ret != 24 +
-			    strlen(ssh_hostkeys[GOTWEBD_SSHFP_ED25519]) + 1) {
-				return got_error_fmt(GOT_ERR_IO,
-				    "short write to %s", path);
-			}
-			
-		}
-
-		if (ssh_hostkeys[GOTWEBD_SSHFP_RSA][0]) {
-			ret = dprintf(fd, "\t\tssh_hostkey_rsa \"%s\"\n",
-			    ssh_hostkeys[GOTWEBD_SSHFP_RSA]);
-			if (ret == -1)  {
-				return got_error_from_errno2("dprintf", path);
-			}
-			if (ret != 20 +
-			    strlen(ssh_hostkeys[GOTWEBD_SSHFP_RSA]) + 1) {
-				return got_error_fmt(GOT_ERR_IO,
-				    "short write to %s", path);
-			}
-			
-		}
 	}
 
 	ret = dprintf(fd, "\t}\n");
@@ -1288,6 +1246,48 @@ write_gotwebd_conf(void)
 		}
 	}
 
+	if (ssh_hostkeys[GOTWEBD_SSHFP_ECDSA][0]) {
+		ret = dprintf(fd, "ssh_hostkey_ecdsa \"%s\"\n",
+		    ssh_hostkeys[GOTWEBD_SSHFP_ECDSA]);
+		if (ret == -1)  {
+			return got_error_from_errno2("dprintf", path);
+		}
+		if (ret != 20 +
+		    strlen(ssh_hostkeys[GOTWEBD_SSHFP_ECDSA]) + 1) {
+			return got_error_fmt(GOT_ERR_IO,
+			    "short write to %s", path);
+		}
+		
+	}
+
+	if (ssh_hostkeys[GOTWEBD_SSHFP_ED25519][0]) {
+		ret = dprintf(fd, "ssh_hostkey_ed25519 \"%s\"\n",
+		    ssh_hostkeys[GOTWEBD_SSHFP_ED25519]);
+		if (ret == -1)  {
+			return got_error_from_errno2("dprintf", path);
+		}
+		if (ret != 22 +
+		    strlen(ssh_hostkeys[GOTWEBD_SSHFP_ED25519]) + 1) {
+			return got_error_fmt(GOT_ERR_IO,
+			    "short write to %s", path);
+		}
+		
+	}
+
+	if (ssh_hostkeys[GOTWEBD_SSHFP_RSA][0]) {
+		ret = dprintf(fd, "ssh_hostkey_rsa \"%s\"\n",
+		    ssh_hostkeys[GOTWEBD_SSHFP_RSA]);
+		if (ret == -1)  {
+			return got_error_from_errno2("dprintf", path);
+		}
+		if (ret != 18 +
+		    strlen(ssh_hostkeys[GOTWEBD_SSHFP_RSA]) + 1) {
+			return got_error_fmt(GOT_ERR_IO,
+			    "short write to %s", path);
+		}
+		
+	}
+
 	switch (webcfg.auth_config) {
 	case GOTSYSD_WEB_AUTH_UNSET:
 		break;
blob - 2d527da63805da1b8cef4bfd85b70673d7997e1331fef6abd2bdfe90198c6124
blob + c401de32c4a62ce78aab9c80f210158017d2225198a90cfa25af7129fe2e7fb7
--- regress/gotsysd/test_gotwebd.sh	
+++ regress/gotsysd/test_gotwebd.sh	
@@ -20,6 +20,19 @@
 test_login() {
 	local testroot=`test_init login 1`
 
+	GOTSYS_ECDSA_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub | \
+		cut -d' ' -f2)
+	GOTSYS_ED25519_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub | \
+		cut -d' ' -f2)
+	GOTSYS_RSA_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub | \
+		cut -d' ' -f2)
+
 	got checkout -q $testroot/${GOTSYS_REPO} $testroot/wt >/dev/null
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -113,6 +126,20 @@ EOF
 Repositories
 Log in by running: ssh ${GOTSYSD_TEST_USER}@${VMIP} "weblogin ${VMIP}"
 
+The SSH host key fingerprints of ${VMIP} are:
+
+ECDSA
+
+    ${GOTSYS_ECDSA_HOST_FP}
+
+ED25519
+
+    ${GOTSYS_ED25519_HOST_FP}
+
+RSA
+
+    ${GOTSYS_RSA_HOST_FP}
+    
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
@@ -241,6 +268,20 @@ EOF
 Repositories / testrepo.git / tree /
 Log in by running: ssh ${GOTSYSD_TEST_USER}@${VMIP} "weblogin ${VMIP}"
 
+The SSH host key fingerprints of ${VMIP} are:
+
+ECDSA
+
+    ${GOTSYS_ECDSA_HOST_FP}
+
+ED25519
+
+    ${GOTSYS_ED25519_HOST_FP}
+
+RSA
+
+    ${GOTSYS_RSA_HOST_FP}
+    
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
@@ -265,6 +306,20 @@ EOF
 Repositories / nonexistent.git / tree /
 Log in by running: ssh ${GOTSYSD_TEST_USER}@${VMIP} "weblogin ${VMIP}"
 
+The SSH host key fingerprints of ${VMIP} are:
+
+ECDSA
+
+    ${GOTSYS_ECDSA_HOST_FP}
+
+ED25519
+
+    ${GOTSYS_ED25519_HOST_FP}
+
+RSA
+
+    ${GOTSYS_RSA_HOST_FP}
+    
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
@@ -462,6 +517,19 @@ EOF
 test_access_rules_tree_page() {
 	local testroot=`test_init access_rules_tree_page 1`
 
+	GOTSYS_ECDSA_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub | \
+		cut -d' ' -f2)
+	GOTSYS_ED25519_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub | \
+		cut -d' ' -f2)
+	GOTSYS_RSA_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub | \
+		cut -d' ' -f2)
+
 	got checkout -q $testroot/${GOTSYS_REPO} $testroot/wt >/dev/null
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -582,6 +650,20 @@ EOF
 Repositories / gottest.git / tree /
 Log in by running: ssh ${GOTSYSD_TEST_USER}@${VMIP} "weblogin ${VMIP}"
 
+The SSH host key fingerprints of ${VMIP} are:
+
+ECDSA
+
+    ${GOTSYS_ECDSA_HOST_FP}
+
+ED25519
+
+    ${GOTSYS_ED25519_HOST_FP}
+
+RSA
+
+    ${GOTSYS_RSA_HOST_FP}
+    
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?
blob - c3ffdbcd379e777434d8f69a1248ccad2ab684ea40cf31d064401a107ceb32d4
blob + b24023def05982ce2a5bc81adaccb7f02fb48a6504710b5eab6b61c6fd5e86cc
--- regress/gotsysd/test_gotwebd_repos_www.sh	
+++ regress/gotsysd/test_gotwebd_repos_www.sh	
@@ -21,6 +21,19 @@
 test_repos_at_root_path_and_website() {
 	local testroot=`test_init repos_at_root_path_and_website 1`
 
+	GOTSYS_ECDSA_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub | \
+		cut -d' ' -f2)
+	GOTSYS_ED25519_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub | \
+		cut -d' ' -f2)
+	GOTSYS_RSA_HOST_FP=$(ssh -i ${GOTSYSD_SSH_KEY} \
+		${GOTSYSD_TEST_USER}@${VMIP} \
+		ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub | \
+		cut -d' ' -f2)
+
 	got checkout -q $testroot/${GOTSYS_REPO} $testroot/wt >/dev/null
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -168,6 +181,20 @@ EOF
 Repositories
 Log in by running: ssh ${GOTSYSD_TEST_USER}@${VMIP} "weblogin ${VMIP}"
 
+The SSH host key fingerprints of ${VMIP} are:
+
+ECDSA
+
+    ${GOTSYS_ECDSA_HOST_FP}
+
+ED25519
+
+    ${GOTSYS_ED25519_HOST_FP}
+
+RSA
+
+    ${GOTSYS_RSA_HOST_FP}
+    
 EOF
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret=$?