Koozali.org: home of the SME Server

create Custom Pseudonyms

Offline cno

  • *
  • 35
  • +0/-0
create Custom Pseudonyms
« on: February 18, 2022, 11:04:55 AM »
can not figure out if it's a bug or not.

updated from sme 9.2 to sme 10 with lat

server is in serveronly mode

is it me who has forgotten or misunderstood how pseudonyms work.

I have problems using pseudonyms

on old server 9.2 I could easily create pseudonyms

eg
I have the username kkj
imported with lat and works without problems
kk@domain1.com goes to kkj
kk@domain2.com goes to kkj
kk@doamin3.com goes to kkj

i can create new pseudonyms via server-manger
like something@doamin1.com to kkj

when I send mail to something@doamin1.com I get error "unknown recipient"

i have also tried with lat-pseudonyms without success

I have another server which is still running sme ver 9.2 where I have no problems
can create something@doamin1.com for a username and receive emails

I have searched both in the wiki and here in the forums for help without finding a solution
........................

Offline Jean-Philippe Pialasse

  • *
  • 2,747
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: create Custom Pseudonyms
« Reply #1 on: February 18, 2022, 02:52:04 PM »
i would start looking at /var/log/messages while you are adding a pseudonym.

as this is an old server migrated to SME 10, it is highly probable your issue is just following you and is discovered now.

check also the content of these folder for any file with an extension made of digits.  this points toward an expand-template failure due to an error. 


ll /var/qmail/control/
ll /var/service/qpsmtpd/config/


I highly suspect this bug  or similar.

 https://bugs.koozali.org/show_bug.cgi?id=8591

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #2 on: February 19, 2022, 10:23:50 AM »
yes it is similar to https://bugs.koozali.org/show_bug.cgi?id=8591

and https://forums.koozali.org/index.php/topic,54044.0/all.html

I can´t see any folder or files with digits in
ll /var/qmail/control/
ll /var/service/qpsmtpd/config/

I have no idea what to do

I forgot to write that old server (9.2) is disconnected and new server (10) is with new hardware and installed with ver 10
and users / hostnames / domains are transferred with "lat"
........................

Offline Jean-Philippe Pialasse

  • *
  • 2,747
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: create Custom Pseudonyms
« Reply #3 on: February 19, 2022, 01:51:24 PM »
have you check your /var/log/messages log while adding a pseudonym ?


you might see an error similar to

Aug 27 08:06:50 mailsrv esmith::event[58475]: ERROR in /etc/e-smith/templates//var/qmail/control/virtualdomains/90pseudonyms: Program fragment delivered error <<Can't call method "prop" on an undefined value at /etc/e-smith/templates//var/qmail/control/virtualdomains/90pseudonyms line 18.>> at template line 1


as reported in forum post.




a workaround would be

mkdir -p  /etc/e-smith/templates-custom//var/qmail/control/virtualdomains/
cp   /etc/e-smith/templates//var/qmail/control/virtualdomains/90pseudonyms /etc/e-smith/templates-custom//var/qmail/control/virtualdomains/


mcedit  /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90pseudonyms


on line 18, replace


        my $acct = $adb->get($account);
to


        my $acct = $adb->get($account) || get("admin");



then you will need to do a
signal-event email-update


edit: review the command to cp and create the custom-template
« Last Edit: February 19, 2022, 06:53:39 PM by Jean-Philippe Pialasse »

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #4 on: February 24, 2022, 02:53:04 PM »
I've been down with corona since Sunday, so I have not been able to do as you suggest until now

Code: [Select]
on line 18, replace

        my $acct = $adb->get($account);
to

        my $acct = $adb->get($account) || get("admin");

her is my output from my 90pseudonyms changed line 17

Code: [Select]
{
    my $dms = $DelegateMailServer;

    return "# DelegateMailServer is set" if ($dms && ($dms !~ /^\s*$/));

    $OUT = "";

    use esmith::AccountsDB;

    my $adb = esmith::AccountsDB->open_ro or die "Couldn't open AccountsDB";

    for my $pseudo ($adb->pseudonyms)
    {
next unless ($pseudo->key =~ /@/);

my $account = $pseudo->prop("Account");
my $acct = $adb->get($account) || get("admin");
if ($acct->prop('type') eq "group")
{
    $account =~ s/\./:/g;
}

$OUT .= $pseudo->key . ":$account\n";
    }
}


expand template I get this error
Code: [Select]
[root@nntmailserver ~]# expand-template /var/qmail/control/virtualdomains
ERROR in /etc/e-smith/templates-custom//var/qmail/control/virtualdomains/90pseudonyms: Program fragment delivered error <<Can't call method "prop" on an undefined value at /etc/e-smith/templates-custom//var/qmail/control/virtualdomains/90pseudonyms line 18.>> at template line 1
ERROR: Template processing failed for //var/qmail/control/virtualdomains: 1 fragment generated errors
 at /sbin/e-smith/expand-template line 45.
[root@nntmailserver ~]#

when create new Pseudonym  /var/log/messages log

Code: [Select]
Feb 24 14:07:30 nntmailserver /etc/e-smith/web/functions/pseudonyms[198343]: /home/e-smith/db/accounts: OLD testsme@domain.com=(undefined)
Feb 24 14:07:30 nntmailserver /etc/e-smith/web/functions/pseudonyms[198343]: /home/e-smith/db/accounts: NEW testsme@domain.com=pseudonym|Account|cno
Feb 24 14:07:31 nntmailserver esmith::event[198344]: Processing event: pseudonym-create testsme
Feb 24 14:07:31 nntmailserver esmith::event[198344]: Running event handler: /etc/e-smith/events/actions/generic_template_expand
Feb 24 14:07:31 nntmailserver esmith::event[198344]: expanding /var/qmail/control/badrcptto
Feb 24 14:07:31 nntmailserver esmith::event[198344]: expanding /var/qmail/control/virtualdomains
Feb 24 14:07:31 nntmailserver esmith::event[198344]: ERROR in /etc/e-smith/templates-custom//var/qmail/control/virtualdomains/90pseudonyms: Program fragment delivered error <<Undefined subroutine &esmith::__TEMPLATE__::2::get called at /etc/e-smith/templates-custom//var/qmail/control/virtualdomains/90pseudonyms line 17.>> at template line 1
Feb 24 14:07:31 nntmailserver esmith::event[198344]: ERROR: Template processing failed for //var/qmail/control/virtualdomains: 1 fragment generated errors
Feb 24 14:07:31 nntmailserver esmith::event[198344]:  at /etc/e-smith/events/actions/generic_template_expand line 56.
Feb 24 14:07:31 nntmailserver esmith::event[198344]: expanding /var/qmail/users/assign
Feb 24 14:07:31 nntmailserver esmith::event[198344]: expanding /var/service/qpsmtpd/config/badrcptto_ext
Feb 24 14:07:32 nntmailserver esmith::event[198344]: expanding /var/service/qpsmtpd/config/forcespamcheck
Feb 24 14:07:32 nntmailserver esmith::event[198344]: expanding /var/service/qpsmtpd/config/goodrcptto
Feb 24 14:07:32 nntmailserver esmith::event[198344]: generic_template_expand=action|Event|pseudonym-create|Action|generic_template_expand|Start|1645708051 227887|End|1645708052 119523|Elapsed|0.891636
Feb 24 14:07:32 nntmailserver esmith::event[198344]: Running event handler: /etc/e-smith/events/pseudonym-create/S55email-assign
Feb 24 14:07:32 nntmailserver esmith::event[198344]: S55email-assign=action|Event|pseudonym-create|Action|S55email-assign|Start|1645708052 119805|End|1645708052 145914|Elapsed|0.026109
Feb 24 14:07:32 nntmailserver esmith::event[198344]: Running event handler: /etc/e-smith/events/actions/adjust-services
Feb 24 14:07:32 nntmailserver esmith::event[198344]: adjusting non-supervised qmail (start)
Feb 24 14:07:32 nntmailserver esmith::event[198344]: adjusting non-supervised qmail (sighup)
Feb 24 14:07:32 nntmailserver esmith::event[198344]: adjust-services=action|Event|pseudonym-create|Action|adjust-services|Start|1645708052 146371|End|1645708052 603535|Elapsed|0.457164

