From: Ian Campbell <ian.campbell@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH v4 02/11] osstest: add routine to execute ssh with password
Date: Thu, 19 Mar 2015 14:58:04 +0000 [thread overview]
Message-ID: <1426777084.21742.18.camel@citrix.com> (raw)
In-Reply-To: <1424276291-6872-3-git-send-email-roger.pau@citrix.com>
On Wed, 2015-02-18 at 17:18 +0100, Roger Pau Monne wrote:
> This is needed when bootstrapping FreeBSD, since the installer has ssh
> enabled with the root password set to 'root' by default.
I think the commit message should mention the refactoring done WRT
$stdout vs $child_sub (i.e. you are replacing the boolean with a hook,
where the current invocations do the same thing as the old boolean used
to cause).
I also think the trick with SSH_ASKPASS deserves a brief mention.
> @@ -585,9 +585,42 @@ sub tcmd { # $tcmd will be put between '' but not escaped
> sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
> sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
>
> +sub target_cmd_root_with_password {
> + my ($ho,$tcmd,$timeout,$password, $disable_hosts) = @_;
> + my $temp_name = "tmp/t.ssh-password-helper.$flight.$job";
> +
> + open(my $temp_fh, '>', $temp_name)
> + or die "Cannot open $temp_name: $!";
> + print $temp_fh "#!/bin/sh\n\necho \"$password\"\n"
> + or die "Cannot write to $temp_name: $!";
> + chmod 0755, $temp_name
> + or die "Cannot chmod $temp_name: $!";
> + close $temp_fh
> + or die "Cannot close $temp_name: $!";
> +
> + my $child_sub = sub {
> + $ENV{DISPLAY} = ":0";
? This seems like it must be pretty magic, in some terribly scary way...
> + $ENV{SSH_ASKPASS} = "tmp/t.ssh-password-helper.$flight.$job";
> + setsid or die "Can't start a new session: $!";
> + };
> +
> + my $ssh_opts = [qw(-o BatchMode=no
> + -o PasswordAuthentication=yes
> + -o ChallengeResponseAuthentication=yes),
> + @{ sshopts($disable_hosts) }];
> +
> + tcmdex($timeout,$child_sub,
> + 'ssh', $ssh_opts,
> + sshuho("root",$ho), $tcmd);
> +
> + unlink $temp_fh;
> +}
> +
> sub tcmdout {
> my $stdout= IO::File::new_tmpfile();
> - tcmd($stdout,@_);
> + my $stdout_sub = sub { open STDOUT, '>&', $stdout
> + or die "STDOUT $stdout $!"; };
> + tcmd($stdout_sub,@_);
> $stdout->seek(0,0) or die "$stdout $!";
> my $r;
> { local ($/) = undef;
next prev parent reply other threads:[~2015-03-19 14:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 16:18 [PATCH v4 00/11] osstest: add a FreeBSD host Roger Pau Monne
2015-02-18 16:18 ` [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file Roger Pau Monne
2015-03-19 14:52 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 02/11] osstest: add routine to execute ssh with password Roger Pau Monne
2015-03-19 14:58 ` Ian Campbell [this message]
2015-02-18 16:18 ` [PATCH v4 03/11] osstest: store a path runvar for built_stash_file Roger Pau Monne
2015-03-19 15:01 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 04/11] osstest: add support for installing bare metal FreeBSD Roger Pau Monne
2015-03-19 15:13 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 05/11] osstest: add script for building custom mfsBSD images Roger Pau Monne
2015-03-19 15:16 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 06/11] osstest: fix ts-build-check to work with freebsd_buildjob Roger Pau Monne
2015-02-18 16:18 ` [PATCH v4 07/11] osstest: add freebsd installer update script Roger Pau Monne
2015-02-18 16:18 ` [PATCH v4 08/11] osstest: prepare FreeBSD host for Xen build Roger Pau Monne
2015-03-19 15:18 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 09/11] osstest: make ts-xen-build work on FreeBSD Roger Pau Monne
2015-03-19 15:20 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 10/11] osstest: add a script to install Xen on FreeBSD hosts Roger Pau Monne
2015-03-19 15:24 ` Ian Campbell
2015-02-18 16:18 ` [PATCH v4 11/11] osstest: add FreeBSD build recipe Roger Pau Monne
2015-03-19 15:31 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426777084.21742.18.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.