mailcow-dockerized icon indicating copy to clipboard operation
mailcow-dockerized copied to clipboard

mobileconfig not signed

Open MatthiasHertel opened this issue 6 years ago • 13 comments

Hi there,

is it possible to sign the mobileconfig.php for preventing the "not signed" issue ?

image

-matthias

MatthiasHertel avatar Jun 14 '18 05:06 MatthiasHertel

That was originally part of #972, but removed before merging. The implementation there was a bit dangerous because it used the same private key as the TLS services.

Nobody ever picked up on it because signing isn't really required, but feel free to submit another pull request that obtains a separate Let's Encrypt certificate and uses that for signing.

mkuron avatar Jun 14 '18 10:06 mkuron

ok i think this is a valuable feature and i would like to implement it can you briefly explain the necessary steps to properly implement it?

my thoughts:

  • define this feature as optional

  • implement subdomain for delivering the mobileconfig.php over an own cert , maybe mobilconfig.${MAILCOW_HOST}

  • update documentation (dns, nginxconf and necessary env vars)

  • something else ... ?

MatthiasHertel avatar Jun 15 '18 05:06 MatthiasHertel

This would really be great :) +1

phpfs avatar Jun 16 '18 18:06 phpfs

@MatthiasHertel, sounds good. Add an environment variable with the subdomain name to be used. If it is not set, no certificate should be requested and no mobileconfig should be signed.

Since the certificate is separate from the one for the mailcow domains, you don't need to modify the acme container entrypoint. Instead, obtain the certificate from within the PHP script (using a PHP acme client like https://github.com/kelunik/acme-client) the first time a mobileconfig is generated or if the previous certificate has expired.

Regarding the signing: maybe @feldsam can provide his code if he still has it. It used to be part of #972, but he squashed all commits into one before merging, which means that the history ist lost.

mkuron avatar Jun 17 '18 16:06 mkuron

Hello, In my PR was signing using proc_open and calling openssl on cmd line, which @andryyy don't like and recommend do it via php openssl lib, so my code is useless for this comunity.

feldsam avatar Jun 17 '18 17:06 feldsam

@feldsam, could you still push your code to a Git repository? It's not that difficult to just replace that proc_open with a library call. Everything else -- like preparing the data and attaching the signature to the plist -- is still the same.

mkuron avatar Jun 17 '18 20:06 mkuron

Hello, there is whole file - latest version

https://github.com/FELDSAM-INC/mailcow-dockerized/blob/feldhost-rc/data/web/mobileconfig.php

and there is commit (I don't know if I something changes in that code block after this commit) https://github.com/FELDSAM-INC/mailcow-dockerized/commit/325ea9184c03ca78cd0a46f30b03b4198f48beb1

feldsam avatar Jun 17 '18 21:06 feldsam

That should provide a good starting point for @MatthiasHertel. Thanks, @feldsam. I guess the needed PHP function is openssl_pkcs7_sign

mkuron avatar Jun 17 '18 21:06 mkuron

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 13 '18 20:10 stale[bot]

Hi, I too would like to know the plans for this feature, alternatively is someone using their own workaround?

Thanks

JPaulMora avatar Aug 10 '19 22:08 JPaulMora

Hi all, here is my version, which uses Let'sencrypt SSL. Small change in docker compose and in acme docker-entrypoint to generate password protected key. Core developers doesn't like mounting ssl directory inside PHP container and propose generating separate keys for this purpose, but nobody do it and I use my version. Since my last PR I refactored proc_open to use native php ssl functions.

probably better will be mounting just key.secure.pem and cert.pem instead of whole ssl dir.

@mkuron, look on this commit and if you like I can do PR.

https://github.com/FELDSAM-INC/mailcow-dockerized/commit/a7a8fc5082c02c822fb7724a86ae85818e40ddd9

feldsam avatar Aug 11 '19 19:08 feldsam

@DerLinkman I think this is working

VermiumSifell avatar Jan 20 '23 12:01 VermiumSifell

any update ?

worryboy avatar Jan 08 '24 14:01 worryboy