Disable admin panel and webmail

Hello. I want to disable admin panel: (box.mydomain.com/admin) and webmail: (box.mydomain.com/mail/) for security reasons since I just need use email services trough IMAP and SMTP. I have tried block port 80 and 443 with ufw and I can disable the admin panel and webmail but now I can’t receive emails. I can send emails but can’t receive. When I reset the ufw the problem is solved and I can receive emails so I think that the problem is related to block the port 80 and 443 but I can’t understand why since I have all others ports needed allowed and I can send emails correctly. I have been looking for information in this forum and github but I can’t find an answer that can help me to solve this problem so Im asking for help in this post.

How I can block the admin panel and webmail service in my mailinabox server? As I said I just want use IMAP and SMTP and I don’t want expose my webmail and admin panel publicy on internet for anyone.

Thanks in advance for the help.

Regards.

Because this is a unsupported modification, you may face issues when upgrading. I also didn’t test the modification so it may break:

Get into a root shell:

sudo -i

Rename the configuration file exposing /mail and /admin to something else, and create an empty file in it’s place

mv mailinabox/conf/nginx-primaryonly.conf mailinabox/conf/nginx-primaryonly-old.conf
touch mailinabox/conf/nginx-primaryonly.conf
mailinabox # Rerun the setup

If something breaks, you can easily revert the changes by using git:

# If not as root: sudo -i
cd mailinabox
git stash
mailinabox

Hello. Following your steps the admin panel is not found showing a 404 error so that is good but the box.mydomain.com/mail/ is still accessible. Also I tried send an email from other email provider to my inbox and I can’t get the message so something breaks by that way.

I just revert the changes by using git and now my server is working properly again but I still cant block the admin panel and webmail.

I can block the webmail modifying the next file:

/usr/local/lib/roundcubemail/index.php

But I can’t find the path to modify the admin panel and although I want “block instead hide” the web services would be nice too hide the admin panel until I understand how to block the web services.

Some idea on where is the path to modify the admin panel?

I was looking for github about this issue and found this post:

The author is saying that he is dealing with it by creating scripts to block web access all together via:

ufw deny proto tcp from any to any port 80,443

But when I add that rule to ufw my cpanel and webmail keep showing up. After reading that post I tried block port 80 and 443 (tcp and udp) and then all web services was blocked properly but then I get the problem of communication with the mail server and although I can send messages properly I can’t receive messages in my inbox.

I think that the solution should be easy but I can’t figure how to do it and I was looking for this problem in this forum and github issues.

This topic was automatically closed 40 days after the last reply. New replies are no longer allowed.