How to change default credentials for Felix Web Console?

Hi, as the title says, could someone please explain to me how to change the default credentials for the Felix web console, both for the edge and the backend application? I’d like to do it with a configuration file, since I’m running OpenEMS on Docker and I want to avoid manual configuration as much as possible.
Can Odoo be used to setup user authentication? Thanks.

You can configure username and password using below settings:
https://felix.apache.org/documentation/subprojects/apache-felix-web-console.html#_configuration

The configuration pid is org.apache.felix.webconsole.internal.servlet.OsgiManager. Please note that later part of above documentation section describes also how to setup this using framework properties which can be configured through file (in some cases).

I read that part of the documentation, but couldn’t figure out how to configure those settings through a file. As far as I understood, the only files related to Felix in OpenEMS are in the /etc/openems.d directory, but I couldn’t find any seemingly relevant file in there. If I missed anything please let me know.

You need to locate or mount additional file to your docker container.

Filename: org/apache/felix/webconsole/internal/servlet/OsgiManager.config. It should live under /var/opt/openems/config within docker. Complete path would be /var/opt/openems/config/org/apache/felix/webconsole/internal/servlet/OsgiManager.config.

Contents of this file:

:org.apache.felix.configadmin.revision:=L"4"
service.pid="org.apache.felix.webconsole.internal.servlet.OsgiManager"
username="foo"
password="foo"

Password will get rewritten to encrypted after first launch, so file can be mounted using “read-write” mode and switched later on to “read”.

1 Like

Thank you. Since I’m running the OpenEMS jar in a Docker container with the following parameters:
"-Dfelix.cm.dir=/etc/openems.d/",
"-Dopenems.data.dir=/var/lib/openems/"
and these two directories are mounted as bind mounts in Docker, I had to put org/apache/felix/webconsole/internal/servlet/OsgiManager.config in the directory corresponding to the path /etc/openems.d within the container.

Awesome, glad it worked for you. Same way will work also for openems backend. :slight_smile:

Yes, it works the very same. Do you know how to setup authentication for OpenEMS UI? If I have to open a new thread, please let me know.

You can change it in the Core User Component in the Apache Felix Web Console. But there you must hash it before with SHA512 and a salt.

1 Like

What is the setting I must look for? I’m running OpenEMS UI connected to OpenEMS backend. As far as I understood - please correct me if I’m wrong - I should configure Metadata.File or Metadata.Odoo, shouldn’t I?

@ldywicki I’m also trying to setup a directory to dynamically load bundles in OpenEMS, leveraging Felix’s org.apache.felix.fileinstall property, but I couldn’t figure out what directory this path is relative to. The working directory from which OpenEMS’ jar is run is the root of the container, so I guess the path in Felix should be relative to it, right? I tried writing an absolute path, but it didn’t work. In my case, OpenEMS runs in a Docker container. If I use the command line argument -Dfelix.fileinstall.dir=<path_inside_container> the bundle is loaded at container bootstrap, but if I add the bundle after the container has been created, I have to reboot it to see the bundle in the Felix console.
Could you please help me with this problem?

I have to dig into it. Will try to bring some tips next week

I solved the problem of OpenEMS not seeing the addition/removal of a bundle unless restarting the container by adding this command line argument to launch OpenEMS:
-Dfelix.fileinstall.disableNio2=true
Maybe it can be useful for someone else.

2 Likes