From owner-freebsd-hackers@freebsd.org Thu Mar 12 18:29:30 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CAE0267DF2 for ; Thu, 12 Mar 2020 18:29:30 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48dcml6wymz4JQt for ; Thu, 12 Mar 2020 18:29:27 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 02CITHCo075690; Thu, 12 Mar 2020 11:29:17 -0700 (PDT) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 02CITGjQ075689; Thu, 12 Mar 2020 11:29:16 -0700 (PDT) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <202003121829.02CITGjQ075689@gndrsh.dnsmgr.net> Subject: Re: Allow to run SSHd in Installer (12.2 patch) In-Reply-To: To: Ruben Date: Thu, 12 Mar 2020 11:29:16 -0700 (PDT) CC: Ben RUBSON , freebsd-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 48dcml6wymz4JQt X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd-rwg@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd-rwg@gndrsh.dnsmgr.net X-Spamd-Result: default: False [-0.69 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.82)[-0.818,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; IP_SCORE(0.03)[ip: (0.13), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-0.81)[-0.810,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; FREEMAIL_CC(0.00)[gmx.com]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2020 18:29:30 -0000 I have been starting sshd from install media since 5.4 or so, here is my current method that should work on 11, 12 and 13: # This version for FreeBSD 11.0R, works for 12.0 too mkdir /tmp/ssh cp -p /etc/ssh/sshd_config /tmp/ssh echo 'PermitRootLogin yes' >> /tmp/ssh/sshd_config echo 'AllowGroups wheel' >> /tmp/ssh/sshd_config echo 'PermitEmptyPasswords yes' >> /tmp/ssh/sshd_config echo 'HostKey /tmp/ssh/ssh_host_rsa_key' >> /tmp/ssh/sshd_config echo 'HostKey /tmp/ssh/ssh_host_dsa_key' >> /tmp/ssh/sshd_config echo 'UsePAM no' >> /tmp/ssh/sshd_config echo 'PasswordAuthentication yes' >> /tmp/ssh/sshd_config ssh-keygen -t rsa -f /tmp/ssh/ssh_host_rsa_key -N '' ssh-keygen -t dsa -f /tmp/ssh/ssh_host_dsa_key -N '' /usr/sbin/sshd -f /tmp/ssh/sshd_config For those that "need" this feature today :-) Just drop to a shell after booting from install media, run the above commands, and you can get in. BEWARE, passwordless root login enabled! > Hi Ben, > > I'm not a FreeBSD developer (so not your targeted audience) but would > very much like to see this land in a release! > > Kind regards, > > Ruben > > On 3/10/20 4:07 PM, Ben RUBSON wrote: > >> On 2 Mar 2020, at 13:09, Ben RUBSON wrote: > >> > >> Hi, > >> > >> I've done some work to allow to connect to FreeBSD installer through SSH. > >> It can be useful for example if we have specific tasks to perform before installation, such as disks configuration etc... > >> Working through a SSH connection is much more convenient than in front of a console. > >> FreeBSD installer can then also be used as a rescue disk. > >> > >> To achieve this, I've modified FreeBSD installer, so that after having installed SSHd, if performs following configuration modifications : > >> - generate host keys into /var/ssh (as default /etc/ssh is not writable) ; > >> - only allow keys authentication ; > >> - allow root authentication ; > >> - read authorized_keys file from /var/ssh (as default homedirs are not writable). > >> > >> SSHd can then be started thanks to the installer shell : service sshd start > >> And a public key put into for example /var/ssh-keys/root/authorized_keys, thanks to fetch or whatever. > >> > >> Work is here : > >> https://github.com/freebsd/freebsd/pull/156 > >> Rather simple, and ready to be merged. > >> > >> This job is more than 2 years old, I would then really be glad if we could see this in 12.2 installation ISOs. > >> It would prevent me from having to modify the new ISO files to implement this patch. > > > > Any thoughts ? :) > > > > Thank you very much ! > > > > Ben > > > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > -- Rod Grimes rgrimes@freebsd.org