From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <aderumier@odiso.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id A096967CCB
 for <pve-devel@lists.proxmox.com>; Thu, 14 Jan 2021 09:46:30 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 958AD197AC
 for <pve-devel@lists.proxmox.com>; Thu, 14 Jan 2021 09:46:00 +0100 (CET)
Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com
 [IPv6:2a00:1450:4864:20::435])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id C026B19795
 for <pve-devel@lists.proxmox.com>; Thu, 14 Jan 2021 09:45:58 +0100 (CET)
Received: by mail-wr1-x435.google.com with SMTP id t30so4893848wrb.0
 for <pve-devel@lists.proxmox.com>; Thu, 14 Jan 2021 00:45:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=odiso-com.20150623.gappssmtp.com; s=20150623;
 h=message-id:subject:from:to:date:in-reply-to:references:user-agent
 :mime-version; bh=8Myjji1O/r6MfhuYgN5K+N017onxAu4y707w6LRXecU=;
 b=efSUtaT3iJoUiT1gO3/Ls/IJ+PspBqLjQl3qtjP2b4mpzMqUbbCXWtDYkPhVb6ul/d
 KPT7PbDVrwmdtT1kpQGXPtNhmgcZLYNy71uIuNJHdrr+WbeXB5lN9WoJRzpeaxebw2cv
 DPa2ej5VDnHGeycI5t61+jEbSqmANJfdbMVP8CP9KGoBxrq7WREusbSjzeuBAlvHNM68
 /X7sRvdV4Fy8WPjHT6TvZ9BOu047sgygCT475GMNluS+wqvo0aKtAKbI7E34YLQQ3CH2
 LItJw/0y1m+Sm1KlNjU/XoC0EH9ThQuhix37KpcXw8gTBxvrchfQ9qAcu9or1AvmJHCe
 bjXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to
 :references:user-agent:mime-version;
 bh=8Myjji1O/r6MfhuYgN5K+N017onxAu4y707w6LRXecU=;
 b=SEXjunImlqH6no7yajuaBNDnutznqFvHoiPiIdaB+q8hvUII/3H/VzA4l1s720SPUK
 WNnbq6UgR2vXxdZZczfHl7mAqAoH0DeL0nP5Lpm6WLgFajuQhLDIDUyg4zVhuyubagAt
 8Ev6l0j/VJEISeXeN1/AxkwlLYofteg2p/a9+h+6NgcqCwjtQXc0dnTaPLuT9qdnlrbU
 XwuVfRBDmLFwvy+anz8Ksw1vGuqfuGI51/3VKm4KVVYBLoAgdMkU0W6r/YmS0Ud5xI30
 x83Gwc7JRTW11B/UCyYxIkN5EzEzca2cPqu2pEnkWICpqKofpGjtBh3nYZ7Zz/3zNsTK
 veQw==
X-Gm-Message-State: AOAM531dxp++JVcQzFpk2eOfEABqZcLRV59s4pyTeJ824PuohDexaDfo
 M931pQE5iVtld4yAgkgpAHYttWuAWumD/Q9v
X-Google-Smtp-Source: ABdhPJxUIYRWwe6Y0pifA4Us7u5PF9Rpk5NPM2BvFwJrkbt8pioHR3UnT5Wl6qvuGpHr16fK2JS4FQ==
X-Received: by 2002:adf:a2ca:: with SMTP id t10mr6647745wra.370.1610613952176; 
 Thu, 14 Jan 2021 00:45:52 -0800 (PST)
Received: from ?IPv6:2a0a:1580:0:1::100c? (ovpn1.odiso.net.
 [2a0a:1580:2000::3f])
 by smtp.gmail.com with ESMTPSA id m18sm8518425wrw.43.2021.01.14.00.45.51
 for <pve-devel@lists.proxmox.com>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 14 Jan 2021 00:45:51 -0800 (PST)
Message-ID: <10aad3d47b2290b54d40a70939d28f4099d14116.camel@odiso.com>
From: aderumier@odiso.com
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Date: Thu, 14 Jan 2021 09:45:49 +0100
In-Reply-To: <cd71a89b-a1aa-d3c9-de11-d4972c1ff7a6@gilouweb.com>
References: <20210113090132.3889308-1-aderumier@odiso.com>
 <cd71a89b-a1aa-d3c9-de11-d4972c1ff7a6@gilouweb.com>
User-Agent: Evolution 3.38.3 
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.275 Adjusted score from AWL reputation of From: address
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 HTML_MESSAGE            0.001 HTML included in message
 RCVD_IN_DNSWL_NONE     -0.0001 Sender listed at https://www.dnswl.org/,
 no trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [cloudinit-reload.sh, proxmox.com]
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
Subject: Re: [pve-devel] [PATCH qemu-server] cloud-init: don't regenerate
 ssh hosts key on config change when vm is running
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 14 Jan 2021 08:46:30 -0000

> Hi,
> 
> There is something indeed annoying with that module, as I always end
> up
> adding ssh_deletekeys: false in a provisionned server, but I like
> that
> it does it the first time indeed…
> 
> Maybe we could let it be configurable though!

Yes, I don't known too much how to handle it at first boot only.

Maybe when we create a template, we could add an option like:
ssh_deleteys:true."
then remove it from vm config when vm start ? (and add in gui an option
to reset it to true manually ?)



i'm looking to use cloud-init to online change too, currently I'm able
to it with this udev rules

/etc/udev/rules.d/90-cloudinit.rules
ACTION=="change", SUBSYSTEM=="block", KERNEL=="sr[0-9]*",
ENV{ID_FS_LABEL}=="config-2", RUN+="/usr/local/bin/cloudinit-reload.sh"

/usr/local/bin/cloudinit-reload.sh
---------------------------------------------
#!/bin/bash

if test -f /tmp/cloudinitreload.lock; then
    rm /run/cloud-init/.instance-id
    rm /run/cloud-init/network-config-ready
    systemctl restart cloud-init-local.service
    systemctl restart cloud-init.service
    systemctl reload networking
    rm /tmp/cloudinitreload.lock
    exit 1
fi
touch /tmp/cloudinitreload.lock




Le mercredi 13 janvier 2021 à 17:40 +0100, Gilles Pietri a écrit :
> Le 13/01/2021 à 10:01, Alexandre Derumier a écrit :
> > Currently, we always regenerate sshkeys on any config change.
> > 
> > It should be done only before the first vm start, but currently
> > can't known that.
> > 
> > So, this patch only do it when vm is running.
> 
> Hi,
> 
> There is something indeed annoying with that module, as I always end
> up
> adding ssh_deletekeys: false in a provisionned server, but I like
> that
> it does it the first time indeed…
> 
> Maybe we could let it be configurable though!
> 
> Gilou
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel