Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Mail Server
  • Search

Error: mail alias foo exist

Questions regarding the Mail Server
Dovecot, Exim, RoundCube
Post Reply
  • Print view
Advanced search
10 posts • Page 1 of 1
hrabbit
Posts: 11
Joined: Thu Dec 12, 2013 11:01 pm

Error: mail alias foo exist
  • Quote

Post by hrabbit » Fri Dec 13, 2013 4:48 am

Hi everybody,

Just started using VestaCP and so far, loving it. However, ran across an issue when populating alias entries.

I can populate an account with entries like

Code: Select all

foo
bar
baz
Which works perfecly fine, however I can't do the following for some reason

Code: Select all

foo.bar
foo.baz
foo
The last entry causes a "Error: mail alias foo exist" error in the interface. I'm hoping this is reproduce-able by others and more importantly, if this is easy to correct or should I start hacking the domains.sh file to get around it?

Thanks in advance
Top

skid
VestaCP Team
Posts: 1476
Joined: Wed Apr 06, 2011 11:12 pm

Re: Error: mail alias foo exist
  • Quote

Post by skid » Fri Dec 13, 2013 10:23 am

I'll check it and get back to you soon.
Top

hrabbit
Posts: 11
Joined: Thu Dec 12, 2013 11:01 pm

Re: Error: mail alias foo exist
  • Quote

Post by hrabbit » Sat Dec 14, 2013 3:46 am

skid wrote:I'll check it and get back to you soon.
Thanks, looking forward to it.
Top

hrabbit
Posts: 11
Joined: Thu Dec 12, 2013 11:01 pm

Re: Error: mail alias foo exist
  • Quote

Post by hrabbit » Sat Dec 14, 2013 1:57 pm

Hi Skid,

Testing this further, it appears that "grep -w" seems to match words even with commas (Even though man states "Word-constituent characters are letters, digits, and the underscore.").

I have played a little and the best solution I can come up with is to perform the following. (Only tested on Debian Wheezy (7))

Code: Select all

# diff -Naur domain.sh.original domain.sh
--- domain.sh.original	2013-12-15 00:33:36.000000000 +1100
+++ domain.sh	2013-12-15 00:54:02.000000000 +1100
@@ -145,8 +145,8 @@
         log_event "$E_EXISTS" "$EVENT"
         exit $E_EXISTS
     fi
-    check_als=$(awk -F "ALIAS='" '{print $2}' $USER_DATA/mail/$domain.conf )
-    check_als=$(echo "$check_als" | cut -f 1 -d "'" | grep -w $1)
+    check_als=$(awk -F "ALIAS='" '{print $2}' $USER_DATA/mail/$domain.conf |\
+	      awk -F "'" '{print $1}' | tr "," "\n" | grep ^$1$ )
     if [ ! -z "$check_als" ]; then
         echo "Error: mail alias $1 exist"
         log_event "$E_EXISTS" "$EVENT"
Not sure on the overhead with very large lists (mine has 158 records) and I personally don't like chaining awk into awk but ya get that.

As a note, however, this does produce a correct result in my testing.
Top

skid
VestaCP Team
Posts: 1476
Joined: Wed Apr 06, 2011 11:12 pm

Re: Error: mail alias foo exist
  • Quote

Post by skid » Wed Dec 18, 2013 7:24 pm

Thanks for the research hrabbit. I've tried to reproduce the error on a fresh Debian 7.1 and it seem to be resolved with the new version of grep
grep (GNU grep) 2.12

Can you please check your current version and let me know if it's lower that 2.12.
Thank you
Top

hrabbit
Posts: 11
Joined: Thu Dec 12, 2013 11:01 pm

Re: Error: mail alias foo exist
  • Quote

Post by hrabbit » Wed Dec 18, 2013 9:49 pm

Hi Skid,

Just checked my system. (Reverted my changes first).

Performed the norm, update, dist-upgrade, etc. the problem is still present.

I'm running an OpenVZ (Proxmox) container for this and it's not referring to 7.1, just 7. However...

Code: Select all

# grep --version
grep (GNU grep) 2.12

Code: Select all

# cat /etc/issue.net 
Debian GNU/Linux 7
If it works properly in a standalone system but not in a container, not sure where that leaves this problem to be honest. Also, even changing to my code, there isn't anything to say it works in RH(and forks)
Top

skid
VestaCP Team
Posts: 1476
Joined: Wed Apr 06, 2011 11:12 pm

Re: Error: mail alias foo exist
  • Quote

Post by skid » Wed Dec 18, 2013 9:53 pm

It's weird. OpenVZ shouldn't affect the system. Can you still reproduce the error with latest grep?
Original domain function can be downloaded from githab
Top

hrabbit
Posts: 11
Joined: Thu Dec 12, 2013 11:01 pm

Re: Error: mail alias foo exist
  • Quote

Post by hrabbit » Wed Dec 18, 2013 10:36 pm

skid wrote:It's weird. OpenVZ shouldn't affect the system.
Absolutely!
skid wrote:Can you still reproduce the error with latest grep?
Original domain function can be downloaded from githab
That last test was with the original file in place. I just checked over the same function in github and it certainly matches my original copy that's currently in place.

Just as a point of interest however, even though I performed an upgrade first, the grep version was already 2.12.
Top

skid
VestaCP Team
Posts: 1476
Joined: Wed Apr 06, 2011 11:12 pm

Re: Error: mail alias foo exist
  • Quote

Post by skid » Thu Dec 19, 2013 7:07 am

I'm not entirely sure, does it work after upgrade?
Top

hrabbit
Posts: 11
Joined: Thu Dec 12, 2013 11:01 pm

Re: Error: mail alias foo exist
  • Quote

Post by hrabbit » Thu Dec 19, 2013 7:33 am

skid wrote:I'm not entirely sure, does it work after upgrade?
Nope, same scenario. Exact same error.

Using the default code, I have added the following aliases to an account.

foo.bar
foo.baz

Code: Select all

# dpkg -l grep
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  grep           2.12-2       amd64        GNU grep, egrep and fgrep
Then, running the following (default as extracted from domains.sh), I get the following

Code: Select all

# grep --version
grep (GNU grep) 2.12
...
# awk -F "ALIAS='" '{print $2}' /usr/local/vesta/data/users/scott/mail/comsetic.net.conf | cut -f 1 -d "'" | grep -w bar
bar.bar,bar.baz
#
As far as I know grep -w should have produced no result, however that returned both results.

This produced the correct result of course (slight variation on my original post).

Code: Select all

# awk -F "ALIAS='" '{print $2}' /usr/local/vesta/data/users/scott/mail/comsetic.net.conf | cut -f 1 -d "'" | tr "," "\n" |grep ^bar$
#
I have an urge to install a Ubuntu 12.04 instance just to see if it performs the same way to be honest. If that would be of interest, please let me know.
Top


Post Reply
  • Print view

10 posts • Page 1 of 1

Return to “Mail Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password