-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have SOGo as root and admin panel under /admin #393
Comments
|
Hi @mwent-cray, you can achieve this by setting up mailcow-dockerized behind an aliased reverse proxy via nginx/apache. You may want to take a look at this in the docs. But instead of setting it the standard way, you will do it like this: Now you get the point, I'll give the chance to let you find a configuration for NGINX. As for setting up a basic auth, I really do not recommend setting up one because this prevents non-admin users who wants to change his/her mailcow settings via admin panel. Instead, I recommend you to utilize the built-in 2 factor authentication for mailcow. I'm closing this for now, don't hesitate to reply back and I would be happy to reopen this for you. 😉 |
|
@PhoenixPeca Thank you for the explanation. I tried this actually before opening a ticket. (Using Nginx) But was unsuccessful. Any idea? |
|
Sorry, I can't help you with NGINX, I am currently using apache. Actually, I am doing it right now in my production server but only with apache. and I have no time to test a configuration for nginx. 😭 I'm really sorry for that. UpdateHowever, I think this might work for you: https://serverfault.com/questions/650117/serving-multiple-proxy-endpoints-under-location-in-nginx |
|
It would be nice if the issue can stay open - if anyone finds a solution for this. |
|
Hi everyone, I'll post in this issue for convenience. I've been trying to make it work this thing out but, it was not possible because of SOGo, it shows "normal" but I couldn't login with any user, I just made that "admin" works fine. I'm sharing my nginx conf file but it looks pretty dirty, if someone could help us to clarify how to achieve this, maybe @andryyy? Also I've been thinking that the references to the files for the admin (css/js/img) should be relative and not absolute, because I had to add a location for each one. |
|
Can someone who has successfully set this up on Apache post a complete example? Nothing I've seen here works, neither does the example here: https://mailcow.github.io/mailcow-dockerized-docs/firststeps-rp/ When I use the code below, the proxy works, but it doesn't point to SOGo, it just goes to the admin login. And https does not work. It says invalid certificate because it's trying to use the certificate for the domain in the Docker nginx config for some reason. |
|
add this in mailcow-dockerized/data/web/index.php if ($_SERVER['REMOTE_ADDR'] != "Your.Public.IP.Address"){ This way everyone except Administrators IP will be redirected to SOGo and wont have access to the admin panel at all, and for user password change you can enable it in /mailcow-dockerized/data/conf/sogo/sogo.conf |
Here's my attempt:
Within Unfortunately as I later found out, the entire Mailcow admin portal uses absolute path for all the resources (incl. images, css, javascript, etc), thus the html page loaded fine but all the images and page layout are unable to load because they're trying for the files at, for example, So okay, I thought to myself, I'll just redirect all my root traffic (https://mail.my.email/) to Now the Possible solutions I came up with:
Hope this problem gets addressed soon, and please follow up if you have better solutions! Thanks very much! |
|
Oh sorry I did not read @axd 's post in detail, turns out he created a more sophisticated config to address the problem on the nginx side. |
|
Unfortunately, there is only so much configurability a one-size-fits-all solution like Mailcow can offer. If you want any more sophisticated URL routing, you'll need to put a reverse proxy in front of it or edit the Nginx config as suggested above. You can post a pull request against the docs repo to explain how to make these modifications. I think the only compromise we could make is to move the Mailcow admin interface to /admin and make it configurable whether / redirects to /admin/ or to /SOGo/ (that redirect could be done in PHP, so the setting could be stored in the database). That would also require fixing all the absolute links. |
|
Yeah that will be acceptable. I can live with reverse-proxy'ing, just the absolute links will be a pain, and has to be fixed. |
|
why would anyone want their members facing the admin login by default? |
|
Because mailcow UI is for users and admins. |
|
The URL should just be changed to something generic like /webmail or /mail instead of /SOGo. |
|
true |
|
In case anyone finds this discussion like I did (top google result), I came up with a pretty simple way to get this done using the documentation as a base and setting up a reverse proxy using nginx on the host system. The root of the domain will go to SOGo and /admin will go to mailcow. Everything else seems to work just fine. My nginx.conf is here, SSL settings here and the actual site configuration is here. Sorry, I like doing things in different files/modules. I'm just learning so please comment on my gists and let me know if you find stuff not working or if you have suggestions! |
|
Serving the admin page (mailcow ui) instead of the webmail page (sogo) seems counter-intuitive. In 99% of the cases, the user will want to access his/her mails, not change the timezone if the profile. |
|
Hi, As an alternate solution it is possible to use 2 subdomains:
To redirect to /SOGo/ I use the following config options for Apache This way I can use mail.example.com as the imap/smtp/exchange server address and to access the admin panel, while the webmail can be accessed via https://webmail.example.com. But yes, +1 for having SOGo as root and the admin panel on /admin. |
|
Damn, I need to learn more PHP... nice solution @thebritt :-) You would have to do this after each update though, right? Anyways, for the same reason as everyone else (the benefit of anyone finding this from a Google search), just thought I'd update the option to have nginx do the redirect for you, assuming you're using it as a reverse proxy as per the setup guide. It's pretty much the same as my previous post, except that redirects to 'admin' cause loops in recent updates so you have to pick a different subdir (I choose 'setup' in my example). So, @thebritt has an excellent solution if you want to keep using 'admin' and/or if you are not using a reverse proxy. If you want to handle it all via nginx, then here's the updated setup I use and hopefully, it'll help someone else too. Just add these two location blocks: # proxy root to SOGo
location / {
rewrite ^/$ /SOGo;
proxy_pass http://127.0.0.1:8080;
}
# proxy /setup to Mailcow Admin Panel (root)
location ^~/setup/ {
proxy_pass http://127.0.0.1:8080/;
}HTH. |
|
Tried for quite some time to have something similar but with Traefik. Any hints hon how to do this? Thanks. |
@Gaddea I would think you'd do something like this:
Based on the documentation, the config would look something like: [frontends.mailcowFrontend]
backend = "mailcowBackend"
[frontends.mailcowFrontend.routes.test_1]
rule = "PathStrip: /admin/"
[frontends.mailcowFrontend.routes.test_2]
rule = "AddPrefix: /SOGo/"Again, this is all based on the documentation. I don't know exactly how the redirects work in Traefik since I've never worked with it and, unfortunately, don't have time at the moment to spin up a virtual environment to test it out. I'm just guessing based on a quick read of the documentation, but maybe this will inspire you along the right path? Let us know if this works or if this was helpful in finding a solution. Good luck :-) |
|
@asifbacchus docker-compose.override.yml This DOES move the default interface to mail.mydomain.com/admin, HOWEVER while mail.mydomain.com does resolve SOGo (you can see EDIT: Ok so it seems that in Firefox the page loads but php/css does not. And logging into the admin functions is unusable. |
|
@joeknock90 That's all I can think of right now, but I'll keep mulling it over. Also, any hints in the nginx logs from mailcow? Let me know... I'm kinda interested now since I've never looked at Traefik before but, now I'm interested :-) |
|
Fwiw I'd just like to chime in and mention that a feature that let me easily configure URL's for the services would be preferable. I would like to achieve the following URL structure: https://domain.tld - Nextcloud |
@maetthew |
|
@asifbacchus Screw all that I'm an idiot who can't type. So trailing slash does fix SOGo and made it mail.mydomain.com. I am able to log in and manipulate and send email and etc. The following Does put admin at the correct place but logging just fowards me directly to SOGo. We are getting pretty close! Looking into header config now. Thanks! |
|
I was reviewing the documentation and it seems the issue is that that MATCH rules are processed before MODIFIER rules within the same directive. As such, it first matches /admin/ and strips it, reprocesses the request through the same rules but this time matches the stripped domain and adds /SOGo/ as per the rules and voila -- you are forwarded to the SOGo site. This actually happens with NGINX and Apache also, that's why we use two separate proxy directives. Could you not do the same with Traefik? Use two frontends? Frontend 1 for SOGo: [frontends.mailcowFrontend]
backend = "mailcowBackend"
[frontends.mailcowFrontend.routes.test_1]
rule = "AddPrefix: /SOGo/"Frontend for mailcow admin: [frontends.mailcowAdmin]
backend = "mailcowBackend"
[frontends.mailcowAdmin.routes_test_1]
rule = "PathStrip: /admin/"I don't know if that kind of setup is viable in Traefik, but it would seem to separate the requests and prevent internal looping? Again, I'm just assuming how Traefik works here. But, this is essentially how NGINX and Apache would handle it, two separate directives. Maybe this could help? |
@asifbacchus Yeah idk really but I imagine it wouldn't be that hard to have a section in the Mailcow UI where you can define URL's and then have the backend rewrite the configs for nginx but I've really no clue exactly how hard it would be. Yeah I'm set on the reverse proxy for the time being, just haven't had the time recently to research enough and I have very limited experience with nginx and none setting up a reverse proxy so I might just take you up on that offer, thanks :) |
|
I have an idea on something (and forgive me if this may be too overly simplified, or not entirely secured enough)... As the main website is "http://mailcow" points to the admin page and NOT SOGo, why not do this: (1) Copy the %MAILCOW_DIR%/data/web/index.php to %MAILCOW_DIR%/data/web/admin.php Am I wrong for thinking this, or is there something more that I'd need to do? |
|
@infracritical you'd have to make sure all the links worked from all modules and would have to repeat this procedure after every update. Something like a reverse proxy or server-side rewrite is more reliable and resilient, IMO. |
|
Actually, I already figured it out. https://mailcow.domain -> https://mailcow.domain/SOGo/so/ https://mailcow.domain/alt.php -> https://mailcow.domain/admin/ This simple workaround works for me. P.S. I also have https://webmail.mailcow.domain -> https://mailcow.domain/SOGo/so/ NOTE: Within the "/opt/mailcow-containerized/data/web/index.php" file, replace the contents with If I do "https://mailcow.domain/alt.php", I get the usual login screen; once logged in, it goes to "https://mailcow.domain/admin/", which is really "https://mailcow.domain/admin.php". |
|
@infracritical I think some of your post got eaten by github somehow? Otherwise, maybe posting what you actually did might help others viewing this in the future - just a suggestion. I do see that you mention replacing the contents of the index.php file -- again, I think you should know that will likely not survive an update so make sure you document your work so you can re-create it! Nice work getting things solved for your situation though :-) |
|
Alright...here's one possible solution that I've implemented for me, and it works quite simply like this: (1) Login to your server, and become 'root' (or whatever is the server administrator). NOTE: The domain name, '
(5) Please note that your 'admin' login is still there; it's just that you now need to access it as: For my needs, this more than satisfies my requires of keeping the administrative properties separated from the webmail software, SOGo. Thought I'd comment here, and see if this helps anyone. Cheers! |
|
In Addition to @infracritical update, you can rename the below-listed files for betterment access from the web.
Note: Don't do this exercise without @infracritical his procedure. else you may end up with some issues due to overwriting of admin.php. Thanks |
This comment has been minimized.
This comment has been minimized.
|
This is neither a ticket (this is not a ticket system!) nor is it "due". The UI is for users and admins. The UI is a jumping point from / to your user settings, the admin settings, domain admin settings and, well, the webmailer. It is a portal. A portal should be available at /. If you want to redirect / to /SOGo: do it. There is nothing in this mooniverse holding you back from doing that. :) You can even create a site "webmail.domain.tld" and redirect it to SOGo. It is part of the docs. Should be the easiest solution. I do understand that the opinions are rather split about this topic. I stick to my decision. :) |
This comment has been minimized.
This comment has been minimized.
|
I think he was referring to this in the docs: |
This comment has been minimized.
This comment has been minimized.
|
I have settled for redirecting /webmail to /SOGo (perhaps the worst directory name to try to remember). I just did this by creating I have to admit that every user on my server has been confused by the default login screen being for administration settings only. It is demonstrably bad UX, but I understand the technical limitations. Also, most "regular" users simply don't care to mess with their configuration settings. Thanks for the subdomain info. I'll check that out as well. |
This comment has been minimized.
This comment has been minimized.
|
The portal stays at /. :) Sorry, if you don't like this answer. Don't just give your users an URL. Tell them it is a portal with useful user configuration options AND a jumping point to mail or other apps. Show them, what they can configure. We will not hide this portal (!) by default. |
As title states, swap SOGo and Admin panel around.
That way you can get:
mail. => SOGo webmail
mail./admin => mailcow admin panel
Would be convenient to but the admin panel behind basic auth
The text was updated successfully, but these errors were encountered: