Skip to content

Commit

Permalink
output/krb5: have krb5 properties in alerts
Browse files Browse the repository at this point in the history
Ticket: 5977
  • Loading branch information
catenacyber committed Nov 20, 2023
1 parent 8a09bff commit e38b9de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion rust/src/krb/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::krb::krb5::{KRB5Transaction,test_weak_encryption};

fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError>
{
jsb.open_object("krb5")?;
match tx.error_code {
Some(c) => {
jsb.set_string("msg_type", &format!("{:?}", tx.msg_type))?;
Expand Down Expand Up @@ -63,12 +64,13 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<
jsb.set_string("ticket_encryption", &refs)?;
jsb.set_bool("ticket_weak_encryption", test_weak_encryption(x))?;
}
jsb.close()?;

return Ok(());
}

#[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()
}
4 changes: 1 addition & 3 deletions src/output-json-krb5.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ static int JsonKRB5Logger(ThreadVars *tv, void *thread_data,
return TM_ECODE_FAILED;
}

jb_open_object(jb, "krb5");
if (!rs_krb5_log_json_response(jb, krb5tx)) {
if (!rs_krb5_log_json_response(krb5tx, jb)) {
goto error;
}
jb_close(jb);

OutputJsonBuilderBuffer(jb, thread);

Expand Down
4 changes: 2 additions & 2 deletions src/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,8 @@ static EveJsonSimpleAppLayerLogger simple_json_applayer_loggers[ALPROTO_MAX] = {
{ ALPROTO_NTP, NULL }, // no logging
{ ALPROTO_FTPDATA, EveFTPDataAddMetadata },
{ ALPROTO_TFTP, (EveJsonSimpleTxLogFunc)rs_tftp_log_json_request },
{ ALPROTO_IKE, NULL }, // special: uses state
{ ALPROTO_KRB5, NULL }, // TODO missing
{ ALPROTO_IKE, NULL }, // special: uses state
{ ALPROTO_KRB5, (EveJsonSimpleTxLogFunc)rs_krb5_log_json_response },
{ ALPROTO_QUIC, rs_quic_to_json },
{ ALPROTO_DHCP, NULL }, // TODO missing
{ ALPROTO_SNMP, (EveJsonSimpleTxLogFunc)rs_snmp_log_json_response },
Expand Down

0 comments on commit e38b9de

Please sign in to comment.