ArieGato / serilog-sinks-rabbitmq

Serilog Sink for RabbitMq
Apache License 2.0
55 stars 52 forks source link

Username should not be required #37

Closed mribichich closed 7 years ago

mribichich commented 7 years ago

Hi there, in our case we dont use username and password, but the library make us use one. It shouldn't be necessary to specify one.

I could contribute if you wish

thanks!

madslyng commented 7 years ago

@mribichich I believe you can just enter empty strings in those two situations. Am I wrong ? If so, you're welcome to send a pull request

mribichich commented 7 years ago

Yes I enter empty strings, but it thrown me an exception saying that the username was required

On Thu, Jan 12, 2017 at 3:49 AM Steffen Sun Lyng notifications@github.com wrote:

@mribichich https://github.com/mribichich I believe you can just enter empty strings in those two situations. Am I wrong ? If so, you're welcome to send a pull request

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sonicjolt/serilog-sinks-rabbitmq/issues/37#issuecomment-272089751, or mute the thread https://github.com/notifications/unsubscribe-auth/AFe3SgHhKCXGVinFzXhcTyeJto9Cdyz7ks5rRczbgaJpZM4LhCN9 .

jaredcnance commented 7 years ago

this is the offending line: https://github.com/sonicjolt/serilog-sinks-rabbitmq/blob/master/src/Serilog.Sinks.RabbitMQ/LoggerConfigurationRabbitMQExtension.cs#L84

@mribichich please open a PR to address. Just to clarify, you do not authenticate with RabbitMQ? Or you authenticate with empty username/password combination?

madslyng commented 7 years ago

Isn't the solution so simple as to do a null-check on username, similar to 'password'. And then it's fixed ?

mribichich commented 7 years ago

Since is a close system, we don't authenticate. We dont need to worry about credentials in this case.

thanks, I'll do it later!

madslyng commented 7 years ago

Added PR for this: https://github.com/sonicjolt/serilog-sinks-rabbitmq/pull/38

madslyng commented 7 years ago

@mribichich I'm not certain that this will fix your issue though. But since I haven't tried it myself, I'm not sure. But I found this post, that talks about the same situation. And if you need to setup SSL/TLS, then I would argue it would be easier to just create a username/password.

mribichich commented 7 years ago

Thats weird. I already use the rabbitmq library for c# and I use it without a username/password.

I dont think it should be a problem.

thanks!

On Sat, Jan 14, 2017 at 4:40 AM Steffen Sun Lyng notifications@github.com wrote:

@mribichich https://github.com/mribichich I'm not certain that this will fix your issue though. But since I haven't tried it myself, I'm not certain. But I found this post http://stackoverflow.com/questions/36715087/rabbitmq-authentication-without-password, that talks about the same situation. And if you need to setup SSL/TLS, then I would argue it would be easier to just create a username/password.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sonicjolt/serilog-sinks-rabbitmq/issues/37#issuecomment-272608422, or mute the thread https://github.com/notifications/unsubscribe-auth/AFe3Stw5GxOVPxg1lDoVJNwHJYeq7k8rks5rSHv3gaJpZM4LhCN9 .

madslyng commented 7 years ago

@mribichich That's cool. Do you have some code-samples that show how. Maybe we can improve this library using your code.

jaredcnance commented 7 years ago

That kind of makes me question the implementation. Did you just not set the username/password? Did you ever change the username/password in the control panel? If you just haven't set them, then you most definitely are authenticating. You would just be using the default username/passwords:

All factory properties have default values. The default value for a property will be used if the property remains unassigned prior to creating a connection:

Username "guest" Password "guest"

http://www.rabbitmq.com/dotnet-api-guide.html

These are also the default credentials used by the RabbitMQ server. So, if you haven't explicitly changed them, then you are using the defaults.

mribichich commented 7 years ago

wow, I haven't seen that one. Thats new to me. So if that is how it works, then you are right, Its using the defaults one over the cover. I never seen a library using default credentials if you dont set them up.

I'll check with my app, changing the default username and password, and let you know what happends.

It thats the case, maybe this library can do the same thing

madslyng commented 7 years ago

Closing. Username is required.