I can create new Pseudonym in server-manager without problems but it don´t work
testsme@domain.com to cno or any other user or group

when sending mail to
I get "mailer-daemon return
<testsme@servername.domain.com>:
Recipient unknown"

if only create Pseudonym "testsme" to cno or any other user or group without @domain.com it works for all doamins

........................

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: create Custom Pseudonyms
« Reply #5 on: February 24, 2022, 03:32:57 PM »
I just followed JPs instructions and got no errors with the template expansion.

Look like your issue is with groups somehow

Code: [Select]
cat -n /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90pseudonyms |grep 18
    18      if ($acct->prop('type') eq "group")


Added a test domain via server-manager:

Code: [Select]
db domains show
testdomain.com=domain
    Content=Primary
    Description=Test
    Nameservers=localhost


Added a test pseudonym via server-manager linked to a group:

Code: [Select]
db accounts show testuser@testdomain.com
testuser@testdomain.com=pseudonym
    Account=newtestgroups

Code: [Select]
expand-template /var/qmail/control/virtualdomains
(or signal-event email-update)

Code: [Select]
cat /var/qmail/control/virtualdomains
#------------------------------------------------------------
#          !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
mycompany.local:alias-localdelivery
testdomain.com:alias-localdelivery

testuser@testdomain.com:newtestgroups

--------------------

So I suspect there is something else going on in your accounts DB.

Can you please show:

Code: [Select]
/sbin/e-smith/audittools/newrpms
/sbin/e-smith/audittools/templates

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,722
  • +5/-0
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #7 on: February 24, 2022, 03:47:30 PM »
Code: [Select]
/sbin/e-smith/audittools/newrpms
login as: root
root@nntmailserver's password:
Last login: Thu Feb 24 14:44:04 2022 from
************ Welcome to SME Server 10.0 *************

Before editing configuration files, familiarise
yourself with the automated events and templates
systems.

Please take the time to read the documentation
https://wiki.koozali.org/Main_Page

Remember that SME Server is free to download
and use, but it is not free to build

Please help the project :
https://wiki.koozali.org/Donate

****************************************************
[root@nntmailserver ~]# /sbin/e-smith/audittools/newrpms
Indlæste udvidelsesmoduler: fastestmirror, post-transaction-actions, priorities,
                          : smeserver
Loading mirror speeds from cached hostfile
 * base: mirror.netsite.dk
 * smeaddons: ibsgaarden.dk
 * smeos: ibsgaarden.dk
 * smeupdates: ibsgaarden.dk
 * updates: mirror.netsite.dk
