You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(26) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(5) |
Feb
(3) |
Mar
(11) |
Apr
(10) |
May
(2) |
Jun
(5) |
Jul
(13) |
Aug
(2) |
Sep
(3) |
Oct
(10) |
Nov
(18) |
Dec
(29) |
2002 |
Jan
(12) |
Feb
(14) |
Mar
(73) |
Apr
(28) |
May
(21) |
Jun
(39) |
Jul
(40) |
Aug
(42) |
Sep
(20) |
Oct
(4) |
Nov
(9) |
Dec
(18) |
2003 |
Jan
(2) |
Feb
(8) |
Mar
(6) |
Apr
(24) |
May
(24) |
Jun
(14) |
Jul
(16) |
Aug
(36) |
Sep
(34) |
Oct
(23) |
Nov
(4) |
Dec
(15) |
2004 |
Jan
(6) |
Feb
(13) |
Mar
(7) |
Apr
(5) |
May
(11) |
Jun
(5) |
Jul
(4) |
Aug
|
Sep
(2) |
Oct
(16) |
Nov
(4) |
Dec
(9) |
2005 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
(10) |
May
(5) |
Jun
(13) |
Jul
(3) |
Aug
|
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(9) |
2006 |
Jan
|
Feb
(10) |
Mar
(22) |
Apr
(14) |
May
(5) |
Jun
(4) |
Jul
(19) |
Aug
(7) |
Sep
(16) |
Oct
(4) |
Nov
(1) |
Dec
(16) |
2007 |
Jan
(17) |
Feb
|
Mar
(35) |
Apr
(5) |
May
(20) |
Jun
(11) |
Jul
(33) |
Aug
(3) |
Sep
(2) |
Oct
(11) |
Nov
(23) |
Dec
(5) |
2008 |
Jan
(10) |
Feb
(9) |
Mar
|
Apr
(6) |
May
(8) |
Jun
(7) |
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(20) |
2009 |
Jan
(8) |
Feb
(8) |
Mar
(3) |
Apr
(8) |
May
(2) |
Jun
(11) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(7) |
Dec
(4) |
2010 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(7) |
Aug
(3) |
Sep
(7) |
Oct
(2) |
Nov
(1) |
Dec
(4) |
2011 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(2) |
Jun
|
Jul
(6) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
(30) |
Apr
(10) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(12) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-04-03 14:24:15
|
Hello Don, I was away from my if elsif and tried modifying my script but so far it is not sending the yes after I get the question Are you sure you want to continue connecting (yes/no)? This my script with debugging on. use Expect; my $timeout = 60; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@remotehost'); $ssh->debug(1); if ($ssh->match() =~ m/Are you sure you want to continue connecting \(yes\/no\)?/ ) { $ssh->send("yes\r"); } elsif ( $ssh->match() =~ m/Password:/ ) { $ssh->send("mypassword\n"); } This my output I get so far from the debugging it just sits at Are you sure. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x174b2db0)', 60, 'Password:') called at ./tester-a line 21 The authenticity of host 'remotehost (0.0.0.0)' can't be established. RSA key fingerprint is x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x. Are you sure you want to continue connecting (yes/no)? //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Wednesday, April 01, 2015 10:45 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; Matt Zagrabelny Cc: exp...@li... Subject: RE: [Expectperl-discuss] expect.pm not updating password You will need to expect multiple things and then check to see what you got and handle that. It has been a long time since I did this on solaris so I may have the order wrong... my $timeout = 60; $ssh->send("passwd amagana\n"); $ssh->expect( $timeout, [ qr/New Password/], [ qr/ Are you sure you want to continue connecting/] ); If ( $ssh->match() =~ m/New Password/ ) { $ssh->send("mynewpassword\n"); } elsif ($ssh->match() =~ m/ Are you sure you want to continue connecting/ ) { $ssh->send("yes\n"); # then here put in what you expect to get next such as "New Password" # then send it the response such as "mynewpassword\n" } # continue on with the rest of your script $ssh->expect(60, 'Re-enter new Password:'); -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Wednesday, April 01, 2015 10:24 AM To: ESRY JR., DON; Matt Zagrabelny Cc: exp...@li... Subject: RE: [Expectperl-discuss] expect.pm not updating password Now that I have a working script and thanks very much to you Matt and Don, I am trying to put in my script an if else because sometimes my script will encounter this : Are you sure you want to continue connecting (yes/no)?') what I did create are some variables is this correct and may I see an example if statement so that the script can make a decision and keep going? use Expect; my $knownhost = $ssh->expect(60, 'Are you sure you want to continue connecting (yes/no)?'); my $answer = $ssh->send("yes\n"); my $filename = "/var/tmp/expect_script.log"; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 4:16 PM To: Matt Zagrabelny; MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: RE: [Expectperl-discuss] expect.pm not updating password I think you will want a log file to identify where the script failed. I recommend that you take out the 'w' from the $ssh->log_file($filename, 'w'); so it will append to the file rather than over writing it for each server. And then put in some sort of header for each server, something like: my $header = "\n\n======= $system =======\n"; $ssh->print_log_file($header); Or if you prefer a separate file for each server, then my $filename = "/var/tmp/expect_script_". $system ".log"; little stuff like this can be very frustrating. -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Tuesday, March 31, 2015 4:56 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm not updating password On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Thank you Matt, > > I just don't know how to put it in a working way I learn by examples I > am a novice on perl and the modules. Maybe spend a day or two writing some basic perl programs so you feel more comfortable with this stuff. I'm sure there are truckloads of perl tutorials out there. I added some context below. You'll need to clean up the leading '>' characters. -m > > #!/usr/bin/perl > use strict; > > use Expect; > > # my @servers = qw( > # server1.example.net > # server2.example.net > # server3.example.net > # server4.example.net > # server5.example.net > # ); > # > # for my $server (@servers) { > # # do your thing with $server change_password($server); > # } > sub change_password { my $system = shift; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@' . $system); > $ssh->debug(1); > $ssh->log_file($filename, 'w'); > $ssh->expect(60, 'Password:'); > $ssh->send("mycurrentpassword\n"); > $ssh->expect(60, '$'); > $ssh->send("su - root\n"); > $ssh->expect(60, 'Password:'); > $ssh->send("myrootpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("passwd amagana\n"); > $ssh->expect(60, 'New Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, 'Re-enter new Password:'); > $ssh->send("mynewpassword\n"); $ssh->expect(60, '#'); > $ssh->send("exit\n"); $ssh->close(); } ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: ESRY JR., D. <de...@at...> - 2015-04-01 15:45:46
|
You will need to expect multiple things and then check to see what you got and handle that. It has been a long time since I did this on solaris so I may have the order wrong... my $timeout = 60; $ssh->send("passwd amagana\n"); $ssh->expect( $timeout, [ qr/New Password/], [ qr/ Are you sure you want to continue connecting/] ); If ( $ssh->match() =~ m/New Password/ ) { $ssh->send("mynewpassword\n"); } elsif ($ssh->match() =~ m/ Are you sure you want to continue connecting/ ) { $ssh->send("yes\n"); # then here put in what you expect to get next such as "New Password" # then send it the response such as "mynewpassword\n" } # continue on with the rest of your script $ssh->expect(60, 'Re-enter new Password:'); -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Wednesday, April 01, 2015 10:24 AM To: ESRY JR., DON; Matt Zagrabelny Cc: exp...@li... Subject: RE: [Expectperl-discuss] expect.pm not updating password Now that I have a working script and thanks very much to you Matt and Don, I am trying to put in my script an if else because sometimes my script will encounter this : Are you sure you want to continue connecting (yes/no)?') what I did create are some variables is this correct and may I see an example if statement so that the script can make a decision and keep going? use Expect; my $knownhost = $ssh->expect(60, 'Are you sure you want to continue connecting (yes/no)?'); my $answer = $ssh->send("yes\n"); my $filename = "/var/tmp/expect_script.log"; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 4:16 PM To: Matt Zagrabelny; MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: RE: [Expectperl-discuss] expect.pm not updating password I think you will want a log file to identify where the script failed. I recommend that you take out the 'w' from the $ssh->log_file($filename, 'w'); so it will append to the file rather than over writing it for each server. And then put in some sort of header for each server, something like: my $header = "\n\n======= $system =======\n"; $ssh->print_log_file($header); Or if you prefer a separate file for each server, then my $filename = "/var/tmp/expect_script_". $system ".log"; little stuff like this can be very frustrating. -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Tuesday, March 31, 2015 4:56 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm not updating password On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Thank you Matt, > > I just don't know how to put it in a working way I learn by examples I > am a novice on perl and the modules. Maybe spend a day or two writing some basic perl programs so you feel more comfortable with this stuff. I'm sure there are truckloads of perl tutorials out there. I added some context below. You'll need to clean up the leading '>' characters. -m > > #!/usr/bin/perl > use strict; > > use Expect; > > # my @servers = qw( > # server1.example.net > # server2.example.net > # server3.example.net > # server4.example.net > # server5.example.net > # ); > # > # for my $server (@servers) { > # # do your thing with $server change_password($server); > # } > sub change_password { my $system = shift; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@' . $system); > $ssh->debug(1); > $ssh->log_file($filename, 'w'); > $ssh->expect(60, 'Password:'); > $ssh->send("mycurrentpassword\n"); > $ssh->expect(60, '$'); > $ssh->send("su - root\n"); > $ssh->expect(60, 'Password:'); > $ssh->send("myrootpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("passwd amagana\n"); > $ssh->expect(60, 'New Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, 'Re-enter new Password:'); > $ssh->send("mynewpassword\n"); $ssh->expect(60, '#'); > $ssh->send("exit\n"); $ssh->close(); } ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: mike n. <xmi...@gm...> - 2015-04-01 14:46:37
|
Try something like this: my $exp = new Expect; $exp->log_stdout(1); $username = "XXXXXX"; $exp->spawn( "ssh -l ${username} ${ip} " ) or die "cannot spawn $command: $! \n"; $exp->log_file("./${log_dir}/$ip\_info.log"); print "\nspawning ssh connection to $ip on $time\n\n"; $exp->log_file->print( "\nspawning ssh connection to $ip on $time\n\n" ); $exp->expect(8, [ 'connecting' => sub { $exp->send("yes \n"); exp_continue; } ], [ 'assword:' => sub { $exp->send("$pw\n"); exp_continue; } ], [ '-re', '> ?$' => sub { break; }], [ 'try again' => sub { die " died from bad password.\n"; }], [ 'refused' => sub { die " died from connection refused.\n"; exp_continue; } ], [ eof => sub { die " died from eof.\n"; }], [ timeout => sub { $exp->hard_close(); }], ); On Wed, Apr 1, 2015 at 9:24 AM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Now that I have a working script and thanks very much to you Matt and Don, > > I am trying to put in my script an if else because sometimes my script > will encounter this : > > Are you sure you want to continue connecting (yes/no)?') > > > > what I did create are some variables is this correct and may I see an > example if statement so that the script can make a decision and keep going? > > use Expect; > my $knownhost = $ssh->expect(60, 'Are you sure you want to continue > connecting (yes/no)?'); > my $answer = $ssh->send("yes\n"); > my $filename = "/var/tmp/expect_script.log"; > > > > //SIGNED// > > Andy Magaña > UNIX Systems Administrator > Diligent Contractor, 72nd Air Base Wing > Tinker Air Force Base, Oklahoma > Commercial: (405) 734-0341 > > -----Original Message----- > From: ESRY JR., DON [mailto:de...@at...] > Sent: Tuesday, March 31, 2015 4:16 PM > To: Matt Zagrabelny; MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT > Cc: exp...@li... > Subject: RE: [Expectperl-discuss] expect.pm not updating password > > I think you will want a log file to identify where the script failed. > > I recommend that you take out the 'w' from the $ssh->log_file($filename, > 'w'); so it will append to the file rather than over writing it for each > server. > > And then put in some sort of header for each server, something like: > my $header = "\n\n======= $system =======\n"; > $ssh->print_log_file($header); > > Or if you prefer a separate file for each server, then my $filename = > "/var/tmp/expect_script_". $system ".log"; > > little stuff like this can be very frustrating. > > > -----Original Message----- > From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] > Sent: Tuesday, March 31, 2015 4:56 PM > To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT > Cc: exp...@li... > Subject: Re: [Expectperl-discuss] expect.pm not updating password > > On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 > ABW/SCOOT <and...@us...> wrote: > > Thank you Matt, > > > > I just don't know how to put it in a working way I learn by examples I > > am a novice on perl and the modules. > > Maybe spend a day or two writing some basic perl programs so you feel more > comfortable with this stuff. I'm sure there are truckloads of perl > tutorials out there. > > I added some context below. You'll need to clean up the leading '>' > characters. > > -m > > > > > > #!/usr/bin/perl > > use strict; > > > > use Expect; > > > > # my @servers = qw( > > # server1.example.net > > # server2.example.net > > # server3.example.net > > # server4.example.net > > # server5.example.net > > # ); > > # > > # for my $server (@servers) { > > # # do your thing with $server > > change_password($server); > > > # } > > > > sub change_password { > my $system = shift; > > my $filename = "/var/tmp/expect_script.log"; > my $ssh = Expect->new('ssh amagana@' . $system); > > > > $ssh->debug(1); > > $ssh->log_file($filename, 'w'); > > $ssh->expect(60, 'Password:'); > > $ssh->send("mycurrentpassword\n"); > > $ssh->expect(60, '$'); > > $ssh->send("su - root\n"); > > $ssh->expect(60, 'Password:'); > > $ssh->send("myrootpassword\n"); > > $ssh->expect(60, '#'); > > $ssh->send("passwd amagana\n"); > > $ssh->expect(60, 'New Password:'); > > $ssh->send("mynewpassword\n"); > > $ssh->expect(60, 'Re-enter new Password:'); > > $ssh->send("mynewpassword\n"); $ssh->expect(60, '#'); > > $ssh->send("exit\n"); $ssh->close(); > > } > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-04-01 14:25:48
|
Now that I have a working script and thanks very much to you Matt and Don, I am trying to put in my script an if else because sometimes my script will encounter this : Are you sure you want to continue connecting (yes/no)?') what I did create are some variables is this correct and may I see an example if statement so that the script can make a decision and keep going? use Expect; my $knownhost = $ssh->expect(60, 'Are you sure you want to continue connecting (yes/no)?'); my $answer = $ssh->send("yes\n"); my $filename = "/var/tmp/expect_script.log"; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 4:16 PM To: Matt Zagrabelny; MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: RE: [Expectperl-discuss] expect.pm not updating password I think you will want a log file to identify where the script failed. I recommend that you take out the 'w' from the $ssh->log_file($filename, 'w'); so it will append to the file rather than over writing it for each server. And then put in some sort of header for each server, something like: my $header = "\n\n======= $system =======\n"; $ssh->print_log_file($header); Or if you prefer a separate file for each server, then my $filename = "/var/tmp/expect_script_". $system ".log"; little stuff like this can be very frustrating. -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Tuesday, March 31, 2015 4:56 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm not updating password On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Thank you Matt, > > I just don't know how to put it in a working way I learn by examples I > am a novice on perl and the modules. Maybe spend a day or two writing some basic perl programs so you feel more comfortable with this stuff. I'm sure there are truckloads of perl tutorials out there. I added some context below. You'll need to clean up the leading '>' characters. -m > > #!/usr/bin/perl > use strict; > > use Expect; > > # my @servers = qw( > # server1.example.net > # server2.example.net > # server3.example.net > # server4.example.net > # server5.example.net > # ); > # > # for my $server (@servers) { > # # do your thing with $server change_password($server); > # } > sub change_password { my $system = shift; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@' . $system); > $ssh->debug(1); > $ssh->log_file($filename, 'w'); > $ssh->expect(60, 'Password:'); > $ssh->send("mycurrentpassword\n"); > $ssh->expect(60, '$'); > $ssh->send("su - root\n"); > $ssh->expect(60, 'Password:'); > $ssh->send("myrootpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("passwd amagana\n"); > $ssh->expect(60, 'New Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, 'Re-enter new Password:'); > $ssh->send("mynewpassword\n"); $ssh->expect(60, '#'); > $ssh->send("exit\n"); $ssh->close(); } ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: <jfe...@gm...> - 2015-04-01 00:40:01
|
The "\n" is not needed on $ssh->expect("New Password:\n"); you can use $ssh->expect("word"); On Tue, Mar 31, 2015 at 2:18 PM, mike nicholas <xmi...@gm...> wrote: > I like to name my log files with the name or IP used to connect to the > device, makes grepping through them easy to identify where the line came > from. :) > > On Tue, Mar 31, 2015 at 4:15 PM, ESRY JR., DON <de...@at...> wrote: > >> I think you will want a log file to identify where the script failed. >> >> I recommend that you take out the 'w' from the >> $ssh->log_file($filename, 'w'); >> so it will append to the file rather than over writing it for each server. >> >> And then put in some sort of header for each server, something like: >> my $header = "\n\n======= $system =======\n"; >> $ssh->print_log_file($header); >> >> Or if you prefer a separate file for each server, then >> my $filename = "/var/tmp/expect_script_". $system ".log"; >> >> little stuff like this can be very frustrating. >> >> >> -----Original Message----- >> From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] >> Sent: Tuesday, March 31, 2015 4:56 PM >> To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT >> Cc: exp...@li... >> Subject: Re: [Expectperl-discuss] expect.pm not updating password >> >> On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 >> ABW/SCOOT <and...@us...> wrote: >> > Thank you Matt, >> > >> > I just don't know how to put it in a working way I learn by examples I >> am a >> > novice on perl and the modules. >> >> Maybe spend a day or two writing some basic perl programs so you feel >> more comfortable with this stuff. I'm sure there are truckloads of >> perl tutorials out there. >> >> I added some context below. You'll need to clean up the leading '>' >> characters. >> >> -m >> >> >> > >> > #!/usr/bin/perl >> > use strict; >> > >> > use Expect; >> > >> > # my @servers = qw( >> > # server1.example.net >> > # server2.example.net >> > # server3.example.net >> > # server4.example.net >> > # server5.example.net >> > # ); >> > # >> > # for my $server (@servers) { >> > # # do your thing with $server >> >> change_password($server); >> >> > # } >> > >> >> sub change_password { >> my $system = shift; >> >> my $filename = "/var/tmp/expect_script.log"; >> my $ssh = Expect->new('ssh amagana@' . $system); >> >> >> > $ssh->debug(1); >> > $ssh->log_file($filename, 'w'); >> > $ssh->expect(60, 'Password:'); >> > $ssh->send("mycurrentpassword\n"); >> > $ssh->expect(60, '$'); >> > $ssh->send("su - root\n"); >> > $ssh->expect(60, 'Password:'); >> > $ssh->send("myrootpassword\n"); >> > $ssh->expect(60, '#'); >> > $ssh->send("passwd amagana\n"); >> > $ssh->expect(60, 'New Password:'); >> > $ssh->send("mynewpassword\n"); >> > $ssh->expect(60, 'Re-enter new Password:'); >> > $ssh->send("mynewpassword\n"); >> > $ssh->expect(60, '#'); >> > $ssh->send("exit\n"); >> > $ssh->close(); >> >> } >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Expectperl-discuss mailing list >> Exp...@li... >> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Expectperl-discuss mailing list >> Exp...@li... >> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss >> > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > |
From: mike n. <xmi...@gm...> - 2015-03-31 21:19:03
|
I like to name my log files with the name or IP used to connect to the device, makes grepping through them easy to identify where the line came from. :) On Tue, Mar 31, 2015 at 4:15 PM, ESRY JR., DON <de...@at...> wrote: > I think you will want a log file to identify where the script failed. > > I recommend that you take out the 'w' from the > $ssh->log_file($filename, 'w'); > so it will append to the file rather than over writing it for each server. > > And then put in some sort of header for each server, something like: > my $header = "\n\n======= $system =======\n"; > $ssh->print_log_file($header); > > Or if you prefer a separate file for each server, then > my $filename = "/var/tmp/expect_script_". $system ".log"; > > little stuff like this can be very frustrating. > > > -----Original Message----- > From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] > Sent: Tuesday, March 31, 2015 4:56 PM > To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT > Cc: exp...@li... > Subject: Re: [Expectperl-discuss] expect.pm not updating password > > On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 > ABW/SCOOT <and...@us...> wrote: > > Thank you Matt, > > > > I just don't know how to put it in a working way I learn by examples I > am a > > novice on perl and the modules. > > Maybe spend a day or two writing some basic perl programs so you feel > more comfortable with this stuff. I'm sure there are truckloads of > perl tutorials out there. > > I added some context below. You'll need to clean up the leading '>' > characters. > > -m > > > > > > #!/usr/bin/perl > > use strict; > > > > use Expect; > > > > # my @servers = qw( > > # server1.example.net > > # server2.example.net > > # server3.example.net > > # server4.example.net > > # server5.example.net > > # ); > > # > > # for my $server (@servers) { > > # # do your thing with $server > > change_password($server); > > > # } > > > > sub change_password { > my $system = shift; > > my $filename = "/var/tmp/expect_script.log"; > my $ssh = Expect->new('ssh amagana@' . $system); > > > > $ssh->debug(1); > > $ssh->log_file($filename, 'w'); > > $ssh->expect(60, 'Password:'); > > $ssh->send("mycurrentpassword\n"); > > $ssh->expect(60, '$'); > > $ssh->send("su - root\n"); > > $ssh->expect(60, 'Password:'); > > $ssh->send("myrootpassword\n"); > > $ssh->expect(60, '#'); > > $ssh->send("passwd amagana\n"); > > $ssh->expect(60, 'New Password:'); > > $ssh->send("mynewpassword\n"); > > $ssh->expect(60, 'Re-enter new Password:'); > > $ssh->send("mynewpassword\n"); > > $ssh->expect(60, '#'); > > $ssh->send("exit\n"); > > $ssh->close(); > > } > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: ESRY JR., D. <de...@at...> - 2015-03-31 21:16:36
|
I think you will want a log file to identify where the script failed. I recommend that you take out the 'w' from the $ssh->log_file($filename, 'w'); so it will append to the file rather than over writing it for each server. And then put in some sort of header for each server, something like: my $header = "\n\n======= $system =======\n"; $ssh->print_log_file($header); Or if you prefer a separate file for each server, then my $filename = "/var/tmp/expect_script_". $system ".log"; little stuff like this can be very frustrating. -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Tuesday, March 31, 2015 4:56 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: Re: [Expectperl-discuss] expect.pm not updating password On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Thank you Matt, > > I just don't know how to put it in a working way I learn by examples I am a > novice on perl and the modules. Maybe spend a day or two writing some basic perl programs so you feel more comfortable with this stuff. I'm sure there are truckloads of perl tutorials out there. I added some context below. You'll need to clean up the leading '>' characters. -m > > #!/usr/bin/perl > use strict; > > use Expect; > > # my @servers = qw( > # server1.example.net > # server2.example.net > # server3.example.net > # server4.example.net > # server5.example.net > # ); > # > # for my $server (@servers) { > # # do your thing with $server change_password($server); > # } > sub change_password { my $system = shift; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@' . $system); > $ssh->debug(1); > $ssh->log_file($filename, 'w'); > $ssh->expect(60, 'Password:'); > $ssh->send("mycurrentpassword\n"); > $ssh->expect(60, '$'); > $ssh->send("su - root\n"); > $ssh->expect(60, 'Password:'); > $ssh->send("myrootpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("passwd amagana\n"); > $ssh->expect(60, 'New Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, 'Re-enter new Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("exit\n"); > $ssh->close(); } ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Matt Z. <mzagrabe@d.umn.edu> - 2015-03-31 20:55:57
|
On Tue, Mar 31, 2015 at 3:37 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Thank you Matt, > > I just don't know how to put it in a working way I learn by examples I am a > novice on perl and the modules. Maybe spend a day or two writing some basic perl programs so you feel more comfortable with this stuff. I'm sure there are truckloads of perl tutorials out there. I added some context below. You'll need to clean up the leading '>' characters. -m > > #!/usr/bin/perl > use strict; > > use Expect; > > # my @servers = qw( > # server1.example.net > # server2.example.net > # server3.example.net > # server4.example.net > # server5.example.net > # ); > # > # for my $server (@servers) { > # # do your thing with $server change_password($server); > # } > sub change_password { my $system = shift; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@' . $system); > $ssh->debug(1); > $ssh->log_file($filename, 'w'); > $ssh->expect(60, 'Password:'); > $ssh->send("mycurrentpassword\n"); > $ssh->expect(60, '$'); > $ssh->send("su - root\n"); > $ssh->expect(60, 'Password:'); > $ssh->send("myrootpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("passwd amagana\n"); > $ssh->expect(60, 'New Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, 'Re-enter new Password:'); > $ssh->send("mynewpassword\n"); > $ssh->expect(60, '#'); > $ssh->send("exit\n"); > $ssh->close(); } |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-31 20:38:03
|
Thank you Matt, I just don't know how to put it in a working way I learn by examples I am a novice on perl and the modules. Respectfully, Andy #!/usr/bin/perl use strict; use Expect; # my @servers = qw( # server1.example.net # server2.example.net # server3.example.net # server4.example.net # server5.example.net # ); # # for my $server (@servers) { # # do your thing with $server # } my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@remotehost'); $ssh->debug(1); $ssh->log_file($filename, 'w'); $ssh->expect(60, 'Password:'); $ssh->send("mycurrentpassword\n"); $ssh->expect(60, '$'); $ssh->send("su - root\n"); $ssh->expect(60, 'Password:'); $ssh->send("myrootpassword\n"); $ssh->expect(60, '#'); $ssh->send("passwd amagana\n"); $ssh->expect(60, 'New Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, 'Re-enter new Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, '#'); $ssh->send("exit\n"); $ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] Sent: Tuesday, March 31, 2015 3:25 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: ESRY JR., DON; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm not updating password On Tue, Mar 31, 2015 at 3:16 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Hoooray! > Now I just need to know how to run this against a list of servers. This is pretty basic perl... my @servers = qw( server1.example.net server2.example.net server3.example.net server4.example.net server5.example.net ); for my $server (@servers) { # do your thing with $server } -m |
From: Matt Z. <mzagrabe@d.umn.edu> - 2015-03-31 20:25:10
|
On Tue, Mar 31, 2015 at 3:16 PM, MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT <and...@us...> wrote: > Hoooray! > Now I just need to know how to run this against a list of servers. This is pretty basic perl... my @servers = qw( server1.example.net server2.example.net server3.example.net server4.example.net server5.example.net ); for my $server (@servers) { # do your thing with $server } -m |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-31 20:17:12
|
Hoooray! It finally changed my password thank you so so so much for your input, I had to expect new hash prompt, I guess the shell ended too soon because the script was not told what to expect after the second send of the new password. Now I just need to know how to run this against a list of servers. #!/usr/bin/perl use strict; use Expect; my $filename = "/var/tmp/expect_script.log"; my $ssh = Expect->new('ssh amagana@remotehost'); $ssh->debug(1); $ssh->log_file($filename, 'w'); $ssh->expect(60, 'Password:'); $ssh->send("mycurrentpassword\n"); $ssh->expect(60, '$'); $ssh->send("su - root\n"); $ssh->expect(60, 'Password:'); $ssh->send("myrootpassword\n"); $ssh->expect(60, '#'); $ssh->send("passwd amagana\n"); $ssh->expect(60, 'New Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, 'Re-enter new Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, '#'); $ssh->send("exit\n"); $ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 2:37 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT Cc: exp...@li... Subject: RE: expect.pm not updating password Ugh, special characters... The password command should be giving you an error if there is something wrong with your input. Turn on the logging and see if you can catch an error. my $filename = "/var/tmp/expect_script.log"; $ssh->log_file($filename, 'w'); It also might be that you need to send a newline character when you send it the password command $ssh->send("passwd amagana\n"); If you are getting in as root then you are getting very close. -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 3:18 PM To: ESRY JR., DON Cc: exp...@li... Subject: RE: expect.pm not updating password It is still not changing my password is it because my password has some special characters? Should I escape the special characters? Oh by the way the logs on the remote solaris box say its successfully ssh'ing and su'ing to root but that's it and then I try on the remote box to use my new password but it is still taking my old password for amagana. I changed the script to get it this far: #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh amagana@remotehost;'); $ssh->debug(1); $ssh->expect(60, 'Password:'); $ssh->send("mycurrentpassword\n"); $ssh->expect(60, '$'); $ssh->send("su - root\n"); $ssh->expect(60, 'Password:'); $ssh->send("myrootpassword\n"); $ssh->expect(60, '#'); $ssh->send("passwd amagana"); $ssh->expect(60, 'New Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, 'Re-enter new Password:'); $ssh->send("mynewpassword\n"); $ssh->send("exit\n"); $ssh->close(); On the target remote solaris server: Accepted keyboard-interactive for amagana from x.x.x.x port xxxxx ssh2 'su root' succeeded for amagana on /dev/pts/3 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 1:54 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password That looks like it worked. Did it change your password? A couple of things that might be helpful for you. I'm not sure that you really want that newline character in your first pattern match right after you set the debug value $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); I think you should try: $ssh->expect("Password:"); $ssh->send("mycurrentpassword\n"); You can have it log everything to file by inserting something like: my $filename = "/var/tmp/expect_script.log"; $ssh->log_file($filename); # this will keep old data and append new to the end Or $ssh->log_file($filename, 'w'); # this will wipe out old data from previous runs I think there is an stty setting you can play around with so that you can see what the password command suppresses. Maybe it is stty -echo but you will have to login and get the shell prompt before you can send this command. -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 1:53 PM To: ESRY JR., DON; exp...@li... Subject: RE: expect.pm not updating password Okay thank you for your attention I have turned on debugging to 1 like this $ssh->debug(1); and this is what I get. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:\x{a}') called at ./tester-a line 8 Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '$') called at ./tester-a line 10 mypassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:') called at ./tester-a line 12 su - root Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '#') called at ./tester-a line 14 rootpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'New Password:\x{a}') called at ./tester-a line 16 passwd amagana Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Re-enter new Password:\x{a}') called at ./tester-a line 18 mynewpassword Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x89c0390)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x89c0390)') called at ./tester-a line 0 eval {...} called at ./tester-a line 0 spawn id(3) closed. Pid 1218 of spawn id(3) terminated, Status: 0x01 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 11:15 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, > strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the >> wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who >> maintain a >> traditional set of feature patches against the released tarballs, >> nicely organized for future contribution. > > Folks had months of warning that this was going to happen. And, > frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: ESRY JR., D. <de...@at...> - 2015-03-31 19:38:01
|
Ugh, special characters... The password command should be giving you an error if there is something wrong with your input. Turn on the logging and see if you can catch an error. my $filename = "/var/tmp/expect_script.log"; $ssh->log_file($filename, 'w'); It also might be that you need to send a newline character when you send it the password command $ssh->send("passwd amagana\n"); If you are getting in as root then you are getting very close. -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 3:18 PM To: ESRY JR., DON Cc: exp...@li... Subject: RE: expect.pm not updating password It is still not changing my password is it because my password has some special characters? Should I escape the special characters? Oh by the way the logs on the remote solaris box say its successfully ssh'ing and su'ing to root but that's it and then I try on the remote box to use my new password but it is still taking my old password for amagana. I changed the script to get it this far: #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh amagana@remotehost;'); $ssh->debug(1); $ssh->expect(60, 'Password:'); $ssh->send("mycurrentpassword\n"); $ssh->expect(60, '$'); $ssh->send("su - root\n"); $ssh->expect(60, 'Password:'); $ssh->send("myrootpassword\n"); $ssh->expect(60, '#'); $ssh->send("passwd amagana"); $ssh->expect(60, 'New Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, 'Re-enter new Password:'); $ssh->send("mynewpassword\n"); $ssh->send("exit\n"); $ssh->close(); On the target remote solaris server: Accepted keyboard-interactive for amagana from x.x.x.x port xxxxx ssh2 'su root' succeeded for amagana on /dev/pts/3 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 1:54 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password That looks like it worked. Did it change your password? A couple of things that might be helpful for you. I'm not sure that you really want that newline character in your first pattern match right after you set the debug value $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); I think you should try: $ssh->expect("Password:"); $ssh->send("mycurrentpassword\n"); You can have it log everything to file by inserting something like: my $filename = "/var/tmp/expect_script.log"; $ssh->log_file($filename); # this will keep old data and append new to the end Or $ssh->log_file($filename, 'w'); # this will wipe out old data from previous runs I think there is an stty setting you can play around with so that you can see what the password command suppresses. Maybe it is stty -echo but you will have to login and get the shell prompt before you can send this command. -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 1:53 PM To: ESRY JR., DON; exp...@li... Subject: RE: expect.pm not updating password Okay thank you for your attention I have turned on debugging to 1 like this $ssh->debug(1); and this is what I get. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:\x{a}') called at ./tester-a line 8 Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '$') called at ./tester-a line 10 mypassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:') called at ./tester-a line 12 su - root Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '#') called at ./tester-a line 14 rootpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'New Password:\x{a}') called at ./tester-a line 16 passwd amagana Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Re-enter new Password:\x{a}') called at ./tester-a line 18 mynewpassword Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x89c0390)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x89c0390)') called at ./tester-a line 0 eval {...} called at ./tester-a line 0 spawn id(3) closed. Pid 1218 of spawn id(3) terminated, Status: 0x01 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 11:15 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, > strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the >> wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who >> maintain a >> traditional set of feature patches against the released tarballs, >> nicely organized for future contribution. > > Folks had months of warning that this was going to happen. And, > frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-31 19:18:31
|
It is still not changing my password is it because my password has some special characters? Should I escape the special characters? Oh by the way the logs on the remote solaris box say its successfully ssh'ing and su'ing to root but thats it and then I try on the remote box to use my new password but it is still taking my old password for amagana. I changed the script to get it this far: #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh amagana@remotehost;'); $ssh->debug(1); $ssh->expect(60, 'Password:'); $ssh->send("mycurrentpassword\n"); $ssh->expect(60, '$'); $ssh->send("su - root\n"); $ssh->expect(60, 'Password:'); $ssh->send("myrootpassword\n"); $ssh->expect(60, '#'); $ssh->send("passwd amagana"); $ssh->expect(60, 'New Password:'); $ssh->send("mynewpassword\n"); $ssh->expect(60, 'Re-enter new Password:'); $ssh->send("mynewpassword\n"); $ssh->send("exit\n"); $ssh->close(); On the target remote solaris server: Accepted keyboard-interactive for amagana from x.x.x.x port xxxxx ssh2 'su root' succeeded for amagana on /dev/pts/3 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 1:54 PM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password That looks like it worked. Did it change your password? A couple of things that might be helpful for you. I'm not sure that you really want that newline character in your first pattern match right after you set the debug value $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); I think you should try: $ssh->expect("Password:"); $ssh->send("mycurrentpassword\n"); You can have it log everything to file by inserting something like: my $filename = "/var/tmp/expect_script.log"; $ssh->log_file($filename); # this will keep old data and append new to the end Or $ssh->log_file($filename, 'w'); # this will wipe out old data from previous runs I think there is an stty setting you can play around with so that you can see what the password command suppresses. Maybe it is stty -echo but you will have to login and get the shell prompt before you can send this command. -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 1:53 PM To: ESRY JR., DON; exp...@li... Subject: RE: expect.pm not updating password Okay thank you for your attention I have turned on debugging to 1 like this $ssh->debug(1); and this is what I get. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:\x{a}') called at ./tester-a line 8 Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '$') called at ./tester-a line 10 mypassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:') called at ./tester-a line 12 su - root Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '#') called at ./tester-a line 14 rootpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'New Password:\x{a}') called at ./tester-a line 16 passwd amagana Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Re-enter new Password:\x{a}') called at ./tester-a line 18 mynewpassword Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x89c0390)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x89c0390)') called at ./tester-a line 0 eval {...} called at ./tester-a line 0 spawn id(3) closed. Pid 1218 of spawn id(3) terminated, Status: 0x01 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 11:15 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, > strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the >> wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who >> maintain a >> traditional set of feature patches against the released tarballs, >> nicely organized for future contribution. > > Folks had months of warning that this was going to happen. And, > frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: ESRY JR., D. <de...@at...> - 2015-03-31 18:54:42
|
That looks like it worked. Did it change your password? A couple of things that might be helpful for you. I'm not sure that you really want that newline character in your first pattern match right after you set the debug value $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); I think you should try: $ssh->expect("Password:"); $ssh->send("mycurrentpassword\n"); You can have it log everything to file by inserting something like: my $filename = "/var/tmp/expect_script.log"; $ssh->log_file($filename); # this will keep old data and append new to the end Or $ssh->log_file($filename, 'w'); # this will wipe out old data from previous runs I think there is an stty setting you can play around with so that you can see what the password command suppresses. Maybe it is stty -echo but you will have to login and get the shell prompt before you can send this command. -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 1:53 PM To: ESRY JR., DON; exp...@li... Subject: RE: expect.pm not updating password Okay thank you for your attention I have turned on debugging to 1 like this $ssh->debug(1); and this is what I get. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:\x{a}') called at ./tester-a line 8 Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '$') called at ./tester-a line 10 mypassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:') called at ./tester-a line 12 su - root Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '#') called at ./tester-a line 14 rootpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'New Password:\x{a}') called at ./tester-a line 16 passwd amagana Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Re-enter new Password:\x{a}') called at ./tester-a line 18 mynewpassword Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x89c0390)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x89c0390)') called at ./tester-a line 0 eval {...} called at ./tester-a line 0 spawn id(3) closed. Pid 1218 of spawn id(3) terminated, Status: 0x01 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 11:15 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, > strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the >> wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who >> maintain a >> traditional set of feature patches against the released tarballs, >> nicely organized for future contribution. > > Folks had months of warning that this was going to happen. And, > frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-31 18:13:39
|
My script is not updating my password on the remote Solaris server and I am a novice. [root@52wwyk-as-1405 amagana]# perl -w ./tester-a Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1f98a3a0)', 'Password:\x{a}') called at ./tester-a line 8 Argument "Password:\n" isn't numeric in subtraction (-) at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 641. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1f98a3a0)', '$') called at ./tester-a line 10 Argument "$" isn't numeric in subtraction (-) at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 641. mycurrentpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1f98a3a0)', 'Password:') called at ./tester-a line 12 Argument "Password:" isn't numeric in subtraction (-) at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 641. su - root Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1f98a3a0)', '#') called at ./tester-a line 14 Argument "#" isn't numeric in subtraction (-) at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 641. myrootpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1f98a3a0)', 'New Password:\x{a}') called at ./tester-a line 16 Argument "New Password:\n" isn't numeric in subtraction (-) at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 641. passwd amagana Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x1f98a3a0)', 'Re-enter new Password:\x{a}') called at ./tester-a line 18 Argument "Re-enter new Password:\n" isn't numeric in subtraction (-) at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 641. mynewpassword Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x1f98a3a0)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x1f98a3a0)') called at ./tester-a line 0 eval {...} called at ./tester-a line 0 spawn id(3) closed. Pid 1385 of spawn id(3) terminated, Status: 0x01 [root@52wwyk-as-1405 amagana]# //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: exp...@li... [mailto:exp...@li...] Sent: Tuesday, March 31, 2015 11:30 AM To: exp...@li... Subject: Expectperl-discuss Digest, Vol 45, Issue 5 Send Expectperl-discuss mailing list submissions to exp...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/expectperl-discuss or, via email, send a message with subject or body 'help' to exp...@li... You can reach the person managing the list at exp...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Expectperl-discuss digest..." Today's Topics: 1. Re: expect.pm script (MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT) 2. expect.pm not updating password (MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT) 3. Re: expect.pm not updating password (ESRY JR., DON) ---------------------------------------------------------------------- Message: 1 Date: Fri, 27 Mar 2015 21:49:10 +0000 From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...> Subject: Re: [Expectperl-discuss] expect.pm script To: Salvador Fandino <sfa...@ya...>, "exp...@li..." <exp...@li...> Message-ID: <6AB...@52...> Content-Type: text/plain; charset="utf-8" I ran this script "parallel_passwd.pl" from a linux box and I wanted to change my password on a solaris 10 server but after I enter the old password and new password I get nothing back, not even a timeout or error. I run the perl script like this: perl ./parallel_passwd.pl -l myloginname remoteserver //SIGNED// Andy Maga?a UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 9:59 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" > <and...@us...> > To: Salvador Fandino <sfa...@ya...>; > "exp...@li..." > <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 3:38 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > This change_passwd.pl script looks like what I need can you help me > modify it to be a usable script? You may nned to change the regular expresions passed to the answer_passwd sub to match the prompt used in the target systems. Otherwise, the script works as is. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3357 bytes Desc: not available ------------------------------ Message: 2 Date: Tue, 31 Mar 2015 16:01:20 +0000 From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...> Subject: [Expectperl-discuss] expect.pm not updating password To: "exp...@li..." <exp...@li...> Message-ID: <6AB...@52...> Content-Type: text/plain; charset="iso-8859-1" I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Maga?a UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who maintain a >> traditional set of feature patches against the released tarballs, nicely >> organized for future contribution. > > Folks had months of warning that this was going to happen. And, frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3357 bytes Desc: not available ------------------------------ Message: 3 Date: Tue, 31 Mar 2015 16:15:12 +0000 From: "ESRY JR., DON" <de...@at...> Subject: Re: [Expectperl-discuss] expect.pm not updating password To: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...>, "exp...@li..." <exp...@li...> Message-ID: <4AC...@GA...> Content-Type: text/plain; charset="iso-8859-1" I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Maga?a UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who maintain a >> traditional set of feature patches against the released tarballs, nicely >> organized for future contribution. > > Folks had months of warning that this was going to happen. And, frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** ------------------------------ ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ------------------------------ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss End of Expectperl-discuss Digest, Vol 45, Issue 5 ************************************************* |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-31 17:52:50
|
Okay thank you for your attention I have turned on debugging to 1 like this $ssh->debug(1); and this is what I get. Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:\x{a}') called at ./tester-a line 8 Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '$') called at ./tester-a line 10 mypassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Password:') called at ./tester-a line 12 su - root Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', '#') called at ./tester-a line 14 rootpassword Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'New Password:\x{a}') called at ./tester-a line 16 passwd amagana Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0x89c0390)', 'Re-enter new Password:\x{a}') called at ./tester-a line 18 mynewpassword Closing spawn id(3). at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1431 Expect::hard_close('Expect=GLOB(0x89c0390)') called at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 1621 Expect::DESTROY('Expect=GLOB(0x89c0390)') called at ./tester-a line 0 eval {...} called at ./tester-a line 0 spawn id(3) closed. Pid 1218 of spawn id(3) terminated, Status: 0x01 //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: ESRY JR., DON [mailto:de...@at...] Sent: Tuesday, March 31, 2015 11:15 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: RE: expect.pm not updating password I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, > strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the >> wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who >> maintain a >> traditional set of feature patches against the released tarballs, >> nicely organized for future contribution. > > Folks had months of warning that this was going to happen. And, > frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: ESRY JR., D. <de...@at...> - 2015-03-31 16:29:40
|
I don't see a question in your email. What do you see on your screen when you run it? -----Original Message----- From: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT [mailto:and...@us...] Sent: Tuesday, March 31, 2015 12:01 PM To: exp...@li... Subject: [Expectperl-discuss] expect.pm not updating password I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who maintain a >> traditional set of feature patches against the released tarballs, nicely >> organized for future contribution. > > Folks had months of warning that this was going to happen. And, frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-31 16:01:35
|
I am a novice and have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin@remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:ope...@op...] On Behalf Of ope...@op... Sent: Wednesday, March 18, 2015 12:36 PM To: ope...@op... Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to ope...@op... To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to ope...@op... You can reach the person managing the list at ope...@op... When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-...@wi...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@wi...> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Wal...@ma...> To: ope...@op... Subject: Re: [openssl-users] base64 decode in C Message-ID: <550...@ma...> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Mat...@nc...> To: <ope...@op...> Subject: Re: [openssl-users] [openssl-announce] Forthcoming OpenSSL releases Message-ID: <550...@nc...> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who maintain a >> traditional set of feature patches against the released tarballs, nicely >> organized for future contribution. > > Folks had months of warning that this was going to happen. And, frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <sc...@xy...> To: "ope...@op..." <ope...@op...> Subject: Re: [openssl-users] base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8@XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:ope...@op...] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: [openssl-users] base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Wal...@ma...<mailto:Wal...@ma...>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list ope...@op... https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-27 21:49:26
|
I ran this script "parallel_passwd.pl" from a linux box and I wanted to change my password on a solaris 10 server but after I enter the old password and new password I get nothing back, not even a timeout or error. I run the perl script like this: perl ./parallel_passwd.pl -l myloginname remoteserver //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 9:59 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" > <and...@us...> > To: Salvador Fandino <sfa...@ya...>; > "exp...@li..." > <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 3:38 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > This change_passwd.pl script looks like what I need can you help me > modify it to be a usable script? You may nned to change the regular expresions passed to the answer_passwd sub to match the prompt used in the target systems. Otherwise, the script works as is. |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-27 18:57:30
|
just to be sure I would replace the ReadLine 0 with mysecretpassword my $old = ReadLine 0, $tty; print $tty "\nNew password: "; my $new = ReadLine 0, $tty; print $tty "\nRetype new password: "; my $new_bis = ReadLine 0, $tty; print $tty "\n"; ReadMode 0, $tty; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 10:29 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...> > To: Salvador Fandino <sfa...@ya...>; "exp...@li..." <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 4:16 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > I looked at the parallel script and where would I put the old and new passwords? in $old and $new? |
From: Salvador F. <sfa...@ya...> - 2015-03-27 15:31:59
|
----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...> > To: Salvador Fandino <sfa...@ya...>; "exp...@li..." <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 4:16 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > I looked at the parallel script and where would I put the old and new passwords? in $old and $new? |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-27 15:25:46
|
How can I stick a user into the script like me amagana into the script? //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 9:59 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" > <and...@us...> > To: Salvador Fandino <sfa...@ya...>; > "exp...@li..." > <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 3:38 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > This change_passwd.pl script looks like what I need can you help me > modify it to be a usable script? You may nned to change the regular expresions passed to the answer_passwd sub to match the prompt used in the target systems. Otherwise, the script works as is. |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-27 15:17:09
|
Salvador, I looked at the parallel script and where would I put the old and new passwords? Thanks, ReadMode 2, $tty; print $tty "Old password: "; my $old = ReadLine 0, $tty; print $tty "\nNew password: "; my $new = ReadLine 0, $tty; print $tty "\nRetype new password: "; my $new_bis = ReadLine 0, $tty; print $tty "\n"; ReadMode 0, $tty; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 9:59 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" > <and...@us...> > To: Salvador Fandino <sfa...@ya...>; > "exp...@li..." > <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 3:38 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > This change_passwd.pl script looks like what I need can you help me > modify it to be a usable script? You may nned to change the regular expresions passed to the answer_passwd sub to match the prompt used in the target systems. Otherwise, the script works as is. |
From: Salvador F. <sfa...@ya...> - 2015-03-27 15:01:51
|
----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" <and...@us...> > To: Salvador Fandino <sfa...@ya...>; "exp...@li..." <exp...@li...> > Cc: > Sent: Friday, March 27, 2015 3:38 PM > Subject: RE: [Expectperl-discuss] expect.pm script > > Salvador, > > This change_passwd.pl script looks like what I need can you help me modify it to > be a usable script? You may nned to change the regular expresions passed to the answer_passwd sub to match the prompt used in the target systems. Otherwise, the script works as is. |
From: MAGANA, A. S I C. U. A. 72 ABW/S. <and...@us...> - 2015-03-27 14:38:28
|
Salvador, This change_passwd.pl script looks like what I need can you help me modify it to be a usable script? Thanks, #!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; use Expect; select STDOUT; $| = 1; select STDERR; $| = 1; @ARGV == 3 or die <<USAGE; Usage: $0 host old_password new_password USAGE my ($host, $old, $new) = @ARGV; my $timeout = 20; my $debug = 0; my $ssh = Net::OpenSSH->new($host, password => $old); my ($pty, $pid) = $ssh->open2pty("passwd") or die "open2pty failed: " . $ssh->error . "\n"; my $expect = Expect->init($pty); $expect->raw_pty(1); $debug and $expect->log_user(1); sub answer_passwd { my ($pattern, $pass) = @_; $debug and print "waiting for password prompt\n"; $expect->expect($timeout, -re => $pattern) or die "expect failed\n"; $debug and print "prompt seen\n"; $expect->send("$pass\n"); $debug and print "password sent\n"; $expect->expect($timeout, "\n") or die "bad password\n"; } answer_passwd('current.*:', $old); answer_passwd('new.*:', $new); answer_passwd('new.*:', $new); $expect->expect($timeout, "success") or die "Failed!\n"; print "password updated\n"; //SIGNED// Andy Magaña UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: Salvador Fandino [mailto:sfa...@ya...] Sent: Friday, March 27, 2015 1:34 AM To: MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT; exp...@li... Subject: Re: [Expectperl-discuss] expect.pm script ----- Original Message ----- > From: "MAGANA, ANDREAS S I CTR USAF AFMC 72 ABW/SCOOT" > <and...@us...> > To: "exp...@li..." > <exp...@li...> > Cc: > Sent: Thursday, March 26, 2015 8:08 PM > Subject: [Expectperl-discuss] expect.pm script > > Need help with trying to create a expect.pm script so that I can > change passwords on my Solaris-10 and 9 servers. I am using this > expect.pm script from my Linux server I also have Net::OpenSSH but I am not using right now. > Any examples would help. Net::OpenSSH distribution contains a sample script that does exactly that: https://github.com/salva/p5-Net-OpenSSH/blob/master/sample/change_passwd.pl And then Net::OpenSSH::Parallel distribution contains a similar script that is able to change the password in a bunch of hosts in parallel: https://github.com/salva/p5-Net-OpenSSH-Parallel/blob/master/sample/parallel_passwd.pl |