Mailinglist Archive: opensuse-buildservice (339 mails)

< Previous Next >
[opensuse-buildservice] Scripting encryption (little bit offtopic)
  • From: Dirk Stoecker <opensuse@xxxxxxxxxxxx>
  • Date: Mon, 3 Mar 2008 17:40:41 +0100 (CET)
  • Message-id: <alpine.LNX.1.00.0803031732110.22217@xxxxxxxxxxxxxxxxx>
Hello,

sorry for asking that question here, but I have no better place.

I need an encrypted backup file. I used gpg to make this file. As gpg for idiotic reasons does not allow passwords in commandline (I know, I must be protected against myself) I used expect to do this job. This failed for openSUSE 10.3 due to the pinentry program changes. Now I adapted the code and it works from a normal shell opened in KDE. Still I get no result, when run as cron job.

Can anyone help me. I know I need not ask gpg guys, as they will tell me, what I do is evil.

Is there another way to get a password protect TAR.GZ file? I used mcrypt in the past, but this is no longer developed and has security holes.

The current Perl code is:

use Expect;

$ENV{LANG} = "C";
system("killall gpg-agent 2>/dev/null");
delete $ENV{KDE_FULL_SESSION};
delete $ENV{DISPLAY};
my $cmd = "(tar -cz$EXCLUDE $INCLUDE |gpg --batch -c >$FILE) 2>&1";
if((my $exp = Expect->spawn($cmd)))
{
$exp->log_file(sub { $a .= $_[0]; });
$exp->log_stdout(undef);
if($exp->expect(1, "Passphrase "))
{
$exp->send("$PW\r");
if($exp->expect(1, "Passphrase "))
{
$exp->send("$PW\r");
}
}
$exp->expect(86400, "This is the end we never reach");
$exp->soft_close();
}
$a =~ s/.*?\r//g; # remove GPG output

Ciao
--
http://www.dstoecker.eu/ (PGP key available)
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >