diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2018-11-02 17:20:23 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2018-11-02 17:20:23 +0000 |
commit | 05a3b5447baf0a6cdded0bfd60fc462ed2720e78 (patch) | |
tree | b0ff5f6ab014e1043df6c4f5cbddf266629b9ad8 | |
parent | 7eec513af8361bd1aa6b98107817b6881488281f (diff) |
report rDNS in link connect event
-rw-r--r-- | usr.sbin/smtpd/lka.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka_report.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_report.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 6 |
5 files changed, 17 insertions, 13 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 9ad4080fdaf..ac6713b7084 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.210 2018/11/02 16:50:23 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.211 2018/11/02 17:20:22 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -83,6 +83,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg) uint64_t reqid; int v; time_t tm; + const char *rdns; const char *command, *response; const char *ciphers; struct sockaddr_storage ss_src, ss_dest; @@ -407,11 +408,12 @@ lka_imsg(struct mproc *p, struct imsg *imsg) m_msg(&m, imsg); m_get_time(&m, &tm); m_get_id(&m, &reqid); + m_get_string(&m, &rdns); m_get_sockaddr(&m, (struct sockaddr *)&ss_src); m_get_sockaddr(&m, (struct sockaddr *)&ss_dest); m_end(&m); - lka_report_smtp_link_connect(tm, reqid, &ss_src, &ss_dest); + lka_report_smtp_link_connect(tm, reqid, rdns, &ss_src, &ss_dest); return; case IMSG_SMTP_REPORT_LINK_DISCONNECT: diff --git a/usr.sbin/smtpd/lka_report.c b/usr.sbin/smtpd/lka_report.c index c0e0a242152..cbc8fcb1841 100644 --- a/usr.sbin/smtpd/lka_report.c +++ b/usr.sbin/smtpd/lka_report.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_report.c,v 1.4 2018/11/02 17:03:17 gilles Exp $ */ +/* $OpenBSD: lka_report.c,v 1.5 2018/11/02 17:20:22 gilles Exp $ */ /* * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> @@ -51,7 +51,7 @@ report_smtp_broadcast(const char *format, ...) } void -lka_report_smtp_link_connect(time_t tm, uint64_t reqid, +lka_report_smtp_link_connect(time_t tm, uint64_t reqid, const char *rdns, const struct sockaddr_storage *ss_src, const struct sockaddr_storage *ss_dest) { @@ -74,8 +74,8 @@ lka_report_smtp_link_connect(time_t tm, uint64_t reqid, (void)strlcpy(dest, ss_to_text(ss_dest), sizeof dest); report_smtp_broadcast("report|smtp-in|link-connect|" - "%zd|%016"PRIx64"|%s:%d|%s:%d\n", - tm, reqid, src, src_port, dest, dest_port); + "%zd|%016"PRIx64"|%s|%s:%d|%s:%d\n", + tm, reqid, rdns, src, src_port, dest, dest_port); } void diff --git a/usr.sbin/smtpd/smtp_report.c b/usr.sbin/smtpd/smtp_report.c index 60e1f011c61..0db974d9400 100644 --- a/usr.sbin/smtpd/smtp_report.c +++ b/usr.sbin/smtpd/smtp_report.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_report.c,v 1.2 2018/11/02 16:50:23 gilles Exp $ */ +/* $OpenBSD: smtp_report.c,v 1.3 2018/11/02 17:20:22 gilles Exp $ */ /* * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> @@ -44,12 +44,14 @@ #include "rfc5322.h" void -smtp_report_link_connect(uint64_t qid, const struct sockaddr_storage *ss_src, +smtp_report_link_connect(uint64_t qid, const char *rdns, + const struct sockaddr_storage *ss_src, const struct sockaddr_storage *ss_dest) { m_create(p_lka, IMSG_SMTP_REPORT_LINK_CONNECT, 0, 0, -1); m_add_time(p_lka, time(NULL)); m_add_id(p_lka, qid); + m_add_string(p_lka, rdns); m_add_sockaddr(p_lka, (const struct sockaddr *)ss_src); m_add_sockaddr(p_lka, (const struct sockaddr *)ss_dest); m_close(p_lka); diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 738d8d061cf..155b5dbe1d1 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.344 2018/11/02 17:16:30 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.345 2018/11/02 17:20:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1618,7 +1618,7 @@ smtp_connected(struct smtp_session *s) log_info("%016"PRIx64" smtp connected address=%s host=%s", s->id, ss_to_text(&s->ss), s->hostname); - smtp_report_link_connect(s->id, &s->ss, + smtp_report_link_connect(s->id, s->hostname, &s->ss, &s->listener->ss); sl = sizeof(ss); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 82477ef3fd1..7a41dc74fe7 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.567 2018/11/02 16:50:23 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.568 2018/11/02 17:20:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1249,7 +1249,7 @@ struct io *lka_proc_get_io(const char *); /* lka_report.c */ -void lka_report_smtp_link_connect(time_t, uint64_t, const struct sockaddr_storage *, const struct sockaddr_storage *); +void lka_report_smtp_link_connect(time_t, uint64_t, const char *, const struct sockaddr_storage *, const struct sockaddr_storage *); void lka_report_smtp_link_disconnect(time_t, uint64_t); void lka_report_smtp_link_tls(time_t, uint64_t, const char *); void lka_report_smtp_tx_begin(time_t, uint64_t); @@ -1427,7 +1427,7 @@ void smtp_collect(void); /* smtp_report.c */ -void smtp_report_link_connect(uint64_t, const struct sockaddr_storage *, const struct sockaddr_storage *); +void smtp_report_link_connect(uint64_t, const char *, const struct sockaddr_storage *, const struct sockaddr_storage *); void smtp_report_link_disconnect(uint64_t); void smtp_report_link_tls(uint64_t, const char *); void smtp_report_tx_begin(uint64_t); |