1*4a48b996Sgutteridge.\" $NetBSD: creds_msdos.8,v 1.6 2024/05/13 23:10:47 gutteridge Exp $ 21e5b60d0Smrg.\" 31e5b60d0Smrg.\" Copyright (c) 2019 Matthew R. Green 41e5b60d0Smrg.\" All rights reserved. 51e5b60d0Smrg.\" 61e5b60d0Smrg.\" Redistribution and use in source and binary forms, with or without 71e5b60d0Smrg.\" modification, are permitted provided that the following conditions 81e5b60d0Smrg.\" are met: 91e5b60d0Smrg.\" 1. Redistributions of source code must retain the above copyright 101e5b60d0Smrg.\" notice, this list of conditions and the following disclaimer. 111e5b60d0Smrg.\" 2. Redistributions in binary form must reproduce the above copyright 121e5b60d0Smrg.\" notice, this list of conditions and the following disclaimer in the 131e5b60d0Smrg.\" documentation and/or other materials provided with the distribution. 141e5b60d0Smrg.\" 151e5b60d0Smrg.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 161e5b60d0Smrg.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 171e5b60d0Smrg.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 181e5b60d0Smrg.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 191e5b60d0Smrg.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 201e5b60d0Smrg.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 211e5b60d0Smrg.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 221e5b60d0Smrg.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 231e5b60d0Smrg.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 241e5b60d0Smrg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 251e5b60d0Smrg.\" SUCH DAMAGE. 261e5b60d0Smrg.\" 271e5b60d0Smrg.Dd June 10, 2019 281e5b60d0Smrg.Dt CREDS_MSDOS 8 291e5b60d0Smrg.Os 301e5b60d0Smrg.Sh NAME 311e5b60d0Smrg.Nm creds_msdos 32*4a48b996Sgutteridge.Nd automatically add login credentials from MS-DOS partition 331e5b60d0Smrg.Sh SYNOPSIS 341e5b60d0Smrg.Nm 351e5b60d0Smrg.Ar start 361e5b60d0Smrg.Sh DESCRIPTION 371e5b60d0SmrgThe 381e5b60d0Smrg.Nm 391e5b60d0Smrgrc.d script allows automatic addition of login credentials during boot 40*4a48b996Sgutteridgeusing a special file found on the MS-DOS partition of a bootable image. 411e5b60d0SmrgThis script is not distributed with the normal system and is only 421e5b60d0Smrgincluded with pre-installed bootable images. 431e5b60d0SmrgThe goal is to allow remote access of the system without having to 441e5b60d0Smrgedit the primary root file system (which may not be accessible from 451e5b60d0Smrgthe host the image is being written from), but place this information 46*4a48b996Sgutteridgein the MS-DOS partition that most platforms can easily access. 471e5b60d0Smrg.Pp 481e5b60d0SmrgTypically, an installable image (such as 491e5b60d0Smrg.Pa arm64.img ) 501e5b60d0Smrgis written to an SD card or similar media, and has both a native FFS 51*4a48b996Sgutteridgepartition as well as an MS-DOS partition for booting. 521e5b60d0SmrgIf this script is enabled and has been pointed at the boot partition 531e5b60d0Smrgit will inspect the file 541e5b60d0Smrg.Pa creds.txt 551e5b60d0Smrgfor any credentials to be added to the system. 561e5b60d0Smrg.Pp 57ffc6a460SuweThe following list gives the supported options in the credentials files. 581e5b60d0SmrgIn all cases 591e5b60d0Smrg.Ar user 60ffc6a460Suweis the username to be created, and the user will be added to the 61d8f36fecSuwe.Ql wheel 621e5b60d0Smrggroup. 63ffc6a460Suwe.Bl -tag -width Ic 64ffc6a460Suwe.\" 65ffc6a460Suwe.It Ic sshkeyfile Ar user Ar keyfile 66ffc6a460SuweLook for the 67ffc6a460Suwe.Ar keyfile 68*4a48b996Sgutteridgein the MS-DOS boot partition and merge ssh keys from this file into user's 691e5b60d0Smrg.Pa ~/.ssh/authorized_keys 701e5b60d0Smrgfile. 71ffc6a460Suwe.\" 72ffc6a460Suwe.It Ic sshkey Ar user Ar keystring 73ffc6a460SuweAdd the 741e5b60d0Smrg.Ar keystring 75ffc6a460Suweto the user's 761e5b60d0Smrg.Pa ~/.ssh/authorized_keys 771e5b60d0Smrgfile. 78ffc6a460Suwe.\" 79ffc6a460Suwe.It Ic useraddpwhash Ar user Ar pwhash 80ffc6a460SuweUse 811e5b60d0Smrg.Ar pwhash 82ffc6a460Suweas the users's password hash. 83ffc6a460Suwe.\" 84ffc6a460Suwe.It Ic useradd Ar user Ar password 85ffc6a460SuweUse 861e5b60d0Smrg.Ar password 87ffc6a460Suweas the users's unencrypted raw password that will be hashed. 88ffc6a460Suwe.Pp 89ffc6a460SuweThis method is 90ffc6a460Suwe.Em not recommended 91ffc6a460Suweas it leaves unencrypted passwords around until such time that the script runs. 921e5b60d0SmrgIf this method is used then the 931e5b60d0Smrg.Pa creds.txt 941e5b60d0Smrgfile will be shredded and deleted using 95d8f36fecSuwe.Ql rm -P 961e5b60d0Smrgafter the credentials are updated. 97ffc6a460Suwe.El 981e5b60d0Smrg.Sh FILES 991e5b60d0Smrg.Pa /boot/creds.txt 1001e5b60d0Smrg.Sh SEE ALSO 1011e5b60d0Smrg.Xr pwhash 1 , 1021e5b60d0Smrg.Xr rm 1 , 1031e5b60d0Smrg.Xr ssh 1 , 1041e5b60d0Smrg.Xr ssh_config 5 , 1051e5b60d0Smrg.Xr mount_msdos 8 , 1061e5b60d0Smrg.Xr sshd 8 , 1071e5b60d0Smrg.Xr useradd 8 1081e5b60d0Smrg.Sh HISTORY 1091e5b60d0SmrgThe 1101e5b60d0Smrg.Nm 1111e5b60d0Smrgscript appeared in 1121e5b60d0Smrg.Nx 9.0 . 1131e5b60d0Smrg.Sh AUTHORS 1142026b728Smrg.An Matthew R. Green Aq Mt mrg@eterna23.net . 115