1 (edited by Spymac 2020-04-02 02:25:30)

Topic: Problem with adminer.tmpl

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): v1.1
- Deployed with iRedMail Easy or the downloadable installer?  downloadable installer
- Linux/BSD distribution name and version: Debian 10.3
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello Zhang,

I am trying to access Adminer only from the allowed IP address. I am not doing well, it seems that the rule does not work.

The default template has a path to /opt/www/adminer/, but it does not work. I get this error message:

2020/04/01 15:55:58 [error] 19923#19923: *1 open() "/var/www/html/adminer" failed (2: No such file or directory), client: MY_PUBLIC_IP, server: _, request: "GET /adminer HTTP/1.1", host: "mail.example.com"

If I copy latest.php to /var/www/html/adminer/ and change path in template to /var/www/html/adminer, then adminer works, but access does not work according to allowed IP addresses in /etc/nginx/templates/adminer.tmpl

adminer.tmpl :

# Sample setting for Adminer: http://adminer.org/

# -----------------------------------------
# How to get it working:
#
#   mkdir /opt/www/adminer
#   cd /opt/www/adminer
#   wget http://www.adminer.org/latest.php
#   chmod +x latest.php
#
# Warning: for security concern, it's recommended to change the URL '/adminer'
#          to another random string to avoid login attempts from bad guys.
#          for example, change the url to '^/HIoWCwogSHukIbGL'.
#
# -----------------------------------------
# If you cannot login to MySQL server as root user:
#
# New MySQL or MariaDB support plugin authentication, by default, the root
# account has setting `user.plugin=unix_socket` (in `mysql` database). The
# `auth_socket` authentication plugin authenticates clients that connect from
# the local host through the Unix socket file, this prevents access via network
# connection, including Adminer. To make it working, please disable this
# authentication plugin with sql commands below:
#
#   sql> USE mysql;
#   sql> UPDATE user SET plugin='' WHERE User='root';
#
# Refer to MySQL document for more details:
# https://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html

location ~ ^/adminer$ {
    include /etc/nginx/templates/hsts.tmpl;
    include /etc/nginx/templates/fastcgi_php.tmpl;

    fastcgi_param SCRIPT_FILENAME /opt/www/adminer/latest.php;

    # Access control
    #allow 127.0.0.1;
allow 192.168.1.10;  #example IP
    #allow 192.168.1.0/24;
    #deny all;
}

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Problem with adminer.tmpl

Did you enable this adminer.tmpl in your web host config file? e.g. /etc/nginx/sites-enabled/00-default-ssl.conf.

3

Re: Problem with adminer.tmpl

ZhangHuangbin wrote:

Did you enable this adminer.tmpl in your web host config file? e.g. /etc/nginx/sites-enabled/00-default-ssl.conf.

It works, Thank You !

Perhaps it would be a good idea to add this information to adminer.tmpl.

4

Re: Problem with adminer.tmpl

All files under /etc/nginx/templates/ are not loaded by Nginx BY DEFAULT, you have to load them in your web host config file with the 'include' directive manually. smile

5

Re: Problem with adminer.tmpl

ZhangHuangbin wrote:

All files under /etc/nginx/templates/ are not loaded by Nginx BY DEFAULT, you have to load them in your web host config file with the 'include' directive manually. smile

Thank you for your help, I bought you a coffee :-)

6

Re: Problem with adminer.tmpl

Spymac wrote:

I bought you a coffee :-)

Thank you. smile