1.\" $NetBSD: creds_msdos.8,v 1.1 2019/06/12 09:03:32 mrg Exp $ 2.\" 3.\" Copyright (c) 2019 Matthew R. Green 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. The name of the author may not be used to endorse or promote products 15.\" derived from this software without specific prior written permission. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\" 29.Dd June 10, 2019 30.Dt CREDS_MSDOS 8 31.Os 32.Sh NAME 33.Nm creds_msdos 34.Nd automatically add login credentials from MSDOS partition 35.Sh SYNOPSIS 36.Nm 37.Ar start 38.Sh DESCRIPTION 39The 40.Nm 41rc.d script allows automatic addition of login credentials during boot 42using a special file found on the MSDOS partition of a bootable image. 43This script is not distributed with the normal system and is only 44included with pre-installed bootable images. 45The goal is to allow remote access of the system without having to 46edit the primary root file system (which may not be accessible from 47the host the image is being written from), but place this information 48in the MSDOS partition that most platforms can easily access. 49.Pp 50Typically, an installable image (such as 51.Pa arm64.img ) 52is written to an SD card or similar media, and has both a native FFS 53partition as well as an MSDOS partition for booting. 54If this script is enabled and has been pointed at the boot partition 55it will inspect the file 56.Pa creds.txt 57for any credentials to be added to the system. 58.Pp 59These are the supported options in the credentials files: 60.Bl -tag -compact -width "sshkeyfilepl" -offset indent 61.It Sy sshkeyfile Ar user Ar keyfile 62.It Sy sshkey Ar user Ar keystring 63.It Sy useraddpwhash Ar user Ar pwhash 64.It Sy useradd Ar user Ar password 65.El 66.Pp 67In all cases 68.Ar user 69is the username to be added, and the user will be 70added to the 71.Dq wheel 72group. 73.Pp 74The sshkeyfile method looks in the MSDOS boot partition for 75the specified file and merges ssh keys from this file into 76.Ar user Ap s 77.Pa ~/.ssh/authorized_keys 78file. 79.Pp 80The sshkey method adds the 81.Ar keystring 82to the 83.Ar user Ap s 84.Pa ~/.ssh/authorized_keys 85file. 86.Pp 87The useraddpwhash method uses 88.Ar pwhash 89as the 90.Ar users Ap s 91password hash. 92.Pp 93The above three methods are the preferred methods. 94.Pp 95For the useradd method 96.Ar password 97is an unencrypted raw password that will be hashed and added to the system. 98This method is not recommended as it leaves unencrypted passwords 99around until such time that the script runs. 100If this method is used then the 101.Pa creds.txt 102file will be shredded and deleted using 103.Dq rm -P 104after the credentials are updated. 105.Sh FILES 106.Pa /boot/creds.txt 107.Sh SEE ALSO 108.Xr pwhash 1 , 109.Xr rm 1 , 110.Xr ssh 1 , 111.Xr ssh_config 5 , 112.Xr mount_msdos 8 , 113.Xr sshd 8 , 114.Xr useradd 8 115.Sh HISTORY 116The 117.Nm 118script appeared in 119.Nx 9.0 . 120.Sh AUTHORS 121.An Matthew R. Green Aq Mt mrg@eterna.com.au . 122