mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 07:27:04 +03:00
Remote host ssl verification
This commit is contained in:
parent
c26ab305a1
commit
d63dc10e5b
6 changed files with 94 additions and 54 deletions
|
|
@ -2777,26 +2777,14 @@ class Actions
|
|||
$oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this, 'domain-test-connection.de');
|
||||
if ($oDomain)
|
||||
{
|
||||
// $bOpenSSL = \MailSo\Base\Utils::FunctionExistsAndEnabled('openssl_x509_parse');
|
||||
$bOpenSSL = false; // TODO in dev
|
||||
|
||||
try
|
||||
{
|
||||
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->SetLogger($this->Logger());
|
||||
$oImapClient->SetTimeOuts(5);
|
||||
|
||||
$iTime = \microtime(true);
|
||||
$oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(), $oDomain->IncSecure(), $bOpenSSL);
|
||||
|
||||
if ($bOpenSSL)
|
||||
{
|
||||
$aStreamContextParams = $oImapClient->StreamContextParams();
|
||||
if (isset($aStreamContextParams['options']['ssl']['peer_certificate']))
|
||||
{
|
||||
$aParseData = @\openssl_x509_parse($aStreamContextParams['options']['ssl']['peer_certificate']);
|
||||
$this->Logger()->WriteDump($aParseData);
|
||||
}
|
||||
}
|
||||
$oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(),
|
||||
$oDomain->IncSecure(), $oDomain->IncVerifySsl());
|
||||
|
||||
$iImapTime = \microtime(true) - $iTime;
|
||||
$oImapClient->Disconnect();
|
||||
|
|
@ -2823,17 +2811,8 @@ class Actions
|
|||
$oSmtpClient->SetTimeOuts(5);
|
||||
|
||||
$iTime = \microtime(true);
|
||||
$oSmtpClient->Connect($oDomain->OutHost($oDomain->Name()), $oDomain->OutPort(), '127.0.0.1', $oDomain->OutSecure(), $bOpenSSL);
|
||||
|
||||
if ($bOpenSSL)
|
||||
{
|
||||
$aStreamContextParams = $oSmtpClient->StreamContextParams();
|
||||
if (isset($aStreamContextParams['options']['ssl']['peer_certificate']))
|
||||
{
|
||||
$aParseData = @\openssl_x509_parse($aStreamContextParams['options']['ssl']['peer_certificate']);
|
||||
$this->Logger()->WriteDump($aParseData);
|
||||
}
|
||||
}
|
||||
$oSmtpClient->Connect($oDomain->OutHost($oDomain->Name()), $oDomain->OutPort(), '127.0.0.1',
|
||||
$oDomain->OutSecure(), $oDomain->OutVerifySsl());
|
||||
|
||||
$iSmtpTime = \microtime(true) - $iTime;
|
||||
$oSmtpClient->Disconnect();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ class Domain
|
|||
*/
|
||||
private $iIncSecure;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $bIncVerifySsl;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -48,6 +53,11 @@ class Domain
|
|||
*/
|
||||
private $iOutSecure;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $bOutVerifySsl;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -83,10 +93,12 @@ class Domain
|
|||
$this->sIncHost = $sIncHost;
|
||||
$this->iIncPort = $iIncPort;
|
||||
$this->iIncSecure = $iIncSecure;
|
||||
$this->bIncVerifySsl = false;
|
||||
$this->bIncShortLogin = $bIncShortLogin;
|
||||
$this->sOutHost = $sOutHost;
|
||||
$this->iOutPort = $iOutPort;
|
||||
$this->iOutSecure = $iOutSecure;
|
||||
$this->bOutVerifySsl = false;
|
||||
$this->bOutShortLogin = $bOutShortLogin;
|
||||
$this->bOutAuth = $bOutAuth;
|
||||
$this->sWhiteList = \trim($sWhiteList);
|
||||
|
|
@ -311,6 +323,14 @@ class Domain
|
|||
return $this->iIncSecure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IncVerifySsl()
|
||||
{
|
||||
return $this->bIncVerifySsl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -344,6 +364,14 @@ class Domain
|
|||
return $this->iOutSecure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function OutVerifySsl()
|
||||
{
|
||||
return $this->bOutVerifySsl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue