certs: unify duplicated cmd_extract_certs and improve the log