Skip to content

Commit

Permalink
No clear text for password (base64 encoded)
Browse files Browse the repository at this point in the history
  • Loading branch information
gillesdubois committed Feb 18, 2020
1 parent 9819384 commit 2ee973d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/Ocsinventory/Agent/Encrypt.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package Ocsinventory::Agent::Encrypt;

use MIME::Base64;

sub getClearTextPassword {
my ($encodedpass) = @_;

return decode_base64($encodedpass);
}

1;
4 changes: 3 additions & 1 deletion lib/Ocsinventory/Agent/Network.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use LWP::UserAgent;
use Socket;

use Ocsinventory::Compress;
use Ocsinventory::Agent::Encrypt;

sub new {
my (undef, $params) = @_;
Expand Down Expand Up @@ -48,12 +49,13 @@ sub new {
}
my $version = 'OCS-NG_unified_unix_agent_v';
$version .= exists ($self->{config}->{VERSION})?$self->{config}->{VERSION}:'';
my $encrypt = Ocsinventory::Agent::Encrypt::getClearTextPassword($self->{config}->{password});
$self->{ua}->agent($version);
$self->{ua}->credentials(
$uaserver, # server:port, port is needed
$self->{config}->{realm},
$self->{config}->{user},
$self->{config}->{password}
$encrypt
);

#Setting SSL configuration depending on LWP version
Expand Down

0 comments on commit 2ee973d

Please sign in to comment.