zokradonh / kopano-docker

Unofficial Kopano Docker images for all Kopano services.
MIT License
59 stars 36 forks source link

mdm plugin #446

Closed XtraLarge closed 3 years ago

XtraLarge commented 3 years ago

After starting kopano docker with enabled mdm-plugin in webapp. Go to settings, enable mdm (mobile device management). Then save and close settings. After that reentry the settins go to "mobile devices" and an error message appears: "Konnte nicht auf den Z-Push Server zugreifen. Bitte wenden Sie sich an Ihren Administrator" = Translated from german .... "Can not access the z-push server, please contact the administrator)

Does/How should the plugin work in the docker environment? .... It looks like a problem?

XtraLarge commented 3 years ago

image

XtraLarge commented 3 years ago

Hi, I've took a look in the config file of the plugin .....

define('PLUGIN_MDM_USER_DEFAULT_ENABLE_MDM', false);
define('PLUGIN_MDM_SERVER', 'localhost');
define('PLUGIN_MDM_SERVER_SSL', false);

I think this will not work without editing .... because z-push i an other container with an own ip. Is there an environment variable or somethin else to configure it?

XtraLarge commented 3 years ago

If you change the "SERVER" from localhost to "kopano_zpush:9080" it will work.

So, is it possible to include a command in webapp to add the correct address after plugin installation?

fbartels commented 3 years ago

Hi @XtraLarge,

you can easily set configuration values through environment variables. See https://github.com/zokradonh/kopano-docker/tree/master/webapp#configuration-through-environment-variables for more details.

XtraLarge commented 3 years ago

Hi, but how can I change the server for the mdm plugin with one of them?

I thought/wish the kopano environment should be preconfigured to work out of the box.

fbartels commented 3 years ago

but how can I change the server for the mdm plugin with one of them?

Like I said, by setting an environment variable. To be precise the following env for kopano_webapp should be what needs to be set KCCONF_WEBAPPPLUGIN_MDM_PLUGIN_MDM_SERVER=kopano_zpush:9080.

I thought/wish the kopano environment should be preconfigured to work out of the box.

For most stuff it is, but the configuration in this repo is just a demo/example anyways. But if you have an idea to make the documentation clearer in how configuration values can be changed then I would like to hear them.

XtraLarge commented 3 years ago

Sorry, now I understand it!

I only saw the environment variable as a part to activate aplugin, I don't recognized that any configuration variable could be set and how to do it.

Perhaps some more examples and where to find any part of the the variable?!?!

XtraLarge commented 3 years ago

Sorry,

the name of the variable "KCCONF_WEBAPPPLUGIN_MDM_PLUGIN_MDM_SERVER" must be wrong, because after setting the variable the webapp container shows the error below and continiously restart.

Content of the webapp docker log: ... Setting CLIENT_TIMEOUT = 0 in /tmp/webapp/config.php Setting INSECURE_COOKIES = true in /tmp/webapp/config.php Setting OIDC_CLIENT_ID = webapp in /tmp/webapp/config.php Setting OIDC_ISS = https://xxx.xxx.de in /tmp/webapp/config.php Error: Config file /tmp/webapp/config-mdm.php not found. Plugin not installed? total 20 drwxr-xr-x 2 root root 80 Sep 20 11:11 . drwxrwxrwt 3 root root 60 Sep 20 11:11 .. -rw-r--r-- 1 root root 14134 Sep 20 11:11 config.php ...

XtraLarge commented 3 years ago

PS: Little error in Documentation (Webapp-folder):

You wrote:

KCCONF_WEBAPPPLUGIN_MDM_PLUGIN_MDM_USER_DEFAULT_ENABLE_MDM=true
^      ^            ^   ^                                  ^
|      |            |   |                                  |
General prefix      |   |                                  | 
       |            |   |                                  |
       Special value to signal the change should go into config-$identifier.php (located in /etc/kopano/webapp)
                    |   |                                  |
                    Identifier for the configuration file (config-$identifier.php)
                    |                                      |
                    Name of the configuration option in the configuration file
                                                           |
                                                           Value of the configuration option

I think correct is:

KCCONF_WEBAPPPLUGIN_MDM_PLUGIN_MDM_USER_DEFAULT_ENABLE_MDM=true
^      ^            ^   ^                                  ^
|      |            |   |                                  |
General prefix      |   |                                  | 
       |            |   |                                  |
       Special value to signal the change should go into config-$identifier.php (located in /etc/kopano/webapp)
                    |   |                                  |
                    Identifier for the configuration file (config-$identifier.php)
                        |                                  |
                        Name of the configuration option in the configuration file
                                                           |
                                                           Value of the configuration option
XtraLarge commented 3 years ago

I've tried to find the error by myself, but ... sorry, I give up :(.

I did not found a way to configure the server. I saw the start-script will configure /tmp/webapp/config-"$identifier".php ( line: php_cfg_gen /tmp/webapp/config-"$identifier".php "${setting3}" "${!setting}") I did not found how you publish the change to real config file.

My "kopano_webapp.env" is:

KCCONF_WEBAPP_INSECURE_COOKIES=true
KCCONF_WEBAPPPLUGIN_MDM_PLUGIN_MDM_USER_DEFAULT_ENABLE_MDM=true
KCCONF_WEBAPPPLUGIN_MDM_PLUGIN_MDM_SERVER=kopano_zpush:9080

and the log with the problem/error is: (Please get attention to the line: "Error: Config file /tmp/webapp/config-mdm.php not found. Plugin not installed?")

...
Kopano WebApp is using the default: connection
Setting CLIENT_TIMEOUT = 0 in /tmp/webapp/config.php
Setting INSECURE_COOKIES = true in /tmp/webapp/config.php
Setting OIDC_CLIENT_ID = webapp in /tmp/webapp/config.php
Setting OIDC_ISS = https://email.derwerres.de in /tmp/webapp/config.php
Error: Config file /tmp/webapp/config-mdm.php not found. Plugin not installed?
total 20
drwxr-xr-x 2 root root    80 Sep 20 12:09 .
drwxrwxrwt 3 root root    60 Sep 20 12:09 ..
-rw-r--r-- 1 root root 14134 Sep 20 12:09 config.php
-rw-r--r-- 1 root root   737 Sep 20 12:09 .htaccess
...

best regards Willi

fbartels commented 3 years ago

Ah, it seems you are installing the mdm plugin at runtime and not already at build time. The config scripting indeed did have a blind spot in this case. A fix for the scripting is included in #447.

XtraLarge commented 3 years ago

Hi, I've tried your fix, but it seems that there is a little bug. In the config file of the mdm plugin is one variable missing. Without that variable the plugin will not work. define('PLUGIN_MDM_SERVER_SSL', false);

fbartels commented 3 years ago

Ah yes, I did notice that in the config file but expected WebApp then to use a default value if that option is missing. I have adapted the sed command to match including the closing quote. This is now possible again since the WebApp config has been adapted to use single quotes exclusively.