bluerobotics / BlueOS

The open source platform for ROV, USV, robotic system operation, development, and expansion.
https://blueos.cloud/docs/
Other
169 stars 80 forks source link

allow getting ssh user and password from environment variables #2998

Closed Williangalvani closed 1 week ago

Williangalvani commented 1 week ago

I used this to install BlueOS on a Radxa Zero 3E running ubuntu. The issue is there's no pi user there, so it requires these changes in order to be able to install the ssh key. Additionaly, this is the updated startup.json:

{
    "core": {
        "binds": {
            "/dev/": {
                "bind": "/dev/",
                "mode": "rw"
            },
            "/etc/blueos": {
                "bind": "/etc/blueos",
                "mode": "rw"
            },
            "/etc/dhcpcd.conf": {
                "bind": "/etc/dhcpcd.conf",
                "mode": "rw"
            },
            "/etc/machine-id": {
                "bind": "/etc/machine-id",
                "mode": "ro"
            },
            "/etc/resolv.conf.host": {
                "bind": "/etc/resolv.conf.host",
                "mode": "ro"
            },
            "/home/pi/.ssh": {
                "bind": "/home/pi/.ssh",
                "mode": "rw"
            },
            "/home/rock/.ssh": {
                "bind": "/home/rock/.ssh",
                "mode": "rw"
            },
            "/run/udev": {
                "bind": "/run/udev",
                "mode": "ro"
            },
            "/sys/": {
                "bind": "/sys/",
                "mode": "rw"
            },
            "/tmp/wpa_playground": {
                "bind": "/tmp/wpa_playground",
                "mode": "rw"
            },
            "/usr/blueos/bin": {
                "bind": "/usr/blueos/bin",
                "mode": "rw"
            },
            "/usr/blueos/extensions": {
                "bind": "/usr/blueos/extensions",
                "mode": "rw"
            },
            "/usr/blueos/userdata": {
                "bind": "/usr/blueos/userdata",
                "mode": "rw"
            },
            "/var/logs/blueos": {
                "bind": "/var/logs/blueos",
                "mode": "rw"
            },
            "/var/run/dbus": {
                "bind": "/var/run/dbus",
                "mode": "rw"
            },
            "/var/run/docker.sock": {
                "bind": "/var/run/docker.sock",
                "mode": "rw"
            },
            "/var/run/wpa_supplicant": {
                "bind": "/var/run/wpa_supplicant",
                "mode": "rw"
            }
        },
        "enabled": true,
        "environment": [
            "SSH_USER=rock",
            "SSH_PASSWORD=rock",
            "USER_UID=1001",
            "USER_GID=1001",
            "BLUEOS_DISABLE_SERVICES=wifi,autopilot"
        ],
        "image": "williangalvani/blueos-core",
        "network": "host",
        "privileged": true,
        "tag": "user_pass",
        "webui": false
    }
}

For documentation sake:

potentially fix #2984