Ekstra pakker
GeoIP.x86_64                            1.6.12-9.el7.sme            @smecontribs
GeoIP-GeoLite-data.noarch               2018.06-7.el7.sme           @smecontribs
GeoIP-GeoLite-data-extra.noarch         2018.06-7.el7.sme           @smecontribs
libicu69.x86_64                         69.1-2.el7.remi             @remi-safe
perl-Unicode-IMAPUtf7.noarch            2.01-1.of.el7               @smecontribs
php81-php.x86_64                        8.1.3-1.el7.remi            @remi-safe
php81-php-bcmath.x86_64                 8.1.3-1.el7.remi            @remi-safe
php81-php-cli.x86_64                    8.1.3-1.el7.remi            @remi-safe
php81-php-common.x86_64                 8.1.3-1.el7.remi            @remi-safe
php81-php-enchant.x86_64                8.1.3-1.el7.remi            @remi-safe
php81-php-fpm.x86_64                    8.1.3-1.el7.remi            @remi-safe
php81-php-gd.x86_64                     8.1.3-1.el7.remi            @remi-safe
php81-php-imap.x86_64                   8.1.3-1.el7.remi            @remi-safe
php81-php-intl.x86_64                   8.1.3-1.el7.remi            @remi-safe
php81-php-ldap.x86_64                   8.1.3-1.el7.remi            @remi-safe
php81-php-mbstring.x86_64               8.1.3-1.el7.remi            @remi-safe
php81-php-mysqlnd.x86_64                8.1.3-1.el7.remi            @remi-safe
php81-php-opcache.x86_64                8.1.3-1.el7.remi            @remi-safe
php81-php-pdo.x86_64                    8.1.3-1.el7.remi            @remi-safe
php81-php-pear.noarch                   1:1.10.13-1.el7.remi        @remi-safe
php81-php-pecl-xmlrpc.x86_64            1.0.0~rc3-1.el7.remi        @remi-safe
php81-php-pecl-zip.x86_64               1.20.0-1.el7.remi           @remi-safe
php81-php-process.x86_64                8.1.3-1.el7.remi            @remi-safe
php81-php-snmp.x86_64                   8.1.3-1.el7.remi            @remi-safe
php81-php-soap.x86_64                   8.1.3-1.el7.remi            @remi-safe
php81-php-sodium.x86_64                 8.1.3-1.el7.remi            @remi-safe
php81-php-tidy.x86_64                   8.1.3-1.el7.remi            @remi-safe
php81-php-xml.x86_64                    8.1.3-1.el7.remi            @remi-safe
php81-runtime.x86_64                    8.1-1.el7.remi              @remi-safe
smeserver-diskusage.noarch              0.2.0-5.el7.sme             @smecontribs
smeserver-hwinfo.noarch                 1.2-5.el7.sme               @smecontribs
smeserver-lazy_admin_tools.noarch       1.1-6.el7.sme               @smecontribs
smeserver-learn.noarch                  1.0-16.el7.sme              @smecontribs
smeserver-mailsorting.noarch            1.4-14.el7.sme              @smecontribs
smeserver-qmHandle.noarch               1.4-16.el7.sme              @smecontribs
smeserver-remoteuseraccess.noarch       1.3-6.el7.sme               @smecontribs
smeserver-userpanel.noarch              1.4-3.el7.sme               @smecontribs
smeserver-vacation.noarch               1.1-33.el7.sme              @smecontribs
smeserver-wbl.noarch                    0.5.0-5.el7.sme             @smecontribs
[root@nntmailserver ~]#

Code: [Select]
/sbin/e-smith/audittools/templates
[root@nntmailserver ~]# /sbin/e-smith/audittools/templates
/etc/e-smith/templates-custom/etc/rc.d/init.d/masq/40DenyRiffRaff: MANUALLY_ADDED, ADDITION
/etc/e-smith/templates-custom/var/qmail/control/queuelifetime: MANUALLY_ADDED, ADDITION
/etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90pseudonyms: MANUALLY_ADDED, OVERRIDE
[root@nntmailserver ~]#

........................

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: create Custom Pseudonyms
« Reply #8 on: February 24, 2022, 04:18:56 PM »
Please try the test I outlined in the other post - I am pretty sure you have a corrupted db entry somewhere.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #9 on: February 24, 2022, 04:25:34 PM »
added this lines

Code: [Select]
my $test = $pseudo->key;
print "Pseudo is $test \n";
print "Acct is $account \n";

