summaryrefslogtreecommitdiff
path: root/app/xlockmore/etc/xlockssh-add-keys.pl
blob: 3d382cea12b6d1badf9c5bbfebcf54691d1dd023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w
#
# This script is intended to be invoked via the -pipepassCmd option
# of xlock(1), to add private ssh(1) keys to a running ssh-agent(1)
# when the screen is unlocked without the user having to enter the
# passphrase.
# 
# Only keys who's passphrase is the same as the user's password can
# be automatically re-added in this way.
#
use strict;

use Expect;

my $pass = <STDIN>;
my $exp = Expect->spawn('/usr/local/bin/xlockssh-add.sh');
$exp->expect(10, ':');
$exp->send("$pass\r\n");
$exp->expect(10, ':');
$exp->hard_close;