GithubHelp home page GithubHelp logo

owntracks / recorder Goto Github PK

View Code? Open in Web Editor NEW
816.0 43.0 120.0 6.38 MB

Store and access data published by OwnTracks apps

License: Other

Makefile 0.67% C 83.45% HTML 4.85% JavaScript 3.45% CSS 2.46% Shell 2.53% Python 2.05% XSLT 0.11% Lua 0.42%
owntracks mqtt geolocation json http websockets jpdup

recorder's People

Contributors

0xcaff avatar a-andreyev avatar aaronspruit avatar atjn avatar avanc avatar chewi avatar ckrey avatar cocker-cc avatar edautz avatar finkregh avatar franchyze923 avatar freyfogle avatar hoalex avatar jpmens avatar juzam avatar ldruschk avatar linusg avatar makubi avatar nickswalker avatar otdftr avatar patthoyts avatar ralight avatar snh avatar strugee avatar t-8ch avatar tabacha avatar tigattack avatar tuukka avatar withmorten avatar zeko9381 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recorder's Issues

Private mode against mosquitto: A TLS error occurred

As expected, TLS is what breaks first.
I connect the iOS owntracks app in Private mode with activated TLS and authentication, so I have that going for me - which is nice.
MQTT setup was done using https://github.com/padelt/docker-owntracks-private-mqtt-broker , so mosquitto 1.4.2 is listening.
When recorder is connecting, it logs this:

2015-09-18 16:14:22,603 DEBG 'mosquitto' stdout output:
1442592862: OpenSSL Error: error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown
1442592862: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1442592862: Socket error on client <unknown>, disconnecting.

2015-09-18 16:14:32,633 DEBG 'mosquitto' stdout output:
1442592872: New connection from 178.201.xxx.xxx on port 1883.

Recorder repeatedly logs this:

Sep 18 16:12:21 pa15.local ot-recorder[4327] <Info>: MQTT connection: rc=8 [A TLS error occurred.]. Sleeping...

Config in /usr/local/etc/ot-recorder.sh is:

export OTR_HOST="my.host.name"     # MQTT hostname
export OTR_PORT="1883"     # MQTT port (set to 8883 for TLS and define OTR_CAFILE)
export OTR_USER="client2"           # broker user name
export OTR_PASS="whatever"            # broker password
export OTR_CAFILE="/Users/pa/owntracks/ca.crt"      # PEM CA certificate chain for broker

opts="${opts} --http-host 127.0.0.1 --http-port 8083 -D"

exec "/usr/local/sbin/ot-recorder" ${opts} "owntracks/#"

The CA certificat is what signed the mosquitto-server-certificate.

Mosquitto's config is basically this:

id_file /var/run/mosquitto.pid

persistence true
persistence_location /volume/data/

user mosquitto

port 1883

log_dest file /volume/log/mosquitto.log
log_dest stdout

cafile /volume/config/tls/ca.crt
certfile /volume/config/tls/server.crt
keyfile /volume/config/tls/server.key
require_certificate false

allow_anonymous false
password_file /volume/config/clients/passwd

How can I debug the actual cause of the failure?

I assumed that recorder takes the OTR_CAFILE contents to validate the certifcate presented by mosquitto. recorder does not get any certifcate itself, so it will not send one to mosquitto. That should be fine with mosquitto, since require_certificate is false.

Help!?

0.4.2 crashes on when accessing /last/

Everything seems to be fine in 0.4.2 except when I try to access the live map.

Here's the relevant log:

ot-recorder[22361]: starting
ot-recorder[22361]: connecting to MQTT on localhost:1883 as clientID ot-recorder-raspberrypi-22361 without TLS
ot-recorder[22361]: HTTP listener started on 0.0.0.0:8083
ot-recorder[22361]: Subscribing to owntracks/# (qos=2)
ot-recorder[22361]: http: GET /index.html
ot-recorder[22361]: http: GET /table/js/jquery-1.11.3.min.js
ot-recorder[22361]: http: GET /table/js/mustache.js
ot-recorder[22361]: http: GET /table/js/moment.min.js
ot-recorder[22361]: http: GET /api/0/last
ot-recorder[22361]: http: GET /favicon.ico
ot-recorder[22361]: http: GET /last/index.html
ot-recorder[22361]: http: GET /last/functions.js
ot-recorder[22361]: http: GET /last/websock.js
ot-recorder[22361]: http: GET /last/pista-micro.png
zsh: segmentation fault  /usr/local/sbin/ot-recorder --http-host 0.0.0.0 'owntracks/#'

Going back to release tag 0.4.1 fixes the problem.

I suspect there's something relevant in websock.js but I'm not able to track it down unfortunately.

Check payload for binary contents and \0 in string

cc -Wall -Werror -g ot-recorder.c -o ot-recorder json.o geo.o geohash.o mkpath.o file.o safewrite.o base64.o ghash.o -lmosquitto -lcurl -lhiredis
ot-recorder.c: In function ‘on_message’:
ot-recorder.c:375:2: error: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void * const’ [-Werror=format]
ot-recorder.c:424:5: error: format ‘%s’ expects argument of type ‘char *’, but argument 5 has type ‘void * const’ [-Werror=format]
cc1: all warnings being treated as errors

Add hook for monitoring

One of these?

  • touch a file with timestamp of last received message
  • Open listening socket which prints "I'm alive"

We need to be able to monitor whether recorder is still alive.

add events/waypoints to stdout / Lua

Currently waypoints and events are missing from stdout. They are recorded to store (.rec) fine.

Please add waypoints and events logging to stdout.

wdocs is installed in the incorrect dir

If you run make install then the wdocs directory gets copied into DOCROOT such that you end up with (in the default case):

/var/spool/owntracks/recorder/wdocs/wdocs

Add ocat --follow

for --user and optionally --device
should do a tail -f kind of thing

Add round-trip monitoring

A reserved username, device combination (ping, pong) will store last/ but not rec/ so that we can use this to test round-trip connectivity from outside (a.k.a. is the recorder still alive and kicking).

Stats for large (GW) installations

We should possibly add statistics somehow for large installations (number of Greenwich devices), not for small-scale installs (e.g a couple of OwnTracks devices)

Make bounds-fit on map configurable

The change introduced in #46 is unsatisfactory: map zooms at every publish, so it's not possible to zoom to user's preferred view.

We'll probably introduce a GET parameter for this.

Pass fields into storage locations()

This will allow us to ease CSV output and take advantage of fields also for JSON output.
If so, add warning to manual that GeoJSON output format requires lat, lon (which ought to be obvious..)

Lua function on per/topic basis

We now have lmdb named databases, so we can quite easily do this: a configurable Lua script or code on a per/topic basis, eg. to handle particular "events". For example

owntracks/jane/phone/event <lua program here>

which gets passed the topic and a Lua table of the payload.

Refactor handling of incoming messages

Issue #31 disclosed a bit of lousy code which has to be completely overhauled. While all incoming _types were handled (i.e. stored), only location messages were being given the geo, hook, etc. treatment. This is completely wrong and must be reworked.

Coredump when receiving `card`

owntracks/xxx/yyy/info {"_type":"card","face":"/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODApLCBxdWFsaXR5ID0gOTAK/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKAAoAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A+t6KPxr0D4VeF7fVJrjUbtFmjgYJFGwyu/GSSPYY/OgDhvsFz5PnfZ5vJ6+ZsO386gr6awMY7V5N8VvC9vpklvqVoiwpO5jlRRhd+MggdsgHP0oA8+oo/GigA/CvR/hJ4hgtHudLndYmmcSQljgM2MFfrwMfjXnKIZHVEBZmOAo5JNez+DPh7aaHbR3N7EtxqLDcd4ysXsB6+/5UAdnz6V5Z8XPEMF19n0qB1laF/NmKnIVsEBfryc/hXqXHvXG+NPh7aa5bSXNlEtvqKgsNgwsvsR6+/wCdAHi/4UUroY3ZHBVlOCp4IPpRQB1Xwy05dR8WW5cBlt1afHuOB+RIP4V7hz60UUAHPrRz60UUAeH/ABN05dO8WXBQBUuEWfHucg/qCfxooooA/9k=","name":"XX"}
Speicherzugriffsfehler

Out-of-order polyline points

If for some reason location messages don't arrive to Recorder in the order of their timestamps, then Recorder also serves them out-of-order in the polyline API etc. I think that Recorder should either store the messages ordered by timestamp or sort them before building the polyline.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.