diff --git a/install_qube_fips_nsigner.sh b/install_qube_fips_nsigner.sh index 10301f1..bdc54bf 100755 --- a/install_qube_fips_nsigner.sh +++ b/install_qube_fips_nsigner.sh @@ -138,8 +138,12 @@ if command -v fipsctl >/dev/null 2>&1; then if [[ -n "${STATUS_JSON}" ]]; then 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')" + 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_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 echo "fips status: unavailable (run as user in fips group or with sudo)" fi diff --git a/src/main.c b/src/main.c index 5c89276..b44742e 100644 --- a/src/main.c +++ b/src/main.c @@ -451,8 +451,8 @@ int socket_name_random(char *out, size_t out_len); /* Version information (auto-updated by build/version tooling) */ #define NSIGNER_VERSION_MAJOR 0 #define NSIGNER_VERSION_MINOR 0 -#define NSIGNER_VERSION_PATCH 8 -#define NSIGNER_VERSION "v0.0.8" +#define NSIGNER_VERSION_PATCH 9 +#define NSIGNER_VERSION "v0.0.9" /* NSIGNER_HEADERLESS_DECLS_END */ @@ -746,6 +746,28 @@ static void activity_log_cb(const char *message, void *user_data) { 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, const mnemonic_state_t *mnemonic, int derived_count, @@ -1141,7 +1163,7 @@ int main(int argc, char *argv[]) { break; } 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; } }