From 3ddf65b0a8deab15c17f9c9518612ff418caa36e Mon Sep 17 00:00:00 2001 From: bitchecker Date: Thu, 4 Oct 2018 16:29:39 +0200 Subject: [PATCH 1/5] fixed bug (https://github.com/perseo22/pacmanager/issues/74) is now possible to use RSA key authentication using MOSH connection protocol --- lib/PACUtils.pm | 38 ++++++++------------------------------ lib/pac_conn | 40 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 50 deletions(-) diff --git a/lib/PACUtils.pm b/lib/PACUtils.pm index d47b371..018aca2 100644 --- a/lib/PACUtils.pm +++ b/lib/PACUtils.pm @@ -3,7 +3,7 @@ package PACUtils; ################################################################## # This file is part of PAC( Perl Auto Connector) # -# Copyright (C) 2010-2016 David Torrejon Vaquerizas +# Copyright (C) 2010-2015 David Torrejon Vaquerizas # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -105,7 +105,7 @@ require Exporter; # Define GLOBAL CLASS variables our $APPNAME = 'PAC'; -our $APPVERSION = '4.5.5.8'; +our $APPVERSION = '4.5.5.7'; our $DEBUG_LEVEL = 1; our $ARCH = ''; my $ARCH_TMP = `/bin/uname -m 2>&1`; @@ -114,7 +114,7 @@ elsif ( $ARCH_TMP =~ /ppc64/gio ) { $ARCH = 'PPC64'; } elsif ( $ARCH_TMP =~ /armv7l/gio ) { $ARCH = 'ARMV7L'; } elsif ( $ARCH_TMP =~ /arm/gio ) { $ARCH = 'ARM'; } else { $ARCH = 32; } -my $RES_DIR = $RealBin . '/res'; +my $RES_DIR = '/usr/share/pacmanager/res'; my $SPLASH_IMG = $RES_DIR . '/pac256x256.jpg'; my $CFG_DIR = $ENV{'HOME'} . '/.config/pac'; my $CFG_FILE = $CFG_DIR . '/pac.yml'; @@ -126,28 +126,6 @@ my %WINDOWPROGRESS; my $WIDGET_POPUP; our @DONATORS_LIST = ( - 'Angelo Maria Lambiasi', - 'TWEB Inc', - 'Jeff Bakst', - 'Sebastian Treu', - "Brian's Consultant Services", - 'Cheah CH', - 'Joseph Whipple', - 'Felix Brack', - 'Kalmykov Alexander', - 'Paul Verreth', - 'Iftimie Catalin Panaite', - 'Andre Geißler', - 'Arend de Boer', - 'Taylor Finklea', - 'Egbert Gerber', - 'Гусаров Андрей', - 'Carlos Bragatto', - 'Nicklas Börjesson', - 'Peter Taylor', - 'Javier Martin Garcia-Asenjo', - 'Helmut Kleinhans', - 'Richard Kozel', 'Timo Büttner', 'Max Maskevich', '1one - 18mind', @@ -207,7 +185,7 @@ our @PACDESKTOP = ( # Gnome2 - VTE (here be dragons...) eval q { - unshift( @INC, $RealBin . '/lib/ex/vte' . $PACUtils::ARCH ); + unshift( @INC, '/usr/share/pacmanager/lib/ex/vte' . $PACUtils::ARCH ); package Gnome2::Vte; @@ -799,7 +777,7 @@ sub _getMethods { _( $self, 'entryUser' ) -> set_sensitive( 1 ); _( $self, 'alignUserPass' ) -> set_sensitive( 1 ); _( $self, 'rbCfgAuthUserPass' ) -> set_active( $$cfg{'auth type'} eq 'userpass' ); - _( $self, 'framePublicKey' ) -> set_sensitive( 0 ); + _( $self, 'framePublicKey' ) -> set_sensitive( 1 ); _( $self, 'entryPassphrase' ) -> set_text( $$cfg{passphrase} // '' ); _( $self, 'fileCfgPublicKey' ) -> set_filename( $$cfg{'public key'} // '' ); _( $self, 'rbCfgAuthPublicKey' ) -> set_active( $$cfg{'auth type'} eq 'publickey' ); @@ -1854,7 +1832,7 @@ sub _cfgSanityCheck { $$cfg{'defaults'}{'screenshots external viewer'} //= '/usr/bin/xdg-open'; $$cfg{'defaults'}{'screenshots use external viewer'}//= 0; $$cfg{'defaults'}{'sort groups first'} //= 1; - $$cfg{'defaults'}{'word characters'} //= '\.:_\/a-zA-Z0-9-'; + $$cfg{'defaults'}{'word characters'} //= '\.:_\/-A-Za-z0-9'; $$cfg{'defaults'}{'terminal emulation'} //= 'xterm'; $$cfg{'defaults'}{'show tray icon'} //= 1; $$cfg{'defaults'}{'unsplit disconnected terminals'} //= 0; @@ -3045,7 +3023,7 @@ sub _getXWindowsList { $list{'by_pid'}{$data_pid}{'xid'} = $xid; $list{'by_pid'}{$data_pid}{'command'} = $data_command; } - } + } #my $tw = Gtk2::Window -> new; #my $vb = Gtk2::VBox -> new( 0, 0 ); @@ -3059,7 +3037,7 @@ sub _getXWindowsList { #my $sock = Gtk2::Socket -> new; #$vb -> add( $sock ); #$tw -> show_all; - #$sock -> add_id( $list{'by_name'}{'Calculator'}{'xid'} ); + #$sock -> add_id( $$list{'by_name'}{'Calculator'}{'xid'} ); return \%list; } diff --git a/lib/pac_conn b/lib/pac_conn index 97eabc2..0fcce22 100755 --- a/lib/pac_conn +++ b/lib/pac_conn @@ -3,7 +3,7 @@ ################################################################## # This file is part of PAC( Perl Auto Connector) # -# Copyright (C) 2010-2016 David Torrejon Vaquerizas +# Copyright (C) 2010-2015 David Torrejon Vaquerizas # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ use strict; use warnings; use FindBin qw ( $RealBin $Bin $Script ); -use lib $RealBin, $RealBin . '/ex', $RealBin . '/edit'; +use lib $RealBin, '/usr/share/pacmanager/ex', '/usr/share/pacmanager/edit'; use Storable qw ( dclone thaw retrieve fd_retrieve nstore_fd ); use Expect; use Gnome2::GConf; @@ -46,7 +46,7 @@ use Gtk2 '-init'; ######################################################## # START : Variables declaration/initialization my $APPNAME = 'PAC'; -my $APPICON = $RealBin . '/../res/pac64x64.png'; +my $APPICON = '/usr/share/pacmanager/res/pac64x64.png'; my $CFG_DIR = $ENV{'HOME'} . '/.config/pac'; my $SCRIPTS_DIR = $CFG_DIR . '/scripts'; @@ -665,6 +665,13 @@ sub _execScript { $EXP -> clear_accum; send_slow( $EXP, $txt ); }; + $TERMINAL{get_prompt} = sub { + my $del_esq = shift // 1; + ctrl( "SCRIPT_SUB_GET_PROMPT[NAME:$name][PID:$$][PARAMS:]" ); + my $prompt = _getPrompt(); + $del_esq and $prompt = _removeEscapeSeqs( $prompt ); + return "\Q$prompt\E"; + }; $TERMINAL{send_get} = sub { my $txt = shift // ''; my $intro = shift // 1; @@ -676,13 +683,6 @@ sub _execScript { $out =~ s/^.+?\R//go; return _removeEscapeSeqs( $out ); }; - $TERMINAL{get_prompt} = sub { - my $del_esq = shift // 1; - ctrl( "SCRIPT_SUB_GET_PROMPT[NAME:$name][PID:$$][PARAMS:]" ); - my $prompt = _getPrompt(); - $del_esq and $prompt = _removeEscapeSeqs( $prompt ); - return "\Q$prompt\E"; - }; $TERMINAL{expect} = sub { my $pattern = shift // ''; my $tmout = shift // 1; @@ -876,7 +876,16 @@ if ( defined $METHOD ) { } elsif ( ( $METHOD =~ /^.*mosh.*$/ ) || ( $METHOD eq 'MOSH' ) ) { $METHOD = 'mosh'; $PORT != 22 and $CONNECT_OPTS .= " --ssh=\"ssh -p $PORT\""; - $connection_cmd = "$METHOD $CONNECT_OPTS $USER\@$IP"; + my $key = ''; + if ( $AUTH eq 'publickey' ) { + $key = "-i \"$PUBKEY\"" . ( $AUTHFALLBACK ? '' : ' -o "PreferredAuthentications=publickey"' ); + $USER = $PASSPHRASE_USER; + $PASS = $PASSPHRASE; + $CONNECT_OPTS = " --ssh=\"ssh -p $PORT $key\""; + } elsif ( ! $AUTHFALLBACK ) { + $key = '-o "PreferredAuthentications=password,keyboard-interactive"'; + } + $connection_cmd = "$METHOD $CONNECT_OPTS " . "$USER" . "@" . "$IP"; $connection_txt = $connection_cmd; print "*$connection_cmd*\n"; } elsif ( ( $METHOD =~ /^.*sftp.*$/ ) || ( $METHOD eq 'SFTP' ) ) { @@ -934,9 +943,6 @@ if ( defined $METHOD ) { } elsif ( $METHOD eq 'rdesktop' ) { $connection_cmd = "$METHOD $CONNECT_OPTS" . ( $MANUAL ? '' : " -u $USER -p -" ) . " -T \"$TITLE\" $IP:$PORT"; $connection_txt = "$METHOD $CONNECT_OPTS" . ( $MANUAL ? '' : " -u $USER -p -" ) . " -T \"$TITLE\" $IP:$PORT"; - } elsif ( $METHOD =~ /^.*freerdp$/ ) { - $connection_cmd = "$METHOD $CONNECT_OPTS" . ( $MANUAL ? '' : " /u:$USER" ) . " /t:\"$TITLE\" /v:$IP:$PORT"; - $connection_txt = "$METHOD $CONNECT_OPTS" . ( $MANUAL ? '' : " /u:$USER" ) . " /t:\"$TITLE\" /v:$IP:$PORT"; } else { $connection_cmd = "$METHOD $CONNECT_OPTS" . ( $MANUAL ? '' : " -u $USER" ) . " $IP:$PORT -T \"$TITLE\""; $connection_txt = "$METHOD $CONNECT_OPTS" . ( $MANUAL ? '' : " -u $USER" ) . " $IP:$PORT -T \"$TITLE\""; @@ -1124,12 +1130,6 @@ elsif ( ( $METHOD =~ /^.*vncviewer$/ ) || ( $METHOD eq 'VNC' ) ) { ctrl( "CONNECTED" ); }], - # No auth is needed - [ '^.*No authentication needed*$', sub { - $CONNECTED = 1; - ctrl( "CONNECTED" ); - }], - # Found login string [ '^.*Conn:\s+connected to host\s+.+\s+port\s+\d+.*$', sub { $CONNECTED = 1; From 5655d13c6e5edd4e5e68bc4c575bf4dcf3cb0d51 Mon Sep 17 00:00:00 2001 From: bitchecker Date: Thu, 4 Oct 2018 17:09:32 +0200 Subject: [PATCH 2/5] commented KeePass module because, also installing perl-File-KeePass, gives error: Can't locate KeePass.pm in @INC (you may need to install the KeePass module) --- lib/pac_conn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pac_conn b/lib/pac_conn index 0fcce22..8b6d22a 100755 --- a/lib/pac_conn +++ b/lib/pac_conn @@ -36,7 +36,7 @@ use POSIX qw ( strftime ); use Encode qw ( encode decode ); use IO::Socket::INET; use Encode; -use KeePass; +#use KeePass; use Gtk2 '-init'; From 2c338c3c06ed25d6792ca1aa371f8f8bac83b09e Mon Sep 17 00:00:00 2001 From: bitchecker Date: Thu, 4 Oct 2018 20:10:19 +0200 Subject: [PATCH 3/5] create ad-hoc readme file --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..67ded27 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# This is a FORK of PAC project +( https://github.com/perseo22/pacmanager ) + +## the only reason for this fork is to solve the RSA key authentication using MOSH protocol + + +* HOW TO USE IT: + + - This forked version, at the moment, needs the installation of `pacmanager` from distro repositories for manage dipendencies correctly, and, after that, run the `pac` perl script. + - At the moment, the keepass module is disabled. + +### for all other informations, please read the forked README file. \ No newline at end of file From 241b239a31ca396965fb0f1902a75c694c6747e8 Mon Sep 17 00:00:00 2001 From: bitchecker Date: Thu, 4 Oct 2018 20:51:03 +0200 Subject: [PATCH 4/5] re-enabled KeePass module for building process --- lib/pac_conn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pac_conn b/lib/pac_conn index 8b6d22a..0fcce22 100755 --- a/lib/pac_conn +++ b/lib/pac_conn @@ -36,7 +36,7 @@ use POSIX qw ( strftime ); use Encode qw ( encode decode ); use IO::Socket::INET; use Encode; -#use KeePass; +use KeePass; use Gtk2 '-init'; From b8b4786907f5180f69d6ada48f3d204cfebcec35 Mon Sep 17 00:00:00 2001 From: bitchecker Date: Wed, 10 Oct 2018 14:58:16 +0200 Subject: [PATCH 5/5] updated version number --- README | 8 ++++++++ lib/PACUtils.pm | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README b/README index eb6d05b..3aae0e1 100644 --- a/README +++ b/README @@ -54,6 +54,14 @@ * VERSIONS: + - 4.5.5.9 ( by bitchecker ): + + . Fixed a bug for using RSA keys authentication with MOSH protocol + + - 4.5.5.8: + + . Fixed a bug that prevented PAC from starting with "clusters" view selected + - 4.5.5.8: . Fixed a bug that prevented PAC from starting with "clusters" view selected diff --git a/lib/PACUtils.pm b/lib/PACUtils.pm index 018aca2..87c3c97 100644 --- a/lib/PACUtils.pm +++ b/lib/PACUtils.pm @@ -105,7 +105,7 @@ require Exporter; # Define GLOBAL CLASS variables our $APPNAME = 'PAC'; -our $APPVERSION = '4.5.5.7'; +our $APPVERSION = '4.5.5.9'; our $DEBUG_LEVEL = 1; our $ARCH = ''; my $ARCH_TMP = `/bin/uname -m 2>&1`;