Discussion:
variable expansion not working in $myauthservid definition?
(too old to reply)
j***@mail-central.com
2016-04-07 15:26:09 UTC
Permalink
In amavisd.conf, if I set

$mydomain = 'mail01.example.com';
$myauthservid = 'amavisd.${$mydomain}';

received & scanned email's headers includes

Authentication-Results: amavisd.${$mydomain} (amavisd-new);
dkim=pass (2048-bit key) header.d=gmail.com

What's the correct usage so that $mydomain gets correctly expanded/used?

Usage of ${$mydomain} elsewhere in the config seems to work. I'm missing something :-/
A. Schulze
2016-04-07 18:10:49 UTC
Permalink
Post by j***@mail-central.com
$mydomain = 'mail01.example.com';
$myauthservid = 'amavisd.${$mydomain}';
use double quotes to allow variable expansion.
single quotes force use as literal string as you see...

-> $myauthservid = "amavisd.${$mydomain}";

Andreas
j***@mail-central.com
2016-04-07 18:37:38 UTC
Permalink
Post by A. Schulze
Post by j***@mail-central.com
$mydomain = 'mail01.example.com';
$myauthservid = 'amavisd.${$mydomain}';
use double quotes to allow variable expansion.
single quotes force use as literal string as you see...
-> $myauthservid = "amavisd.${$mydomain}";
If I switch

my $mydomain = 'mail01.example.com';
$myhostname = 'mail01.example.com';
75 - $myauthservid = 'amavisd.${$mydomain}';
+ my $myauthservid = "amavisd.${$mydomain}";

I get an error on launch

Error in config file "/etc/amavisd/amavisd.conf": Can't use string ("mail01.example.com") as a SCALAR ref while "strict refs" in use at /etc/amavisd/amavisd.conf line 75.

At the top of the config file I see

use strict;

Do I get rid of the 'use strict', or change something in the config variable ?

And as for single- vs double- quote, what should these be then

$smtpd_greeting_banner = '${$myhostname} ${protocol} ${product} service ready';
$smtpd_quit_banner = '${$myhostname} ${product} closing transmission channel';

?

Jason

Loading...