override exim.pl.local , globally declare $sender_address_domain variable

z3d3m0n

Well-Known Member
Feb 8, 2016
52
3
58
Prague
cPanel Access Level
Root Administrator
Hello,

when I am trying to override the settings of the /etc/exim.pl.local

Code:
sub check_mail_permissions_headers {
    return "X-Get-Message-Sender-Via: " . ( $primary_hostname ||= Exim::expand_string('$primary_hostname') ) . ": " . get_sender_lookup_method() . "\n" . "X-Authenticated-Sender: " . ( $primary_hostname ||= Exim::expand_string('$primary_hostname') ) . ": " . get_sender_lookup();
}
with

Code:
   sub check_mail_permissions_headers {
       return "X-Get-Message-Sender-Via: " . ( $sender_address_domain ||= Exim::expand_string('$sender_address_domain') ) . ": " . get_sender_lookup_method() . "\n" . "X-Authenticated-Sender: " . ( $sender_address_domain ||= Exim::expand_string('$sender_address_domain') ) . ": " . get_sender_lookup();
   }
by placing the code in the

/usr/local/cpanel/etc/exim/perl/zzz_custom_overwrites

and running a rebuild

/scripts/buildeximconf


I am getting an error that $sender_address_domain is not globally declared - how to globally declare it? i thought it was..

Code:
Configuration file passes test!  New configuration file was installed.

warn [buildeximconf] Warning: perlpkg could not create an optimize /etc/exim.pl.local: The subprocess reported error number 1 when it ended.: /usr/local/cpanel/3rdparty/bin/perl -c /usr/local/cpanel/tmp/exim.local.build.pl.static fails compile check:

Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?) at /usr/local/cpanel/tmp/exim.local.build.pl.static line 2009.
Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?) at /usr/local/cpanel/tmp/exim.local.build.pl.static line 2009.
BEGIN not safe after errors--compilation aborted at /usr/local/cpanel/tmp/exim.local.build.pl.static line 2052.


Warning: Failed to build a /etc/exim.pl.local does not pass use strict: The subprocess reported error number 255 when it ended.: Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?) at /usr/local/cpanel/tmp/exim.local.build.pl line 2009.
Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?) at /usr/local/cpanel/tmp/exim.local.build.pl line 2009.
/usr/local/cpanel/tmp/exim.local.build.pl had compilation errors.

Warning: perlpkg could not create an optimize /etc/exim.pl.local: The subprocess reported error number 1 when it ended.: /usr/local/cpanel/3rdparty/bin/perl -c /usr/local/cpanel/tmp/exim.local.build.pl.static fails compile check:

Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?) at /usr/local/cpanel/tmp/exim.local.build.pl.static line 2009.
Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?) at /usr/local/cpanel/tmp/exim.local.build.pl.static line 2009.
BEGIN not safe after errors--compilation aborted at /usr/local/cpanel/tmp/exim.local.build.pl.static line 2052.


/etc/exim.pl.local installed!
Refreshing SMTP Mail protection.

any advices are welcome,
thx in advance
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
Hey there! This level of customization to Exim isn't typically something we support. I'm wondering if your line 2052 is the "use strict;" entry for Perl itself, and that is where the issue is happening, as this seems more of a Perl error than an Exim. Can you let me know what is on line 2052?
 
  • Like
Reactions: z3d3m0n

z3d3m0n

Well-Known Member
Feb 8, 2016
52
3
58
Prague
cPanel Access Level
Root Administrator
Hello cPRex ,

at this point, I got stuck with declaring "$sender_address_domain"

the cPanel support team was super helpful as always

but i ended up with

"
Based on my limited knowledge of perl, this line:
Global symbol "$sender_address_domain" requires explicit package name (did you forget to declare "my $sender_address_domain"?)
seems to be referring to a variable declaration. I was able to identify the file that contains the variable declarations for exim's perl scripts is located at the path /usr/local/cpanel/etc/exim/perl/0_mail_permissions_variables, however I was not able to see where they get their values from. Simply adding the variable to the file may not be enough to have it function the way that you expect.
"
and

"At this time, creating custom exim configurations is unfortunately not something we are prepared to directly support. Creating and editing those scripts outside of WHM's editing tools is best left to an experienced system administrator with knowledge of exim."

i have tried to get some Exim / Perl administrators but all of them run away as soon as they found out that's its running on cPanel
i truly hope i will find a solution