[root@nntmailserver ~]# expand-template /var/qmail/control//virtualdomains
Pseudo is accounts@newnordic.net.au
Acct is accounts-aus
Pseudo is evamaria@newnordic.com
Acct is evawitzig
Pseudo is faktura@kunkeei.com
Acct is fak-kunkeei
Pseudo is faktura@newnordic.dk
Acct is nnbcfak
Pseudo is info@helsegrossisten.dk
Acct is grossist
Pseudo is info@helsehuset.com
Acct is info_helsehuset
Pseudo is info@kunkeei.com
Acct is info-kunkeei
Pseudo is info@newnordic.ch
Acct is tatiana
Pseudo is info@newnordic.cn
Acct is info-cn
Pseudo is info@newnordic.com
Acct is line.jensen
Pseudo is info@newnordic.cz
Acct is mail_til_info_cz
Pseudo is info@newnordic.dk
Acct is mail_til_info_dk
ERROR in /etc/e-smith/templates-custom//var/qmail/control//virtualdomains/90pseudonyms: Program fragment delivered error <<Undefined subroutine &esmith::__TEMPLATE__::1::get called at /etc/e-smith/templates-custom//var/qmail/control//virtualdomains/90pseudonyms line 17.>> at template line 1
ERROR: Template processing failed for //var/qmail/control//virtualdomains: 1 fragment generated errors
 at /sbin/e-smith/expand-template line 45.
[root@nntmailserver ~]#

........................

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: create Custom Pseudonyms
« Reply #10 on: February 24, 2022, 04:43:46 PM »
So check the last entry or the next one. I forget!

You can add some extra 'print' lines there so you can see for yourself.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #11 on: February 25, 2022, 05:08:13 PM »
i'm not sure what you mean but

created group "newtestgroups"
send mail to newtestgroups@domain.com is ok

create pseudonym testuser@doamin.com group newtestgroups
send mail to testuser@doamin.com
I get "mailer-daemon return
<testsme@servername.domain.com>:
Recipient unknown "

Code: [Select]
[root@nntmailserver ~]# db domains show

testdomain.com=domain
    Content=Primary
    Description=test
    Nameservers=localhost
[root@nntmailserver ~]# db accounts show testuser@testdomain.com
testuser@testdomain.com=pseudonym
    Account=newtestgroups
[root@nntmailserver ~]#
........................

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: create Custom Pseudonyms
« Reply #12 on: February 25, 2022, 07:13:17 PM »
You can see that the issue is around here - that is where the expansion fails (it should work if all accounts & pseudonyms are OK)

Quote
Acct is mail_til_info_dk

You need to check that account, groups, and pseudonyms.

Code: [Select]
db accounts show mail_til_info_dk
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #13 on: February 25, 2022, 08:57:10 PM »
Code: [Select]
[root@nntmailserver ~]# db accounts show mail_til_info_dk
mail_til_info_dk=group
    Description=mail_til_info_dk
    Gid=5075
    Members=info-dk
    Uid=5075
[root@nntmailserver ~]#

I can´t see any error
........................

Offline Jean-Philippe Pialasse

  • *
  • 2,747
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: create Custom Pseudonyms
« Reply #14 on: February 26, 2022, 12:22:12 AM »
you have an old pseudonym linked to an account that has been deleted.  the template fails when it hits this pseudonym and does not update the rest of the list leaving you with all new added entries unknown to the mail server.

what John tries is to help you finding the bad pseudonyms you need to manually remove. 

Offline cno

  • *
  • 35
  • +0/-0
Re: create Custom Pseudonyms
« Reply #15 on: March 21, 2022, 11:43:27 AM »
finally I found the issue

it was like you wrote issue with a user
 info-es pointed to info-dk which I could not spot

everything is running as it should now
thank you both for your help
........................

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: create Custom Pseudonyms
« Reply #16 on: March 21, 2022, 11:47:54 AM »
finally I found the issue

it was like you wrote issue with a user
 info-es pointed to info-dk which I could not spot

everything is running as it should now
thank you both for your help

Yay !!

Well done and thanks for letting us know.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation