v0.0.9 - Add timestamped stdout activity logging for TCP mode and show full .fips signer URL in startup helper

This commit is contained in:
Laan Tungir
2026-05-03 20:37:11 -04:00
parent 252d026991
commit 1dd6630311
2 changed files with 29 additions and 3 deletions

View File

@@ -138,8 +138,12 @@ if command -v fipsctl >/dev/null 2>&1; then
if [[ -n "${STATUS_JSON}" ]]; then if [[ -n "${STATUS_JSON}" ]]; then
FIPS_IPV6="$(printf '%s\n' "${STATUS_JSON}" | sed -n 's/.*"ipv6_addr": "\([^"]*\)".*/\1/p')" FIPS_IPV6="$(printf '%s\n' "${STATUS_JSON}" | sed -n 's/.*"ipv6_addr": "\([^"]*\)".*/\1/p')"
FIPS_NPUB="$(printf '%s\n' "${STATUS_JSON}" | sed -n 's/.*"npub": "\([^"]*\)".*/\1/p')" FIPS_NPUB="$(printf '%s\n' "${STATUS_JSON}" | sed -n 's/.*"npub": "\([^"]*\)".*/\1/p')"
LISTEN_PORT="$(printf '%s\n' "${LISTEN_TARGET}" | sed -n 's/.*:\([0-9][0-9]*\)$/\1/p')"
[[ -n "${FIPS_IPV6}" ]] && echo "fips ipv6: ${FIPS_IPV6}" [[ -n "${FIPS_IPV6}" ]] && echo "fips ipv6: ${FIPS_IPV6}"
[[ -n "${FIPS_NPUB}" ]] && echo "fips npub: ${FIPS_NPUB}" [[ -n "${FIPS_NPUB}" ]] && echo "fips npub: ${FIPS_NPUB}"
if [[ -n "${FIPS_NPUB}" && -n "${LISTEN_PORT}" ]]; then
echo "fips address: http://${FIPS_NPUB}.fips:${LISTEN_PORT}"
fi
else else
echo "fips status: unavailable (run as user in fips group or with sudo)" echo "fips status: unavailable (run as user in fips group or with sudo)"
fi fi

View File

@@ -451,8 +451,8 @@ int socket_name_random(char *out, size_t out_len);
/* Version information (auto-updated by build/version tooling) */ /* Version information (auto-updated by build/version tooling) */
#define NSIGNER_VERSION_MAJOR 0 #define NSIGNER_VERSION_MAJOR 0
#define NSIGNER_VERSION_MINOR 0 #define NSIGNER_VERSION_MINOR 0
#define NSIGNER_VERSION_PATCH 8 #define NSIGNER_VERSION_PATCH 9
#define NSIGNER_VERSION "v0.0.8" #define NSIGNER_VERSION "v0.0.9"
/* NSIGNER_HEADERLESS_DECLS_END */ /* NSIGNER_HEADERLESS_DECLS_END */
@@ -746,6 +746,28 @@ static void activity_log_cb(const char *message, void *user_data) {
g_activity_log.count++; g_activity_log.count++;
} }
static void tcp_activity_stdout_cb(const char *message, void *user_data) {
time_t now;
struct tm tm_now;
char ts[32];
(void)user_data;
if (message == NULL) {
return;
}
now = time(NULL);
if (localtime_r(&now, &tm_now) != NULL) {
(void)strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S", &tm_now);
} else {
strncpy(ts, "0000-00-00 00:00:00", sizeof(ts) - 1);
ts[sizeof(ts) - 1] = '\0';
}
printf("[%s] %s\n", ts, message);
fflush(stdout);
}
static void render_status(const role_table_t *role_table, static void render_status(const role_table_t *role_table,
const mnemonic_state_t *mnemonic, const mnemonic_state_t *mnemonic,
int derived_count, int derived_count,
@@ -1141,7 +1163,7 @@ int main(int argc, char *argv[]) {
break; break;
} }
if (prc > 0 && (pfds[0].revents & POLLIN)) { if (prc > 0 && (pfds[0].revents & POLLIN)) {
if (server_handle_one(&server, NULL, NULL) < 0) { if (server_handle_one(&server, tcp_activity_stdout_cb, NULL) < 0) {
break; break;
} }
} }