output/krb5: have krb5 properties in alerts

Ticket: 5977
pull/9851/head
Philippe Antoine 1 year ago committed by Philippe Antoine
parent 8a09bff0aa
commit e38b9de6a2

@ -22,6 +22,7 @@ use crate::krb::krb5::{KRB5Transaction,test_weak_encryption};
fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError> fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError>
{ {
jsb.open_object("krb5")?;
match tx.error_code { match tx.error_code {
Some(c) => { Some(c) => {
jsb.set_string("msg_type", &format!("{:?}", tx.msg_type))?; jsb.set_string("msg_type", &format!("{:?}", tx.msg_type))?;
@ -63,12 +64,13 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<
jsb.set_string("ticket_encryption", &refs)?; jsb.set_string("ticket_encryption", &refs)?;
jsb.set_bool("ticket_weak_encryption", test_weak_encryption(x))?; jsb.set_bool("ticket_weak_encryption", test_weak_encryption(x))?;
} }
jsb.close()?;
return Ok(()); return Ok(());
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_krb5_log_json_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> bool pub extern "C" fn rs_krb5_log_json_response(tx: &mut KRB5Transaction, jsb: &mut JsonBuilder) -> bool
{ {
krb5_log_response(jsb, tx).is_ok() krb5_log_response(jsb, tx).is_ok()
} }

@ -59,11 +59,9 @@ static int JsonKRB5Logger(ThreadVars *tv, void *thread_data,
return TM_ECODE_FAILED; return TM_ECODE_FAILED;
} }
jb_open_object(jb, "krb5"); if (!rs_krb5_log_json_response(krb5tx, jb)) {
if (!rs_krb5_log_json_response(jb, krb5tx)) {
goto error; goto error;
} }
jb_close(jb);
OutputJsonBuilderBuffer(jb, thread); OutputJsonBuilderBuffer(jb, thread);

@ -1149,8 +1149,8 @@ static EveJsonSimpleAppLayerLogger simple_json_applayer_loggers[ALPROTO_MAX] = {
{ ALPROTO_NTP, NULL }, // no logging { ALPROTO_NTP, NULL }, // no logging
{ ALPROTO_FTPDATA, EveFTPDataAddMetadata }, { ALPROTO_FTPDATA, EveFTPDataAddMetadata },
{ ALPROTO_TFTP, (EveJsonSimpleTxLogFunc)rs_tftp_log_json_request }, { ALPROTO_TFTP, (EveJsonSimpleTxLogFunc)rs_tftp_log_json_request },
{ ALPROTO_IKE, NULL }, // special: uses state { ALPROTO_IKE, NULL }, // special: uses state
{ ALPROTO_KRB5, NULL }, // TODO missing { ALPROTO_KRB5, (EveJsonSimpleTxLogFunc)rs_krb5_log_json_response },
{ ALPROTO_QUIC, rs_quic_to_json }, { ALPROTO_QUIC, rs_quic_to_json },
{ ALPROTO_DHCP, NULL }, // TODO missing { ALPROTO_DHCP, NULL }, // TODO missing
{ ALPROTO_SNMP, (EveJsonSimpleTxLogFunc)rs_snmp_log_json_response }, { ALPROTO_SNMP, (EveJsonSimpleTxLogFunc)rs_snmp_log_json_response },

Loading…
Cancel
Save