From patchwork Thu Aug 15 16:09:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jakob L. Kreuze" X-Patchwork-Id: 14936 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 54868172DD; Thu, 15 Aug 2019 17:10:32 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 15B63172DB for ; Thu, 15 Aug 2019 17:10:32 +0100 (BST) Received: from localhost ([::1]:43818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIKd-0006tT-9C for patchwork@mira.cbaines.net; Thu, 15 Aug 2019 12:10:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43627) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIKI-0006n1-T9 for guix-patches@gnu.org; Thu, 15 Aug 2019 12:10:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIKA-0007jM-BP for guix-patches@gnu.org; Thu, 15 Aug 2019 12:10:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hyIKA-0007j2-5i for guix-patches@gnu.org; Thu, 15 Aug 2019 12:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hyIK9-0002O9-R0 for guix-patches@gnu.org; Thu, 15 Aug 2019 12:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37039] [PATCH] machine: Use 'become-command'. Resent-From: zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Aug 2019 16:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37039 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37039@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15658853779142 (code B ref -1); Thu, 15 Aug 2019 16:10:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Aug 2019 16:09:37 +0000 Received: from localhost ([127.0.0.1]:52328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hyIJl-0002NN-7s for submit@debbugs.gnu.org; Thu, 15 Aug 2019 12:09:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:47199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hyIJj-0002NG-QP for submit@debbugs.gnu.org; Thu, 15 Aug 2019 12:09:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43559) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyIJe-0005md-8B for guix-patches@gnu.org; Thu, 15 Aug 2019 12:09:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyIJX-0007AU-Bm for guix-patches@gnu.org; Thu, 15 Aug 2019 12:09:27 -0400 Received: from mx.sdf.org ([205.166.94.20]:61839) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyIJX-00079K-3a for guix-patches@gnu.org; Thu, 15 Aug 2019 12:09:23 -0400 Received: from Upsilon (tor2.anonymizer.ccc.de [217.115.10.132]) (authenticated (0 bits)) by mx.sdf.org (8.15.2/8.14.5) with ESMTPSA id x7FG9Bl6006321 (using TLSv1.2 with cipher AES256-GCM-SHA384 (256 bits) verified NO) for ; Thu, 15 Aug 2019 16:09:19 GMT From: zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) Date: Thu, 15 Aug 2019 12:09:11 -0400 Message-ID: <87o90qe7h4.fsf@sdf.lonestar.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/machine/ssh.scm (managed-host-remote-eval): Pass an appropriate 'become-command' to 'remote-eval'. * guix/ssh.scm (remote-authorize-signing-key): Add optional 'become-command' argument. All callers changed. --- gnu/machine/ssh.scm | 7 +++++-- guix/ssh.scm | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index ac3aa3e370..aafe0ccf41 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -126,7 +126,9 @@ an environment type of 'managed-host." #:build-locally? (machine-ssh-configuration-build-locally? config) #:system - (machine-ssh-configuration-system config)))) + (machine-ssh-configuration-system config) + #:become-command + (machine-become-command machine)))) ;;; @@ -377,7 +379,8 @@ have you run 'guix archive --generate-key?'") (lambda (port) (string->canonical-sexp (get-string-all port)))) - (machine-ssh-session machine))) + (machine-ssh-session machine) + (machine-become-command machine))) (mlet %store-monad ((_ (check-deployment-sanity machine)) (boot-parameters (machine-boot-parameters machine))) (let* ((os (machine-operating-system machine)) diff --git a/guix/ssh.scm b/guix/ssh.scm index 24834c6f68..7bc499a2fe 100644 --- a/guix/ssh.scm +++ b/guix/ssh.scm @@ -302,7 +302,7 @@ the machine on the other end of SESSION." (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system)) session)) -(define (remote-authorize-signing-key key session) +(define* (remote-authorize-signing-key key session #:optional become-command) "Send KEY, a canonical sexp containing a public key, over SESSION and add it to the system ACL file if it has not yet been authorized." (inferior-remote-eval @@ -321,7 +321,8 @@ to the system ACL file if it has not yet been authorized." (mkdir-p (dirname %acl-file)) (with-atomic-file-output %acl-file (cut write-acl acl <>))))) - session)) + session + become-command)) (define* (send-files local files remote #:key