-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
270 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,9 @@ | |
return array( | ||
'author' => 'Cambell Prince', | ||
'email' => '[email protected]', | ||
'version' => '1.1.0', | ||
'version' => '1.1.1', | ||
'require_api' => '1.0.5', | ||
'date' => '2017-09-05', | ||
'date' => '2017-09-06', | ||
'name' => 'LetsEncrypt', | ||
'desc' => 'Plugin that provides LetsEncrypt SSL certificates.', | ||
'url' => 'https://github.com/saygoweb/imscp-plugin-letsencrypt' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use diagnostics; # this gives you more debugging information | ||
use warnings; # this warns you of bad practices | ||
use strict; # this prevents silly errors | ||
|
||
use TAP::Harness; | ||
|
||
my %args = ( | ||
verbosity => 1, | ||
color => 1, | ||
); | ||
|
||
my $harness = TAP::Harness->new (\%args); | ||
$harness->runtests( | ||
# 'install.t', | ||
'run.t', | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use diagnostics; # this gives you more debugging information | ||
use warnings; # this warns you of bad practices | ||
use strict; # this prevents silly errors | ||
use Cwd 'abs_path'; | ||
use Test::More qw( no_plan ); # for the is() and isnt() functions | ||
|
||
use lib (abs_path('../../backend'), abs_path('../../../../../engine/PerlLib')); | ||
|
||
use iMSCP::Bootstrapper; | ||
|
||
use LetsEncrypt; | ||
|
||
my $bootstrapper = iMSCP::Bootstrapper->getInstance(); | ||
$bootstrapper->getInstance()->boot( | ||
{ | ||
mode => 'backend', | ||
nolock => 1, | ||
norequirements => 1, | ||
config_readonly => 1 | ||
} | ||
); | ||
|
||
my $plugin = Plugin::LetsEncrypt->getInstance(); | ||
is ($plugin->install(), 0, "install ok"); | ||
ok (-e '/usr/local/bin/certbot-auto', 'certbot-auto exists'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use diagnostics; # this gives you more debugging information | ||
use warnings; # this warns you of bad practices | ||
use strict; # this prevents silly errors | ||
use Cwd 'abs_path'; | ||
use Test::More qw( no_plan ); # for the is() and isnt() functions | ||
|
||
use lib (abs_path('../../backend'), abs_path('../../../../../engine/PerlLib')); | ||
|
||
use iMSCP::Bootstrapper; | ||
|
||
use LetsEncrypt; | ||
|
||
my $bootstrapper = iMSCP::Bootstrapper->getInstance(); | ||
$bootstrapper->getInstance()->boot( | ||
{ | ||
mode => 'backend', | ||
nolock => 1, | ||
norequirements => 1, | ||
config_readonly => 1 | ||
} | ||
); | ||
|
||
my $rs = 0; | ||
my $result = 0; | ||
my $db = iMSCP::Database->factory(); | ||
my $plugin = Plugin::LetsEncrypt->getInstance(); | ||
|
||
$db->doQuery( | ||
'q', | ||
'TRUNCATE ssl_certs' | ||
); | ||
|
||
# Should insert a certificate | ||
$rs = $plugin->_updateSelfSignedCertificate('dmn', 1); | ||
is($rs, 0, "LetsEncrypt::_updateSelfSignedCertificate No records"); | ||
|
||
$result = $db->doQuery( | ||
'cert_id', | ||
'SELECT * FROM ssl_certs' | ||
); | ||
is (scalar keys %{$result}, 1, "DB has one record"); | ||
|
||
# Should pass validation and do no harm | ||
$rs = $plugin->_updateSelfSignedCertificate('dmn', 1); | ||
is($rs, 0, "LetsEncrypt::_updateSelfSignedCertificate Existing record"); | ||
|
||
# Remove the private key and certificate from an exiting record. | ||
$result = $db->doQuery( | ||
'q', | ||
"UPDATE ssl_certs SET private_key='',certificate='' WHERE domain_type=? AND domain_id=?", | ||
'dmn', 1 | ||
); | ||
$rs = $plugin->_updateSelfSignedCertificate('dmn', 1); | ||
is($rs, 0, "LetsEncrypt::_updateSelfSignedCertificate Invalid record"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use diagnostics; # this gives you more debugging information | ||
use warnings; # this warns you of bad practices | ||
use strict; # this prevents silly errors | ||
use Cwd 'abs_path'; | ||
use Test::More qw( no_plan ); # for the is() and isnt() functions | ||
|
||
use lib (abs_path('../../backend'), abs_path('../../../../../engine/PerlLib')); | ||
|
||
use iMSCP::Bootstrapper; | ||
|
||
use LetsEncrypt; | ||
|
||
my $bootstrapper = iMSCP::Bootstrapper->getInstance(); | ||
$bootstrapper->getInstance()->boot( | ||
{ | ||
mode => 'backend', | ||
nolock => 1, | ||
norequirements => 1, | ||
config_readonly => 1 | ||
} | ||
); | ||
|
||
my $plugin = Plugin::LetsEncrypt->getInstance(); | ||
is ($plugin->run(), 0, "run ok"); |
Oops, something went wrong.