dobin / lxd-webgui

A lightweight web frontend for LXD
Apache License 2.0
170 stars 29 forks source link

Cannot get this to work with Firefox #42

Open ak2766 opened 7 years ago

ak2766 commented 7 years ago

System: Ubuntu 16.04.2 LTS

FYI: Works well on Chrome. However my browser of choice is Firefox; hence I'd like it to work there too.

However, no matter what I do, "Test LXD auth" always fails on Firefox: selection_032

Chrome give me this: selection_033

Clicking "Open LXD Url in new tab" gives me this (exactly what I see in Chrome too):

    JSON
    Raw Data
    Headers

{
  "type": "sync",
  "status": "Success",
  "status_code": 200,
  "operation": "",
  "error_code": 0,
  "error": "",
  "metadata": {
    "config": {
      "core.https_address": "127.0.0.1:9000",
      "core.https_allowed_credentials": "true",
      "core.https_allowed_headers": "Origin, X-Requested-With, Content-Type, Accept",
      "core.https_allowed_methods": "GET, POST, PUT, DELETE, OPTIONS",
      "core.https_allowed_origin": "*",
      "core.trust_password": true
    },
    "api_extensions": [
      "storage_zfs_remove_snapshots",
      "container_host_shutdown_timeout",
      "container_syscall_filtering",
      "auth_pki",
      "container_last_used_at",
      "etag",
      "patch",
      "usb_devices",
      "https_allowed_credentials",
      "image_compression_algorithm",
      "directory_manipulation",
      "container_cpu_time",
      "storage_zfs_use_refquota",
      "storage_lvm_mount_options",
      "network",
      "profile_usedby",
      "container_push",
      "container_exec_recording",
      "certificate_update",
      "container_exec_signal_handling",
      "gpu_devices",
      "container_image_properties",
      "migration_progress",
      "id_map",
      "network_firewall_filtering",
      "network_routes",
      "storage",
      "file_delete",
      "file_append",
      "network_dhcp_expiry",
      "storage_lvm_vg_rename",
      "storage_lvm_thinpool_rename",
      "network_vlan",
      "image_create_aliases",
      "container_stateless_copy",
      "container_only_migration",
      "storage_zfs_clone_copy",
      "unix_device_rename",
      "storage_lvm_use_thinpool",
      "storage_rsync_bwlimit",
      "network_vxlan_interface"
    ],
    "api_status": "stable",
    "api_version": "1.0",
    "auth": "trusted",
    "public": false,
    "environment": {
      "addresses": [
        "127.0.0.1:9000"
      ],
      "architectures": [
        "x86_64",
        "i686"
      ],
      "certificate": "-----BEGIN CERTIFICATE-----\nMIIGADCCA+igAwIBAgIRANg1+QYomVKfS3CedsoSky8wDQYJKoZIhvcNAQELBQAw\nNzEcMBoGA1UEChMTbGludXhjb250YWluZXJzLm9yZzEXMBUGA1UEAwwOcm9vdEBh\na2stbTY3MDAwHhcNMTYxMTE4MDMzNzA1WhcNMjYxMTE2MDMzNzA1WjA3MRwwGgYD\nVQQKExNsaW51eGNvbnRhaW5lcnMub3JnMRcwFQYDVQQDDA5yb290QGFray1tNjcw\nMDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALcex3vty+tcEquYOf8e\n0N09/OAKMp5aI02Y30H0G7B2aE5P7ewKSKnGODfC0gxVBg5e8VC6sJzfTc3cxuxa\n0RFJgRJ9on2qMTiktvbU06CaWq+8vcaPiUzakVpOJ6ZUSQJT4dvGRrDkQm2f8P7W\nT9shjDVijqverTXnqcIpl4HjCb87zjg3eFBjvi+tvjBkpUgUVDgDhtVNdw8WNV0O\n2g+fG1NTf9SyIK2OqxU6pc9VrsBlNRf+DZ6F9n8DPjq2hmaA/DnrO+uQ0swnXa8+\n0fLAzHOnPxCKPDbc/wBNKcpD6X5sOK/czRq5jCwZkCRtwGfv2xIppM/BperoD6+u\n2x9rzPCZgDQCzz3vh/bRIPIz9XUKqKRKeGEcLpHZsfVAos4xgSXnN+2G90bMp+HH\nbwOZp0EZ2SQzlpvOsF0FAqoL6RRTT+kcxTvEixGvVHCjtx80msW3933upRu0cJXP\nvnIP4w11BmRi1iJW3mBFptyR0GcuB+1Kf+UVVM3txQ68rdf8/z86lXk2WTa7n/Wt\njmjsLnZlJo127dWmwGmlGBiAUGEoI2lrm758YVMK4gxg89IDDLNdaOVN0+OttmQ8\nbbeCb/VmdN7eK+dSSYJq1MvVYSCHcPxWibliwCfJAyMqSJCNc3uhUzlq+QPcJpPc\nkiT+HLX6I1qj+0n9EDXyLywjAgMBAAGjggEFMIIBATAOBgNVHQ8BA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gXadA==\n-----END CERTIFICATE-----\n",
      "certificate_fingerprint": "",
      "driver": "lxc",
      "driver_version": "2.0.7",
      "kernel": "Linux",
      "kernel_architecture": "x86_64",
      "kernel_version": "4.10.0-20-generic",
      "server": "lxd",
      "server_pid": 3705,
      "server_version": "2.13",
      "storage": "dir",
      "storage_version": "1"
    }
  }
}
dobin commented 7 years ago

Can you try to enable the "Send XHR with credentials" option, and try again?

ronator commented 7 years ago

Hi,

I can confirm this issue. I tried hours to get in up and running with firefox and LXD 2.0.10 (Ubuntu 16.04) . I did it all correctly. It failed due to missing lxc setting for credentials. I tried Ubuntu 17.04 (LXD 2.12). I could access API and settings page and only when XHR disabled so that it did not display an error. But nothing else worked. Despite using client certificate and API (:9000) saying "trusted", lxd log said:

ip=192.168.xx.xx:54976 lvl=warn msg="rejecting request from untrusted client" t=2017-09-15T13:59:29+0200

I confirmed certs were in trust store. Then I found this thread here and tried to open it with Chromium (imported the same certificate as in firefox) and guess what: It worked all the time and only FireFox was misbehaving.

In FireFox, "Test LXD" worked, but "Test LXD Auth" did not. Furthermore, "Settings for LXD" will not show attributes. In Chromium all works fine! Same server, but different browsers, both with same user certificate.

Chromium: auswahl_939 FireFox: auswahl_940

Seems to be a "browser issue". I can provide more (system) info on this issue if needed.

ronator commented 7 years ago

FireFox 55.0.2 (64-Bit) on Linux Mint 18.2 Chromium 60.0.3112.113 (Developer Build)

ronator commented 7 years ago

Enabling XHR does not work with FireFox imho. Adjust URL, press save, press "Test LXD": Fail. auswahl_942

ronator commented 7 years ago

Same situation with FireFox 55.0.3 (64-Bit) on Windows 10 (Home)

ronator commented 6 years ago

Works on Version 61.0.3163.79 (Official Build) Built on Ubuntu , running on LinuxMint 18.2 (64-bit)