Commit a1d17205 authored by sikeda's avatar sikeda
Browse files

[change] openssl(1) utility is no longer required. Instead, a few CPAN...

[change] openssl(1) utility is no longer required.  Instead, a few CPAN modules are required to use S/MIME or SSL features:
- Crypt::SMIME
- Crypt::OpenSSL::X509
The parameter "openssl" in sympa.conf was obsoleted.

Note that p12topem.pl still needs openssl: To make it work, PATH environment variable should be set appropriately.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@11309 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 2b928a64
......@@ -49,7 +49,18 @@ if ($Conf::Conf{'db_name'} and $Conf::Conf{'db_type'}) {
}
}
my $openssl = $Conf::Conf{'openssl'};
my $openssl;
foreach my $path (
split(/:/, $ENV{PATH} || ''),
qw(/usr/local/bin /usr/local/ssl/bin /opt/local/bin /usr/sfw/bin /usr/bin)
) {
my $file = $path . '/openssl';
if (-x $file) {
$openssl = $file;
last;
}
}
my $home_sympa = $Conf::Conf{'home'};
my $outpass = $Conf::Conf{'key_passwd'};
my $etc_dir = $Conf::Conf{'etc'};
......@@ -101,8 +112,7 @@ if ( ($main::options{'help'} ne '')
}
unless ($openssl) {
printf
"You must first configure Sympa to use openssl. Check the parameter openssl in sympa.conf\n";
printf "You must set PATH environment variable to use openssl command line utility.\n";
die;
}
......
......@@ -99,6 +99,7 @@ my %old_params = (
'email_gecos' => 'gecos', # 6.2a.?? - 6.2a.33
'lock_method' => '', # 5.3b.3 - 6.2a.33
'html_editor_file' => 'html_editor_url', # 6.2a
'openssl' => '', # ?? - 6.2a.40
);
## These parameters now have a hard-coded value
......
......@@ -1116,15 +1116,15 @@ our @params = (
{'gettext_id' => 'S/MIME configuration'},
{ 'name' => 'openssl',
'sample' => '/usr/bin/ssl',
'gettext_id' => 'Path to OpenSSL',
'file' => 'sympa.conf',
'edit' => '1',
'gettext_comment' =>
'Sympa recognizes S/MIME if OpenSSL is installed',
'optional' => '1',
},
# { 'name' => 'openssl',
# 'sample' => '/usr/bin/ssl',
# 'gettext_id' => 'Path to OpenSSL',
# 'file' => 'sympa.conf',
# 'edit' => '1',
# 'gettext_comment' =>
# 'Sympa recognizes S/MIME if OpenSSL is installed',
# 'optional' => '1',
# },
{ 'name' => 'capath',
'optional' => '1',
'sample' => Sympa::Constants::SYSCONFDIR . '/ssl.crt',
......
......@@ -13,21 +13,7 @@ use Test::More;
#use Sympa::Tools::File;
use tools; # Sympa::Tools::SMIME;
use Conf;
delete $Conf::Conf{'openssl'};
foreach my $path (
split(/:/, $ENV{PATH} || ''),
qw(/usr/local/bin /usr/local/ssl/bin /opt/local/bin /usr/sfw/bin /usr/bin)
) {
my $openssl = $path . '/openssl';
if (-x $openssl) {
$Conf::Conf{'openssl'} = $openssl;
last;
}
}
$Conf::Conf{'tmpdir'} = '/tmp';
plan tests => 19;
plan tests => 15;
#ok(
# !tools::smime_find_keys('/no/where', 'sign'),
......@@ -131,25 +117,11 @@ SKIP: {
skip 'Crypt::OpenSSL::X509 not installed', 2
unless $Crypt::OpenSSL::X509::VERSION;
is_deeply(
tools::smime_parse_cert(
file => $cert_file,
#tmpdir => $ENV{TMP},
#openssl => 'openssl'
),
$cert_data,
'user certificate file parsing'
);
is_deeply(
tools::smime_parse_cert(
text => $cert_string,
#tmpdir => $ENV{TMP},
#openssl => 'openssl'
),
$cert_data,
'user certificate string parsing'
);
is_deeply(tools::smime_parse_cert(file => $cert_file,),
$cert_data, 'user certificate file parsing');
is_deeply(tools::smime_parse_cert(text => $cert_string,),
$cert_data, 'user certificate string parsing');
}
my $ca_cert_file = 't/pki/crt/ca.pem';
......@@ -167,41 +139,8 @@ SKIP: {
skip 'Crypt::OpenSSL::X509 not installed', 1
unless $Crypt::OpenSSL::X509::VERSION;
is_deeply(
tools::smime_parse_cert(
file => $ca_cert_file,
#tmpdir => $ENV{TMP},
#openssl => 'openssl'
),
$ca_cert_data,
'CA certificate file parsing'
);
}
my $parser = MIME::Parser->new();
$parser->output_to_core(1);
my $entity = $parser->parse_open('t/samples/signed.eml');
my $out_file = $cert_dir . '/out';
SKIP: {
skip 'either Crypt::OpenSSL::X509 or openssl not installed', 4
unless $Crypt::OpenSSL::X509::VERSION and $Conf::Conf{'openssl'};
ok( !tools::smime_extract_certs($entity->parts(0), $out_file, 'openssl'),
"certificate extraction from text part doesn't work"
);
ok( tools::smime_extract_certs($entity->parts(1), $out_file, 'openssl'),
"certificate extraction from signature part does work"
);
ok(-f $out_file, 'certificate extraction file exists');
is_deeply(
tools::smime_parse_cert(
file => $out_file,
#tmpdir => $ENV{TMP},
#openssl => 'openssl'
),
$cert_data,
'certificate extraction file has expected content'
);
is_deeply(tools::smime_parse_cert(file => $ca_cert_file,),
$ca_cert_data, 'CA certificate file parsing');
}
sub touch {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment