Skip to content
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

Disable ANONYMOUS login #1705

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Disable ANONYMOUS login #1705

merged 2 commits into from
Aug 19, 2024

Conversation

ansd
Copy link
Member

@ansd ansd commented Aug 19, 2024

See rabbitmq/rabbitmq-server#11999 for full context.

Starting with RabbitMQ 4.0, anonymous login should be disabled in production.

anonymous_login_user and anonymous_login_pass both default to guest in RabbitMQ 4.0. The rabbitmq/cluster-operator complies already with best practices by provisioning a new default_user and default_pass instead of using RabbitMQ's default guest user.
Instead of having RabbitMQ advertise the ANONYMOUS mechanism, this commit disables anonymous logins.

Because anonymous_login_user is a new RabbitMQ 4.0 rabbitmq.conf setting and the cluster-operator doesn't know what RabbitMQ version it deploys and setting rabbitmq.conf key anonymous_login_user in RabbitMQ 3.13 would make booting RabbitMQ fail, this commit modifies the auth_mechanisms.* settings in rabbitmq.conf:
If the user provided a conscious choice on what auth_mechanisms RabbitMQ should advertise, this configuration will be respected. If the user did not configure auth_mechanisms, the cluster-operator will disable ANONYMOUS logins by setting only:

auth_mechanisms.1 = PLAIN
auth_mechanisms.2 = AMQPLAIN

See rabbitmq/rabbitmq-server#11999 for full
context.

Starting with RabbitMQ 4.0, anonymous login should be disabled in
production.

`anonymous_login_user` and `anonymous_login_pass` both default to `guest` in RabbitMQ 4.0.
The rabbitmq/cluster-operator complies already with best practices by
provisioning a new `default_user` and `default_pass` instead of using
RabbitMQ's default `guest` user.
Instead of having RabbitMQ advertise the ANONYMOUS mechanism, this commit disables
anonymous logins.

Because `anonymous_login_user` is a new RabbitMQ 4.0 `rabbitmq.conf`
setting and the cluster-operator doesn't know what RabbitMQ version it
deploys and setting `rabbitmq.conf` key `anonymous_login_user` in RabbitMQ 3.13
would make booting RabbitMQ fail, this commit modifies the `auth_mechanisms.*`
settings in `rabbitmq.conf`:
If the user provided a conscious choice on what `auth_mechanisms`
RabbitMQ should advertise, this configuration will be respected.
If the user did not configure `auth_mechanisms`, the cluster-operator will
disable ANONYMOUS logins by setting only:
```
auth_mechanisms.1 = PLAIN
auth_mechanisms.2 = AMQPLAIN
```
@ansd ansd added this to the 2.10.0 milestone Aug 19, 2024
@ansd ansd marked this pull request as ready for review August 19, 2024 08:36
@ansd
Copy link
Member Author

ansd commented Aug 19, 2024

Note to reviewers: You could deploy different configurations in spec.rabbitmq.additionalConfig or spec.rabbitmq.advancedConfig and check the effective configuration via kubectl exec myrabbit-server-0 -c rabbitmq -- rabbitmqctl eval 'application:get_env(rabbit, auth_mechanisms).'

@ansd ansd requested a review from Zerpet August 19, 2024 10:42
@ansd ansd merged commit cfa0d03 into main Aug 19, 2024
16 checks passed
@Zerpet Zerpet deleted the auth-mechanisms branch October 8, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants