NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/57651: creds_msdos sshkey option doesn't work



>Number:         57651
>Category:       bin
>Synopsis:       creds_msdos sshkey option doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 10 19:30:00 +0000 2023
>Originator:     Lloyd Parkes
>Release:        10.99.10
>Organization:
>Environment:
NetBSD armv7 10.99.10 NetBSD 10.99.10 (GENERIC) #0: Sat Oct  7 16:26:38 NZDT 2023  lloyd%kudzu.must-have-coffee.gen.nz@localhost:/vol/build/trunk/objdir.evbarm/sys/arch/evbarm/compile/GENERIC evbarm
>Description:
Using the sshkey method in creds.txt causes the script to emit error messages about invalid variable names. 

Also, the sshkey option doesn't check whether or not the key is already in the authorised keys file, unlike the sshkeyfile method.

>How-To-Repeat:
Copy arm7.img to a Raspberry Pi 3 B and add the following to /boot/creds.txt 

    sshkey lloyd sk-ecdsa-sha2-nistp256%openssh.com@localhost AAAAblah== lloyd mainC


>Fix:
The first problem is because of incorrect quoting in the line that cleans up any stray CRs in the args that are read from creds.txt. 

The second problem is simply not enough code in do_sshkey.

Change the line in creds_msdos that reads 
    local clean_args=$(echo "$args" | tr -d '\015')
so that it reads
    local clean_args="$(echo $args | tr -d '\015')"

Change do_sshkey to read
    do_sshkey() { 
        local user="$1"
        local newkey="$2"

        sshkey_setup "${user}"

        if ! fgrep -qs "${newkey}" "${ssh_userkeys}"; then
                echo "${newkey}" >> "${ssh_userkeys}"
        fi

        sshkey_finish "${user}"
    }





Home | Main Index | Thread Index | Old Index