summaryrefslogtreecommitdiff
path: root/selftest/selftest.pl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-01-09 21:21:25 +0100
committerStefan Metzmacher <metze@samba.org>2016-03-17 17:17:16 +0100
commitb00c38afc6203f1e1f566db31a63cedba632dfab (patch)
tree33e821c89df237b7e4f89371092e0fc2423c539e /selftest/selftest.pl
parentb2c0f71db026353060ad47fd0a85241a3df8c703 (diff)
downloadsamba-b00c38afc6203f1e1f566db31a63cedba632dfab.tar.gz
selftest: setup information of new samba.example.com CA in the client environment
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'selftest/selftest.pl')
-rwxr-xr-xselftest/selftest.pl39
1 files changed, 39 insertions, 0 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index db702463da0..fa2f4cd903a 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -27,6 +27,7 @@ use Cwd qw(abs_path);
use lib "$RealBin";
use Subunit;
use SocketWrapper;
+use target::Samba;
eval {
require Time::HiRes;
@@ -524,6 +525,42 @@ sub write_clientconf($$$)
mkdir("$clientdir/ncalrpcdir", 0755);
umask $mask;
+ my $cadir = "$ENV{SRCDIR_ABS}/selftest/manage-ca/CA-samba.example.com";
+ my $cacert = "$cadir/Public/CA-samba.example.com-cert.pem";
+ my $cacrl_pem = "$cadir/Public/CA-samba.example.com-crl.pem";
+ my $ca_users_dir = "$cadir/Users";
+
+ if ( -d "$clientdir/pkinit" ) {
+ unlink <$clientdir/pkinit/*>;
+ } else {
+ mkdir("$clientdir/pkinit", 0700);
+ }
+
+ # each user has a USER-${USER_PRINCIPAL_NAME}-cert.pem and
+ # USER-${USER_PRINCIPAL_NAME}-private-key.pem symlink
+ # We make a copy here and make the certificated easily
+ # accessable in the client environment.
+ my $mask = umask;
+ umask 0077;
+ opendir USERS, "${ca_users_dir}" or die "Could not open dir '${ca_users_dir}': $!";
+ for my $d (readdir USERS) {
+ my $user_dir = "${ca_users_dir}/${d}";
+ next if ${d} =~ /^\./;
+ next if (! -d "${user_dir}");
+ opendir USER, "${user_dir}" or die "Could not open dir '${user_dir}': $!";
+ for my $l (readdir USER) {
+ my $user_link = "${user_dir}/${l}";
+ next if ${l} =~ /^\./;
+ next if (! -l "${user_link}");
+
+ my $dest = "${clientdir}/pkinit/${l}";
+ Samba::copy_file_content(${user_link}, ${dest});
+ }
+ closedir USER;
+ }
+ closedir USERS;
+ umask $mask;
+
open(CF, ">$conffile");
print CF "[global]\n";
print CF "\tnetbios name = client\n";
@@ -555,6 +592,8 @@ sub write_clientconf($$$)
#We don't want to run 'speed' tests for very long
torture:timelimit = 1
winbind separator = /
+ tls cafile = ${cacert}
+ tls crlfile = ${cacrl_pem}
";
close(CF);
}