wdes / mail-autodiscover-autoconfig

A docker image to deploy to have a dynamic autodiscover XML and autoconfig XML host. Supports Outlook, Thunderbird, Apple, some Android apps, and more..
https://hub.docker.com/r/wdes/mail-autodiscover-autoconfig
Mozilla Public License 2.0
23 stars 1 forks source link

/apple URL does not work #5

Closed joshms123 closed 2 years ago

joshms123 commented 2 years ago

Hello, When navigating to /apple or /dns-zone, the application just returns 404 not found; however when navigating to mobile config (with email filled in) it downloads the profile.

williamdes commented 2 years ago

Hi @joshms123 Indeed, I did not release this yet I will try to release it today

williamdes commented 2 years ago

I deployed this on an edge version:

docker pull ghcr.io/wdes/mail-autodiscover-autoconfig/mail-autodiscover-autoconfig:edge
joshms123 commented 2 years ago

Hello, I don't seem to have access to that package. Thank you for the help so far.

williamdes commented 2 years ago

I don't seem to have access to that package

You need to use

# docker login ghcr.io
username: joshms123
password: githubPasswordOrUserToken

I deployed this on my server and I have a minor UI improvement to do before releasing the final version

joshms123 commented 2 years ago

I did login and it just displayed access denied. When I navigate to the packages page, it does show the deployment but when I navigate to said deployment it says 0 packages.

williamdes commented 2 years ago

I did login and it just displayed access denied.

Do you mean at the login stage ? I did create a token at https://github.com/settings/tokens with read:packages and used it as a password

williamdes commented 2 years ago

Oops: it's docker login ghcr.io

joshms123 commented 2 years ago

Yes; I've also tested by pulling another public GHCR package and that worked.

williamdes commented 2 years ago

Here is part of my production docker-compose

    mail-autodiscover-autoconfig:
        #image: wdes/mail-autodiscover-autoconfig:latest
        image: ghcr.io/wdes/mail-autodiscover-autoconfig/mail-autodiscover-autoconfig:edge
        mem_limit: 120M
        mem_reservation: 50M
        restart: on-failure:40
        network_mode: host
        environment:
            ROCKET_PROFILE: production
            ROCKET_ADDRESS: "2a10:4646:xxx::xxx"
            ROCKET_PORT: "80"
            ROCKET_LOG_LEVEL: normal
            APPLE_MAIL_UUID: ccf622ec-1905-4c60-xxx-4fa1455cbee4
            APPLE_PROFILE_UUID: 1ceeceea-bc41-4131-xxx-f8b13e429cb3
            CUSTOM_DOMAINS: xxx.xxx
            IMAP_HOSTNAME: imap.xxx.xxx.xxx
            POP_HOSTNAME: pop.xxx.xxx.xxx
            SMTP_HOSTNAME: smtp.xxx.xxx.xxx

How is yours ?

joshms123 commented 2 years ago
services:
  mail-acd:
    image: ghcr.io/wdes/mail-autodiscover-autoconfig/mail-autodiscover-autoconfig:edge
williamdes commented 2 years ago

Okay I got it, it was private.. Sorry for the mistake Let me know how the Apple page works out

joshms123 commented 2 years ago

That now all works. However, seems I've ran into another issue. Even though in the env my IMAP_HOSTNAME is set to a custom server, it seems to default back to imap.domain.tld (only tested in the config-v1.1.xml so far). Would you like me to move this to a new issue?

williamdes commented 2 years ago

Did you add it to CUSTOM_DOMAINS by mistake ?

joshms123 commented 2 years ago

My config is as follows:

      CUSTOM_DOMAINS: domain.tld
      IMAP_HOSTNAME: mail.provider.tld
      POP_HOSTNAME: mail.provider.tld
      SMTP_HOSTNAME: mail.provider.tld

However, it seems to come back with imap.domain.tld instead of mail.provider.tld. Also just read through the output of apple xml config and it has the same issue.

williamdes commented 2 years ago

Hmm, what are your front end domains?

This may be related to #3

This is how it currently works:

The domain from where you access the server will make all the magic. It's very important that you get the configuration right

How did you configure all this? Normally you should have a server running A DNS record domain.tld pointing to the server Another one (provider.tld) also pointing to the server or CNAMEing the other domain

joshms123 commented 2 years ago

Hello, In my custom domains, I have my website domain (domain.tld) that is the domain of e-mail addresses (E.G: josh@domain.tld). In my imap, smtp and pop vars I have the domain of my email provider (mail.mymailcheap.com). It seems to just return as you said (imap,pop,smtp).domain.tld where as I'd need it to return the provider addresses while using the email@domain.tld. Hope this makes sense.

williamdes commented 2 years ago

Hello, In my custom domains, I have my website domain (domain.tld) that is the domain of e-mail addresses (E.G: josh@domain.tld). In my imap, smtp and pop vars I have the domain of my email provider (mail.mymailcheap.com). It seems to just return as you said (imap,pop,smtp).domain.tld where as I'd need it to return the provider addresses while using the email@domain.tld. Hope this makes sense.

Hello

If I understand this correctly your domain must not be in CUSTOM_DOMAINS because it has to have IMAP_HOSTNAME and other ENVs applied. Remove it and try once more, it should work better ;)

I think I will implement a config file soon, it's not easy for people to understand how I currently made this work

If I would make a configuration to explain the setup file it would look like

[*]
imap = $IMAP_HOSTNAME
smtp = $SMTP_HOSTNAME
pop = $POP_HOSTNAME

# For each CUSTOM_DOMAINS as $CUSTOM_DOMAIN
[$CUSTOM_DOMAIN]
imap = imap.$CUSTOM_DOMAIN
smtp = smtp.$CUSTOM_DOMAIN
pop = pop.$CUSTOM_DOMAIN

This is what this code does: https://github.com/wdes/mail-autodiscover-autoconfig/blob/main/src/util.rs#L12-L40

So your autoconfig and autodiscover DNS fields should point to the server that hosts this node. And then all requests done with softwares will end up in https://autoconfig.domain.tld and then the service will detect that it needs to apply ENVs or the imap,pop,smtp.domain.tld syntaxes based on if it is present in CUSTOM_DOMAINS

Off topic: What do you think about this config file structure ?

joshms123 commented 2 years ago

Hello, That makes perfect sense; having that documented would definitely help. So what would I put in place? I tried just removing it from my compose, but it panics because that var isn't set. I have replaced it with a placeholder and that does seem to work, but it might be worth documenting what to put in place (or just having the software use an empty default if that is not set).

williamdes commented 2 years ago

Hello, That makes perfect sense; having that documented would definitely help. So what would I put in place? I tried just removing it from my compose, but it panics because that var isn't set. I have replaced it with a placeholder and that does seem to work, but it might be worth documenting what to put in place (or just having the software use an empty default if that is not set).

I had tried to document that with a comment on my example ENV but it really needs to be changed and have a real configuration file that does not need paragraphs to be understood ^^

You can put an empty string it should define the ENV Anyway, I will patch the code to be more tolerent when the CUSTOM_DOMAINS ENV does not exist so it does not panic.

williamdes commented 2 years ago

All the changes discussed above are pushed, built and ready on the edge version. Let me know how it works for you, and then I may proceed to a release

williamdes commented 2 years ago

I just published v1.5.0 🎉 Let me know if there is more to fix