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

can't connect to redis: permission denied #567

Closed
norabruns opened this issue Oct 22, 2021 · 3 comments · Fixed by #568
Closed

can't connect to redis: permission denied #567

norabruns opened this issue Oct 22, 2021 · 3 comments · Fixed by #568
Assignees
Labels
backport Should be backported to previous releases bug Something isn't working

Comments

@norabruns
Copy link
Contributor

When irrd is started as root, and irrd.user and irrd.group is set, and access to the redis unix domain socket is granted to that user through a supplementary group (e.g. redis on ubuntu/debian), irrd will not be able to connect to redis.

Logs look like this:

systemd[1]: Starting IRRD4...
irrd[1720]: [irrd.daemon.main#INFO] IRRd attempting to secure PID
irrd[1720]: [irrd.daemon.main#INFO] IRRd 4.2.0 starting, PID 1720, PID file in /home/irrd/
irrd-whois-serv[1729]: [irrd.server.whois.server#INFO] Starting whois server on TCP ('0.0.0.0', 43)
irrd-preload-st[1730]: [root#INFO] Starting preload store manager
irrd-preload-st[1730]: [irrd.storage.preload#ERROR] Failed to empty preload store due to redis connection error, queries may have outdated results until full reload is completed (max 30s): Error 13 connecting to unix socket: /var/run/redis/redis-server.sock. Permission denied.
irrd-preload-st[1730]: [irrd.storage.preload#ERROR] Failed redis pubsub connection, attempting reconnect and reload in 5s: Error 13 connecting to unix socket: /var/run/redis/redis-server.sock. Permission denied.
irrd-http-serve[1731]: [uvicorn.error#INFO] Uvicorn running on http://[::1]:8080 (Press CTRL+C to quit)
irrd-http-serve[1731]: [uvicorn.error#INFO] Started parent process [1731]
irrd-whois-serv[1734]: [irrd.storage.preload#ERROR] Failed redis pubsub connection, attempting reconnect and reload in 5s: Error 13 connecting to unix socket: /var/run/redis/redis-server.sock. Permission denied.
irrd-whois-serv[1735]: [irrd.storage.preload#ERROR] Failed redis pubsub connection, attempting reconnect and reload in 5s: Error 13 connecting to unix socket: /var/run/redis/redis-server.sock. Permission denied.
irrd-whois-serv[1737]: [irrd.storage.preload#ERROR] Failed redis pubsub connection, attempting reconnect and reload in 5s: Error 13 connecting to unix socket: /var/run/redis/redis-server.sock. Permission denied.

IRRd version you are running
irrd 4.2.0

Cause (I assume)
This is caused by change_process_owner being called with initgroups=False, so the irrd process does not have any supplementary groups. See https://pagure.io/python-daemon/blob/main/f/daemon/daemon.py#_609

I do not understand why initgroups=False is the default, as it results in very confusing behavior.

@mxsasha
Copy link
Collaborator

mxsasha commented Oct 24, 2021

Entirely agree, thanks for the report and PR!

@mxsasha mxsasha self-assigned this Oct 24, 2021
@mxsasha mxsasha added the backport Should be backported to previous releases label Oct 24, 2021
@mxsasha mxsasha added the bug Something isn't working label Oct 24, 2021
@mxsasha
Copy link
Collaborator

mxsasha commented Oct 28, 2021

Still needs backport to 4.2

@mxsasha mxsasha reopened this Oct 28, 2021
@mxsasha
Copy link
Collaborator

mxsasha commented Oct 29, 2021

Released in 4.2.1

@mxsasha mxsasha closed this as completed Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Should be backported to previous releases bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants