Skip to content

Allow specifying the config outside of networkd folder #112

@purpleidea

Description

@purpleidea

I'm making an automation module for dracut-sshd in https://github.com/purpleidea/mgmt/ I've found #23 which makes this a lot easier, but I think I need to go slightly further.

While it's good that we don't add the /etc/systemd/network/ directory by default, I actually don't want to add my dracut-sshd file in there at all if possible since I don't want it picked up by the normal system. Ideally it would come from /etc/dracut-sshd/ or /opt/ or somewhere else outside of /etc/. I'm not sure how I could selectively exclude it from being used on regular boot unless I find some sneaky systemd-networkd hack, however that wouldn't necessarily be a good general purpose automation solution.

I did notice:

    if [ -e /root/.ssh/dracut_authorized_keys ]; then
        authorized_keys=/root/.ssh/dracut_authorized_keys
    elif [ -e /etc/dracut-sshd/authorized_keys ]; then
        authorized_keys=/etc/dracut-sshd/authorized_keys
    else
        authorized_keys=/root/.ssh/authorized_keys
    fi
    if [ ! -r "$authorized_keys" ]; then
        dfatal "No authorized_keys for root user found!"
        return 1
    fi

I also can't seem to find a way to do install_items with a source:dest style so the file can come from elsewhere, short of patching dracut itself. It would be nice to do:

install_items_src_dest+=" /etc/dracut-sshd/20-wired.network /etc/systemd/network/20-wired.network "

I wrote a tentative untested patch with an approach. I would appreciate your suggestions, and since I'm unfamiliar with dracut modules, a hint on whether this makes sense as is. #111

Thanks,
James

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions