diff --git a/en_US/howto/restrict.mail.user.to.login.from.specified.ip.or.networks.md b/en_US/howto/restrict.mail.user.to.login.from.specified.ip.or.networks.md index 35896249..96bc9212 100644 --- a/en_US/howto/restrict.mail.user.to.login.from.specified.ip.or.networks.md +++ b/en_US/howto/restrict.mail.user.to.login.from.specified.ip.or.networks.md @@ -1,5 +1,7 @@ # Restrict mail user to login from specified IP addresses or networks +[TOC] + Since iRedMail-0.9.1, it's able to restrict mail users to login from specified IP addresses or networks. @@ -10,7 +12,19 @@ was given. Below sample usage shows how to restrict mail user `user@domaim.com` to login from only IP address `172.16.244.1` or network `192.168.1.0/24`. -## SQL backends +!!! warning + + If webmail is running on same server, and you want to allow user to login + from webmail, please allow IP `127.0.0.1` too. + +## Manage with iRedAdmin-Pro + +With iRedAdmin-Pro, please go to user profile page, click tab `Advanced`, +you will find setting `Restrict to login from specified addresses` like below: + +![](./images/iredadmin/user_profile_advanced.png){: width=1000px } + +## Manage with SQL command line for SQL backends ``` sql> USE vmail; @@ -21,7 +35,7 @@ To remove this restriction (allow to login from anywhere), just set value of SQL column `mailbox.allow_nets` to NULL. WARNING: It must be NULL, not empty string. -## OpenLDAP backend +## Manage with SQL command line for LDAP backends To allow user `user@domain.com` to login from IP `172.16.244.1` and network `192.168.1.0/24`, please add new attribute `allowNets` to this user: diff --git a/en_US/upgrade/0-upgrade.iredmail.0.9.8-0.9.9.md b/en_US/upgrade/0-upgrade.iredmail.0.9.8-0.9.9.md index 40e9a34e..766361c9 100644 --- a/en_US/upgrade/0-upgrade.iredmail.0.9.8-0.9.9.md +++ b/en_US/upgrade/0-upgrade.iredmail.0.9.8-0.9.9.md @@ -209,7 +209,7 @@ Add a new `CONCAT` line after above `CONCAT()` line: user_query = SELECT \ ... CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \ - CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \ + CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir, '/Maildir') AS mail, \ ... ``` @@ -266,7 +266,7 @@ Please Add a line after above line: ``` user_query = SELECT \ mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \ - mailbox.mailboxformat || ':' || mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS mail, \ + mailbox.mailboxformat || ':' || mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir || '/Maildir/' AS mail, \ ... ``` @@ -290,7 +290,7 @@ Add a new `CONCAT` line after above `CONCAT()` line: user_query = SELECT \ ... CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \ - CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \ + CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir, '/Maildir/') AS mail, \ ... ``` diff --git a/html/images/iredadmin/user_profile_advanced.png b/html/images/iredadmin/user_profile_advanced.png index 97cb2d52..6284a5d5 100644 Binary files a/html/images/iredadmin/user_profile_advanced.png and b/html/images/iredadmin/user_profile_advanced.png differ diff --git a/html/restrict.mail.user.to.login.from.specified.ip.or.networks.html b/html/restrict.mail.user.to.login.from.specified.ip.or.networks.html index 6077ed44..359f924d 100644 --- a/html/restrict.mail.user.to.login.from.specified.ip.or.networks.html +++ b/html/restrict.mail.user.to.login.from.specified.ip.or.networks.html @@ -16,6 +16,17 @@ iRedMail   //  Document Index

Restrict mail user to login from specified IP addresses or networks

+
+ +

Since iRedMail-0.9.1, it's able to restrict mail users to login from specified IP addresses or networks.

Allowed IP/networks must be separated by comma. If the user tries to log in @@ -23,7 +34,16 @@ elsewhere, the authentication will fail the same way as if a wrong password was given.

Below sample usage shows how to restrict mail user user@domaim.com to login from only IP address 172.16.244.1 or network 192.168.1.0/24.

-

SQL backends

+
+

Warning

+

If webmail is running on same server, and you want to allow user to login +from webmail, please allow IP 127.0.0.1 too.

+
+

Manage with iRedAdmin-Pro

+

With iRedAdmin-Pro, please go to user profile page, click tab Advanced, +you will find setting Restrict to login from specified addresses like below:

+

+

Manage with SQL command line for SQL backends

sql> USE vmail;
 sql> UPDATE mailbox SET allow_nets='172.16.244.1,192.168.1.0/24' WHERE username='user@domain.com';
 
@@ -31,7 +51,7 @@ sql> UPDATE mailbox SET allow_nets='172.16.244.1,192.168.1.0/24' WHERE userna

To remove this restriction (allow to login from anywhere), just set value of SQL column mailbox.allow_nets to NULL. WARNING: It must be NULL, not empty string.

-

OpenLDAP backend

+

Manage with SQL command line for LDAP backends

To allow user user@domain.com to login from IP 172.16.244.1 and network 192.168.1.0/24, please add new attribute allowNets to this user:

allowNets: 192.168.1.10,192.168.1.0/24
diff --git a/html/upgrade.iredmail.0.9.8-0.9.9.html b/html/upgrade.iredmail.0.9.8-0.9.9.html
index 00bb96e5..cb7289c0 100644
--- a/html/upgrade.iredmail.0.9.8-0.9.9.html
+++ b/html/upgrade.iredmail.0.9.8-0.9.9.html
@@ -229,7 +229,7 @@ line like below:

user_query = SELECT \
             ...
             CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
-            CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \
+            CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir, '/Maildir') AS mail, \
             ...
 
@@ -275,7 +275,7 @@ below:

Please Add a line after above line:

user_query = SELECT \
     mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \
-    mailbox.mailboxformat || ':' || mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS mail, \
+    mailbox.mailboxformat || ':' || mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir || '/Maildir/' AS mail, \
     ...
 
@@ -293,7 +293,7 @@ below:

user_query = SELECT \
             ...
             CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
-            CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \
+            CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir, '/Maildir/') AS mail, \
             ...