Closed spl33f closed 3 months ago
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
What Synology are you using and what kernel is it running?
majorversion="7" minorversion="2" major="7" minor="2" micro="1" buildphase="GM" buildnumber="69057" smallfixnumber="4" nano="4" base="69057" productversion="7.2.1" os_name="DSM" builddate="2024/01/12" buildtime="16:52:29"
Linux SERVER 3.10.108 #69057 SMP Fri Jan 12 16:59:54 CST 2024 x86_64 GNU/Linux synology_braswell_716+II
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
Hi @spl33f I ran into this problem myself and figured it out.
In the image build configuration a symbolic link is being created to the configuration.py file.
To resolve this, I added the following line to my Dockerfile:
COPY ldap_config.py /app/netbox/netbox/netbox/ldap_config.py
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
I've been trying to get my Netbox install over to docker. I'm using this image and I'm running into the same issues. You can set REMOTE_AUTH_BACKEND='netbox.authentication.LDAPBackend'
in the compose file, but it seems to be ignored. Keeps the default setting of 'netbox.authentication.RemoteUserBackend'
.
But after editing the configuration.py
file directly to set that, it complains that django-auth-ldap
isn't installed. When you try to install that, gcc isn't installed, etc.
Getting all of that installed and now we have this error:
<class 'ImportError'>
cannot import name 'ldap_config' from 'netbox' (/app/netbox/netbox/netbox/__init__.py)
when we try to get to the homepage. So it seems a lot is lacking to make REMOTE_AUTH_BACKEND
a usable variable.
django-auth-ldap isn't part of the netbox requirements file, which is why it's not installed, but we can add it easily enough.
django-auth-ldap isn't part of the netbox requirements file, which is why it's not installed, but we can add it easily enough.
would be handy for anybody wanting to use the REMOTE_AUTH_BACKEND
set to LDAP.
I think the last thing I'm stuck on is any additional config files I put in my config volume don't get copied over into the container. So I added ldap_config.py
in my volume, but it doesn't exist in my container.
Well, it gets copied over into /config, but doesn't make its way to /app/netbox/netbox/netbox
Yeah that's annoying that they use a separate config file for it, we'd have to pre-symlink it
Yeah that's annoying that they use a separate config file for it, we'd have to pre-symlink it
seems a number of the ways Netbox does things causes some weird issues. Or maybe its just django. Assuming I manually copy it from /config to /app/netbox/netbox/netbox, I assume it will have to be re-copied any time I update?
When it's built can you see if https://github.com/linuxserver/docker-netbox/pull/60 works for you? I'm creating a symlink for /config/ldap_config.py to /app/netbox/netbox/netbox/ldap_config.py
While you are looking at that, I went ahead and manually copied it over. seems it also needs a log file that already exists to write to.
FYI, with a manual symlink it worked. The only other thing I had to do was create a log file (i used /var/log/ldap.log
) that the app had access to and authentication is working. I'll re-pull after it is available and test without my manual interventions.
Can you change the log location in the config?
Can you change the log location in the config?
Yes. There is a section in ldap_config.py
:
## Logging
logfile = "/var/log/ldap.log"
my_logger = logging.getLogger('django_auth_ldap')
That location is just where I chose for testing. But it can be pointed anywhere.
Probably makes sense to tell users to log to a writable location rather than trying to preconfigure a log file with the right permissions somewhere
I imagine so. I guess you could just dump an empty ldap log file somewhere, but would you really do that for every possible thing somebody might want to log? I think I could just remove that from the config as well if I didn't want to log anything.
@thespad FYI, i just did a pull and the only issue was permission to the log file. Was going to add a volume for it on my compose file, but just commented out logging for LDAP to test and everything seems to have worked.
Is there an existing issue for this?
Current Behavior
Hello,
I need your help please, I try to figure out LDAP integration with Netbox.
I have the following error message:
I tried LDAP search in CLI and it seems ok, I can retrieve my account info. "ldap_config.py" is saved in the same directory as "configuration.py" "init.py" is also present in "/app/netbox/netbox/netbox" but empty.
I also added the following to "configuration.py" file :
The container starts as expected, the file "django-ldap-debug.log" is created but it is empty.
I defintely missed something 🤔
Expected Behavior
Netbox should synced with LDAP and I should see "authentication and authorization" section in netbox administration page.
Steps To Reproduce
Change REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend' to REMOTE_AUTH_BACKEND = 'netbox.authentication.LDAPBackend' in configuration.py
Configure LDAP settings in ldap_config.py
Run recommended docker-compose
Environment
What browsers are you seeing the problem on? Microsoft Edge
Where is your instance running? Linux Server
Additional context Using Portainer within Container Manager on Synology NAS
CPU architecture x86-64
Docker creation
I'm using the recommended docker-compose settings from: https://docs.linuxserver.io/images/docker-netbox/#docker-compose-recommended-click-here-for-more-info
Container logs