Bugzilla error: Can't locate object method quit via package "Net::SMTP::SSL" line 365
3
votes
2
answers
1221
views
I installed Bugzilla on my CentOS 7 web server VPS. The install went smoothly, however when I went to set up email, I received the following error:
> Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
>
> For help, please send mail to the webmaster (********), giving this error message and the time and date of the error.
I set the email configuration to connect to Office 365, which means:
SMTP Server: smtp.office365.com:587
smtp_ssl: on
Username/password/mailfrom: that of the email address that I am using.
I viewed the source file, Config/Common.pm, in question:
344
345 sub check_smtp_server {
346 my $host = shift;
347 my $port;
348
349 if ($host =~ /:/) {
350 ($host, $port) = split(/:/, $host, 2);
351 unless ($port && detaint_natural($port)) {
352 return "Invalid port. It must be an integer (typically 25, 465 or 587)";
353 }
354 }
355 trick_taint($host);
356 # Let's first try to connect using SSL. If this fails, we fall back to
357 # an unencrypted connection.
358 foreach my $method (['Net::SMTP::SSL', 465], ['Net::SMTP', 25]) {
359 my ($class, $default_port) = @$method;
360 next if $class eq 'Net::SMTP::SSL' && !Bugzilla->feature('smtp_ssl');
361 eval "require $class";
362 my $smtp = $class->new($host, Port => $port || $default_port, Timeout => 5);
363 if ($smtp) {
364 # The connection works!
365 $smtp->quit;
366 return '';
367 }
368 }
369 return "Cannot connect to $host" . ($port ? " using port $port" : "");
370 }
371
What I deduced is that the connection information was a success and that Bugzilla was merely trying to quit the connection and return, no errors.
I found this article on the internet regarding this problem.
Mr. Thorsten Schoning said:
> Then debug further: Check the version of your installed
Net::SMTP::SSL, have a look at the source if a "quit" method is
available etc. There should be a file Net/SMTP/SSL.pm somewhere in your
perl installation or wherever and however you install packages. If
you have used install-module.pl, empty the bugzilla/lib folder and
install missing packages again using your package manager.
>
> Additionally look at the mentioned line of the Bugzilla code to see
what Bugzilla thinks: It thinks you have Net::SMTP::SSL available,
expects an available method and that seems to be missing. You need to
find the reason why because from my understanding it should be
available.
Well, I did a
locate
for SSL.pm
and came up with:
[root@tkts-wtsc /]# locate SSL.pm
/usr/lib64/perl5/vendor_perl/Net/SSL.pm
/usr/share/perl5/vendor_perl/HTTP/Daemon/SSL.pm
/usr/share/perl5/vendor_perl/IO/Socket/SSL.pm
/usr/share/perl5/vendor_perl/Net/MQTT/Simple/SSL.pm
/usr/share/perl5/vendor_perl/Net/SMTP/SSL.pm
/usr/share/perl5/vendor_perl/Net/Server/Proto/SSL.pm
/usr/share/perl5/vendor_perl/Software/License/OpenSSL.pm
I viewed the contents of Net/SMTP/SSL.pm
, but that did not contain any subroutines. I then viewed the contents of /Net/SSL.pm
and saw subroutines/methods, but none of them quit
, but then quit
is an SMTP
command, so I am not surprised there. Not sure if Mr. Schoning's response means anything or not, but even HIS linked SSL.pm
source does not contain a quit
method.
I did a sudo yum install mod_ssl openssl
as mentioned somewhere else and I get already installed and latest version, nothing to do
.
I did a sudo yum install perl-Net-SMTP-SSL
and got Package perl-Net-SMTP-SSL-1.01-13.el7.noarch already installed and latest version
. I installed all packages and updated everything.
This question is a server setup issue, not a programming one, hence my placement of this question here and not on SO. I merely mention the source files, as the error mentioned it and I wanted to be complete and give all the details.
I set the permissions for key folders:
drwxr-x--- 2 jmr-admin psacln 4096 Oct 17 08:33 Config
-rwxr-x--- 1 jmr-admin psacln 13547 Oct 16 16:55 Config.pm
and all items in the Config
folder are the same as:
-rwxr-x--- 1 jmr-admin psacln 16836 Oct 16 16:55 Common.pm
Now that I am writing this question, I do not think the issue is permissions, as perl
found the SMTP
module, not to mention SSL
module, successfully did a test and was attempting to quit
the connection, when perl could not find the quit
method.
I DID turn On
the smtp_debug
option, but I got no additional details.
I found this reference, lot of good information, such as to include the port in the SMTP server field, which I originally forgot to do. Sadly, this reference did not resolve my problem. For what it is worth, I also tried my gmail account, as this article references Gmail. In that way, I could enter the information EXACTLY as on this page. I copied and pasted the information. I got the same error, immediately with no delay. That was a bit weird, as I would have expected a slight delay from either Gmail or Office 365, but whatever.
**UPDATE**
I am still looking and ran into this article. The result of sesstatus -b
is SELinux status: disabled
. That is possibly another problem, but not relating to my inability to send emails. If anything, it is a good thing for troubleshooting. Anyways, I discovered that there is such a thing as /var/log/httpd/error_log
. The contents of this file are (keeps repeating for every attempt):
[Thu Oct 17 09:17:22 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:17:22 2019] editparams.cgi: at Bugzilla/Config/Common.pm line 362.
[Thu Oct 17 09:17:22 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
[Thu Oct 17 09:23:07 2019] editparams.cgi: Odd number of elements in hash assignment at /usr/share/perl5/vendor_perl/IO/Socket/IP.pm line 336.
[Thu Oct 17 09:23:07 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:23:07 2019] editparams.cgi: Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
[Thu Oct 17 09:23:07 2019] editparams.cgi: is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
[Thu Oct 17 09:23:07 2019] editparams.cgi: possibly with SSL_ca_file|SSL_ca_path for verification.
[Thu Oct 17 09:23:07 2019] editparams.cgi: If you really don't want to verify the certificate and keep the
[Thu Oct 17 09:23:07 2019] editparams.cgi: connection open to Man-In-The-Middle attacks please set
[Thu Oct 17 09:23:07 2019] editparams.cgi: SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
[Thu Oct 17 09:23:07 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:23:07 2019] editparams.cgi: at Bugzilla/Config/Common.pm line 362.
[Thu Oct 17 09:23:07 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
~
This log shows that I have another side task to fix a deprecated CentOS
setting and limit a Main-In-The-Middle
attack, but that does not appear to be germane to my quit method nonexistence issue. I have to research that a bit more.
The real error is line 362. That should have probably returned null / false to indicate an error. I bet that had line 362 really succeeded, then the quit
method would exist. Sadly, I this environment is not under Visual Studio, where I can set a breakpoint and view contents. I am in server admin mode, so...
my $smtp = $class->new($host, Port => $port || $default_port, Timeout => 5);
Okay, I found this article, which helped me solve the SSL_VERIFY_NONE
warnings. I opened up /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm
did a vi
command, :set number
, and then issue the command, /DEFAULT_SSL_ARGS
, which took me to line 35. I then changed on line 49 from SSL_verify_mode => SSL_VERIFY_NONE,
to SSL_verify_mode => SSL_VERIFY_PEER,
. I then saved my changes and quit. I tried my email settings again and much better.
[root@tkts-wtsc Config]# vi /var/log/httpd/error_log
[root@tkts-wtsc Config]#
[Thu Oct 17 09:23:07 2019] editparams.cgi: possibly with SSL_ca_file|SSL_ca_path for verification.
[Thu Oct 17 09:23:07 2019] editparams.cgi: If you really don't want to verify the certificate and keep the
[Thu Oct 17 09:23:07 2019] editparams.cgi: connection open to Man-In-The-Middle attacks please set
[Thu Oct 17 09:23:07 2019] editparams.cgi: SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
[Thu Oct 17 09:23:07 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:23:07 2019] editparams.cgi: at Bugzilla/Config/Common.pm line 362.
[Thu Oct 17 09:23:07 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
[Thu Oct 17 11:19:04 2019] editparams.cgi: Odd number of elements in hash assignment at /usr/share/perl5/vendor_perl/IO/Socket/IP.pm line 336.
[Thu Oct 17 11:19:04 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
~
I am down to only 2 lines. What is interesting is that i do not get the complaint anymore about line 362. Hmm.
If anyone is curious, here is the code to IP.pm
at line 336:
[root@tkts-wtsc Config]# vi /usr/share/perl5/vendor_perl/IO/Socket/IP.pm
[root@tkts-wtsc Config]#
325
326 As a special case, if the constructor is passed a single argument (as
327 opposed to an even-sized list of key/value pairs), it is taken to be the value
328 of the C parameter. This is parsed in the same way, according to the
329 behaviour given in the C AND C PARSING section below.
330
331 =cut
332
333 sub new
334 {
335 my $class = shift;
336 my %arg = (@_ == 1) ? (PeerHost => $_) : @_;
337 return $class->SUPER::new(%arg);
338 }
339
(Sorry about the long question, more like me keeping notes, but I am hoping that others might benefit from all this information and the methodology that I used. There is virtually nothing out there, and if I ran into this bug, others will too.)
Anyways, so how do I fix the problem?
Asked by Sarah Weinberger
(692 rep)
Oct 17, 2019, 03:41 PM
Last activity: Oct 25, 2019, 03:29 PM
Last activity: Oct 25, 2019, 03:29 PM