Commit 33b967fa authored by Nigel Kukard's avatar Nigel Kukard

Merge branch 'updates' into 'master'

Updates

See merge request !44
parents cfc438dc 5ed91b5a
Pipeline #1918 passed with stages
in 1 minute and 44 seconds
......@@ -76,7 +76,7 @@ use User::pwent;
my $NAME = "AWIT-SSH-Client";
our $VERSION = "0.8.8";
our $VERSION = "0.8.9";
print(STDERR "$NAME v$VERSION - Copyright (c) 2016-2017, AllWorldIT\n\n");
......@@ -94,6 +94,10 @@ C<awit-ssh> provides the below commandline options...
Display version information.
=head2 --forward-agent
Forward the ssh-agent socket.
=head2 --knock <HOST:PORT>
Knock on HOST:PORT to gain access.
......@@ -120,6 +124,8 @@ GetOptions(\%optctl,
# TODO: Improve globbing before adding it to displayHelp
"globbing",
"forward-agent",
"knock=s",
"rsync",
......@@ -257,9 +263,9 @@ Set the LDAP server base DN to use, for example C<dc=example,dc=com>.
=cut
$iniSetup{server} = {};
$iniSetup{server}{uri} = prompt("Your LDAP URI : ");
$iniSetup{server}{uri} = prompt("Your LDAP URI : ", '-tty');
$iniSetup{server}{uri} =~ s/^uri=//;
$iniSetup{server}{base} = prompt("Your LDAP Base : ");
$iniSetup{server}{base} = prompt("Your LDAP Base : ", '-tty');
$iniSetup{server}{base} =~ s/^base=//;
tied(%iniSetup)->WriteConfig($configFile) or die "Could not write settings to new configuration file.";
untie %iniSetup;
......@@ -311,7 +317,7 @@ my $pwent = getpwnam($ENV{'USER'});
(my $username) = split(/,/,$pwent->gecos);
if (!defined($username) || $username eq "") {
print STDERR "WARNING: Cannot determine your name, set your gecos field.\n\n";
$username = prompt("Your LDAP CN : ");
$username = prompt("Your LDAP CN : ", '-tty');
} else {
print STDERR "Your LDAP CN : $username (passwd->gecos)\n";
}
......@@ -324,10 +330,14 @@ my $password;
my ($kwalletObject,$kwalletHandle);
# IF removed, lets rather run this in its own scope...
{
my $dbus = Net::DBus->find();
# Grab the kwallet service off DBus
my $kwalletService = $dbus->get_service('org.kde.kwalletd');
my $kwalletService;
eval {
$kwalletService = $dbus->get_service('org.kde.kwalletd');
};
if (!defined($kwalletService)) {
logger('WARNING',color('magenta')."Kwallet not found on DBus".color('reset'));
goto KWALLET_END;
......@@ -342,7 +352,7 @@ KWALLET_END:
# If kwallet returned nothing, try read from terminal
if (!defined($password) || $password eq "") {
$password = prompt("Your LDAP Password: ", '-echo' => "*");
$password = prompt("Your LDAP Password: ", '-echo' => "*", '-tty');
}
print STDERR "\n";
......@@ -397,6 +407,7 @@ if ($ldapNumResults < 1) {
$counter++;
}
my $menuSelection = prompt("Your selection [1-$ldapNumResults,q]: ",
'-tty',
'-onechar',
'-require' => {
"Invalid Value - Your selection [1-$ldapNumResults,q]: " => sub {
......@@ -579,7 +590,7 @@ if (defined($pkcsProvider) && $pkcsProvider ne "") {
print STDERR "\n";
}
# Only push the config file override to SSH if the config file exists in the users homedir\
# Only push the config file override to SSH if the config file exists in the users homedir
if (-f (my $sshConfigFile = $ENV{"HOME"}.'/.ssh/config')) {
push(@sshArgs,'-F',$sshConfigFile);
}
......@@ -837,6 +848,7 @@ if (defined($forwardSocket)) {
}
}
# Loop waiting for the socket to be created
my $delay = 30;
while (! -e $libvirtSocket && $delay > 0) {
......@@ -861,6 +873,13 @@ if (defined($forwardSocket)) {
# Normal SSH
} else {
# Check if we're forwarding our agent
if ($optctl{'forward-agent'}) {
# FIXME - check if our keys expire
push(@sshArgs,'-A');
}
system('/usr/bin/ssh',
@sshArgs,
@sshArgsPortForwards,
......@@ -953,6 +972,9 @@ Usage: $0 <options> [USER@]HOST
--help What you're seeing now.
--version Display version.
Agent Fowarding:
--forward-agent Forward SSH agent socket.
Port Knocking:
--knock HOST:PORT Port knock a host to get access.
......
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