Commit a31d26c6 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Spoof Authentication and userDB modules (#1664)

parent 7b08a7c4
......@@ -28,9 +28,11 @@ sub init {
$self->logger->debug(
"impersonation rule -> " . $self->conf->{impersonationRule} );
my $rule
= $hd->buildSub( $hd->substitute( $self->conf->{impersonationRule} ) );
= $hd->buildSub(
$hd->substitute( $self->conf->{impersonationRule} ) );
unless ($rule) {
$self->error( "Bad impersonation rule -> " . $hd->tsv->{jail}->error );
$self->error(
"Bad impersonation rule -> " . $hd->tsv->{jail}->error );
return 0;
}
$self->{rule} = $rule;
......@@ -92,6 +94,11 @@ sub run {
}
# Create spoofed session
foreach (qw (_auth _userDB)) {
$self->logger->debug("Processing $_...");
$spk = "$self->{conf}->{impersonationPrefix}$_";
$spoofSession->{$_} = $realSession->{$spk};
}
$spoofSession = { %$spoofSession, %$realSession };
# Main session
......
Markdown is supported
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