TheThingSystem / steward

The Thing System is a set of software components and network protocols that aims to fix the Internet of Things. Our steward software is written in node.js making it both portable and easily extensible. It can run on your laptop, or fit onto a small single board computer like the Raspberry Pi.
http://thethingsystem.com
Other
346 stars 81 forks source link

Authentication/New User Creation #123

Closed aallan closed 10 years ago

aallan commented 10 years ago

We have a problem creating new users when the steward is running on localhost.

Lets start from scratch. You have the steward installed, do this

cd steward/steward/db
rm *.db *.key
    cd ../..
git pull
    cd steward
npm install -l
sudo ./run.sh

You should get something like this,

info: running on Darwin Mac OS X (10.8.5) 12F45 info: using node v0.10.12 openssl: Generating a 2048 bit RSA private key

openssl: .. openssl: . openssl: . openssl: . openssl: . openssl: + openssl: + openssl: + openssl:

openssl: . openssl: . openssl: . openssl: . openssl: . openssl: . openssl: . openssl: . openssl: . openssl: + openssl: + openssl: + openssl:

openssl: writing new private key to 'db/server.key'

openssl: -----

keypair generated. info: [devices] loading climate driver debug: [climate] begin info: [devices] loading gateway driver info: [devices] loading indicator driver info: [devices] loading lighting driver info: [devices] loading media driver debug: [media] begin info: [devices] loading motive driver debug: [motive] begin info: [devices] loading presence driver info: [devices] loading sensor driver info: [devices] loading switch driver info: [devices] loading wearable driver debug: [wearable] begin info: [climate] loading ecobee-control driver info: [climate] loading flower-power-sensor driver info: [climate] loading koubachi-sensor driver info: [climate] loading nest-control driver info: [climate] loading netatmo-sensor driver info: [climate] loading oregon-scientific-sensor driver info: [climate] loading samsung-control driver info: [climate] loading yoctopuce-co2 driver info: [climate] loading yoctopuce-light driver info: [climate] loading yoctopuce-meteo driver info: [climate] loading yoctopuce-voc driver info: [devices] loading ecobee-cloud gateway info: [devices] failing ecobee-cloud gateway (continuing) diagnostic=Cannot find module 'ecobee-api' info: [devices] loading flower-power-cloud gateway info: [devices] loading insteon-9761 gateway info: [devices] loading koubachi-cloud gateway info: [devices] loading nest-cloud gateway info: [devices] loading netatmo-cloud gateway info: [devices] loading openzwave-usb gateway info: [devices] loading reelyactive-reel gateway info: [devices] loading rfxcom-usb gateway info: [devices] loading tesla-cloud gateway info: [devices] loading wink-cloud gateway info: [devices] loading yoctopuce-hub gateway info: [devices] loading zigbee-gmo gateway info: [discovery] reelyactive-reel driver listening on udp://:7018 info: [indicator] loading irtoy-infrared driver info: [indicator] loading mqtt-text driver info: [indicator] loading prowl-text driver info: [indicator] loading wink-dial driver info: [indicator] loading wink-nimbus driver info: [indicator] loading xively-sensor driver info: [lighting] loading blink1-led driver info: [lighting] loading blinkstick-led driver info: [lighting] loading heroicrobotics driver info: [lighting] loading hue driver info: [lighting] loading insteon-led driver info: [lighting] loading robosmart-led driver info: [lighting] loading tabu-lumen driver info: [lighting] loading tcpi-led driver info: [lighting] loading yoctopuce-color driver info: [lighting] loading yoctopuce-powercolor driver info: [discovery] PixelPusher listening on udp://:7331 info: [media] loading audio-sonos driver info: [media] loading camera-axis driver info: [media] loading video-appletv driver info: [media] loading video-chromecast driver info: [media] loading video-roku driver info: [motive] loading crazyflie-3d driver info: [motive] loading irobot-floor driver info: [motive] loading tesla-model-s driver info: [presence] loading fob driver info: [presence] loading mobile-mqtt driver info: [presence] loading reelyactive-tag driver info: [switch] loading insteon-dimmer driver info: [switch] loading insteon-onoff driver info: [switch] loading wemo-onoff driver info: [switch] loading wink-onoff driver info: [switch] loading wink-pivot-power-genius driver info: [switch] loading zwave-dimmer driver info: [switch] loading zwave-onoff driver info: [wearable] loading watch driver info: [sensor] loading nest-smoke driver info: [sensor] loading texas-instruments-sensortag driver info: [sensor] loading wemo-motion driver info: [sensor] loading wink-spotter driver info: [sensor] loading yoctopuce-4-20mA-Rx driver notice: [steward] start uuid=2f402f80-da50-11e1-9b23-406c8f4d3784 info: [server] listening on wss://:8888 info: [server] listening on ws://:8887 info: [server] listening on http://*:80 info: [server] loading console route info: [server] loading manage route info: [server] loading oneshot route info: [server] loading root route info: [server] loading ble discovery info: [server] loading mac discovery info: [server] loading owl discovery info: [server] loading portscan discovery info: [server] loading ssdp discovery info: [server] loading tsrp discovery info: [discovery] OWL driver listening on multicast udp://224.192.32.19:22600 info: [discovery] SSDP listening on http://192.168.1.92:1900 info: [discovery] SSDP listening on http://192.168.1.91:1900 info: [discovery] TSRP listening on multicast udp://224.192.32.20:22601 info: [discovery] UPnP listening on http://192.168.1.92:8886 info: [discovery] UPnP listening on http://192.168.1.91:8889 info: [discovery] UPnP SpeedTouch 5x6 (0906BH77V) url=http://192.168.1.254:80 warning: [devices] no maker registered for SpeedTouch info: [discovery] mDNS Apple TV url=http://Apple-TV.local.:7000/ notice: [devices] adding Apple TV deviceType=/device/media/appletv/video info: [discovery] UPnP Philips hue (192.168.1.100) url=http://192.168.1.100:80/ notice: [devices] adding Philips hue (192.168.1.100) deviceType=Philips hue bridge 2012 info: [discovery] BLE ignore uuid=0766e320dbf740c7a99bddd54eb52ee4, localName=estimote, serviceUuids=[] info: [discovery] BLE undefined uuid=944426fdddcc4a83be7b9926f977dbb8 notice: [devices] adding device/3 deviceType=/device/presence/ble/fob info: [discovery] PORT starting scan info: [discovery] BLE Ballistics Box #2 uuid=6923c0948c4a4f8aaec80e4959c5808e notice: [devices] adding Ballistics Box #2 deviceType=/device/presence/ble/fob info: [discovery] Received OWL electricity packet. info: [discovery] OWL Intuition-e id=443719001958, udn=195a42b0-ef6b-11e2-99d0-UID443719001958-owl-electricity, clientID=undefined, remoteAddress=192.168.1.73 notice: [devices] adding OWL Intuition-e deviceType=/device/sensor/owl/meter info: [discovery] PORT finished scan info: [discovery] BLE undefined uuid=04c040a1a47340d4a92a662886f38cc1 notice: [devices] adding device/6 deviceType=/device/presence/ble/fob info: [presence] device/4 Ballistics Box #2 status=recent info: [discovery] BLE StickNfind uuid=76b4f8233f5f4e3fbda349208f586e2e notice: [devices] adding StickNfind deviceType=/device/presence/ble/fob info: [discovery] BLE Ballistics Box #1 uuid=d0831c2920f549a1b6635b00bf63f35c notice: [devices] adding Ballistics Box #1 deviceType=/device/presence/ble/fob info: [presence] device/6 device/6 status=recent info: [discovery] Received OWL electricity packet. info: [presence] device/7 StickNfind status=recent info: [presence] device/8 Ballistics Box #1 status=recent

from there you need to go to

https://localhost:8888

You should get a "can't verify the identity of the website "localhost"

screenshot 2014-01-18 19 41 29

Hit the "Show Certificate" button and tick the "Always trust steward when connecting to localhost" tick box,

screenshot 2014-01-18 19 42 19

and hit continue. You should then get this popup,

screenshot 2014-01-18 19 43 05

hit the "create/add account" button, you'll end up a that client.html page.

Enter a short name, e.g. admin, and a long name, e.g. Administrator, and leave the permissions at "master"

screenshot 2014-01-18 19 44 09

which gives us this,

screenshot 2014-01-18 19 44 41

which replicates this issue. User creation seems to be broken on localhost.

The error console looks like this,

screenshot 2014-01-18 19 47 37

while the command line is showing this,

warning: [manage] wss 127.0.0.1 51524 /manage loopback=false, subnet=false, local=false, remoteAddress=127.0.0.1, secure=true, event=access, diagnostic=unauthorized, role=, resource=, internalP=false
warning: [manage] wss 127.0.0.1 51524 /manage permanent=false, diagnostic=unauthorized, requestID=3, event=user creation
tigoe commented 10 years ago

Thanks Alasdair. That sums the issue that I encountered spot on.

mrose17 commented 10 years ago

a user should not use https://127.0.0.1:8888/... - always go unencrypted to localhost, i.e., http://127.0.0.1:8887

i could not find anything in the docs warning about this, so i'm re-purposing this issue accordingly

@tigoe - try http://127.0.0.1:8887/client.html and i believe that all will work well. if not, please comment on this issue.

@aallan - we need to add something to the docs warning folks about this.

@ae9f - would it be possible to have the HTML5/D3 client, on startup to 127.0.0.1 - see if it is using https: and if so switch to http? ditto for client.html?

aallan commented 10 years ago

Thanks @mrose17, I'll modify the documentation accordingly.

@tigoe does this resolve it?

tigoe commented 10 years ago

That did it. Thanks @mrose17. Seems to work fine now, and is able to control my Hue. Will try a few other things from work as well.

On Jan 18, 2014, at 4:44 PM, mrose17 notifications@github.com wrote:

a user should not use https://127.0.0.1:8888/... - always go unencrypted to localhost, i.e., http://127.0.0.1:8887

i could not find anything in the docs warning about this, so i'm re-purposing this issue accordingly

@tigoe - try http://127.0.0.1:8887/client.html and i believe that all will work well. if not, please comment on this issue.

@aallan - we need to add something to the docs warning folks about this.

@ae9f - would it be possible to have the HTML5/D3 client, on startup to 127.0.0.1 - see if it is using https: and if so switch to http? ditto for client.html?

— Reply to this email directly or view it on GitHub.

mrose17 commented 10 years ago

@tigoe - sorry about that. it is, regrettably, one of the easiest ditches to fall into (and there's a long story behind it)…

good luck!

aallan commented 10 years ago

Updated the documentation,

http://thingsystem.tumblr.com/post/74544067638/in-the-wake-of-yesterdays-release-weve-just