-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[40] Build SMTP Integration For Threats Logging #201
[40] Build SMTP Integration For Threats Logging #201
Conversation
ea85c92
to
25476e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! The code in general looks good, I left few minor comments.
[dependencies] | ||
pulsar-core = { path = "../../pulsar-core" } | ||
|
||
tokio = { version = "1", features = ["full"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... can we double-check whether we really need the full
set of features? Maybe it's possible to use just specific ones?
The CI failure seems legit - the ring crate fails to build on riscv. We need to make sure we don't build it for riscv. I will think of solutions and let you know of I have any ideas, but feel free to also look for solutions. :) |
25476e6
to
814fcc8
Compare
Hmm I think these can maybe be fixed by adding libsssl-dev to the CI. Thoughts? |
814fcc8
to
c878abb
Compare
Hi, I think a better solution is to use lettre, it's a more advanced crate. by default it uses |
c878abb
to
d7c72c4
Compare
struct SmtpNotifierConfig { | ||
server: String, | ||
user: String, | ||
password: String, | ||
receiver: String, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should also add port
in the configuration and an option for the encryption, something like:
enum Encryption {
Plain,
TLS,
StartTLS
}
you need to add |
e6530ff
to
07d06ea
Compare
Got everything building 🎉 Added the tls and port configuration options as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! I will let @banditopazzo to give a final approval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the main issue is the fixed vendored
feature of openssl
: in normal cases openssl should be dynamically linked with the option to link it statically, for example with musl
. this should be under a feature and the feature should be re-exported by pulsar binary.
I added few suggestions to cross containers and tomls but needs to double checked.
the workflows need to be modified for musl builds adding an extra feature openssl-vendored
let message = Message::builder() | ||
.from("Pulsar <pulsar-threat-notification@gmail.com>".parse()?) | ||
.to(config.receiver.parse()?) | ||
.subject(subject) | ||
.body(body)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the .from
in the builder should be optional. for many email providers it's not possible to change the sender because of authentication implications and some of them don't require it to be set
ad52979
to
717c4d4
Compare
Couldn't figure out how to pass a --feature arg to cross from the CI, but did find an alternative using platform specific dependencies targeting target_env: musl, gnu |
717c4d4
to
310ad3a
Compare
#202 is merged, please rebase on main to check if the ci passes after those changes |
310ad3a
to
f7de67a
Compare
f7de67a
to
c074c56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor changes are necessary, I will make a fix after this is merged
Build SMTP Integration for threats logging
Adds a smtp notifier module that sends email on threats. Uses mail-sender library for convenience, could write inhouse smtp-client if necessary.
I have
cargo fmt
;cargo clippy
;cargo test
and all tests pass;resolves #40