DietPi-Software | OpenBazaar client login fails

Created on 20 Jul 2017  ยท  18Comments  ยท  Source: MichaIng/DietPi

Most helpful comment

@Fourdee
Not sure if it's related, but something I generally wanted to check throughout dietpi-software installs:

  • cp -R OpenBazaar-Server/* /etc/openbazaar-server/ does not copy hidden files/folders. For .gitignore, .github/ and such, if no regular update via git is needed, this is no issue or even wanted, but OpenBazaar repo has at least one other hidden files that might affect the build/execution: https://github.com/OpenBazaar/OpenBazaar-Server/blob/master/.pylintrc
  • Generally I suggest for git installs, that we clone them directly to destination folder and build them there (if needed). This has also the benefit, that on reinstalls, obsolete files are removed as well.
    The .gitignore skips config/data/build files well: https://github.com/OpenBazaar/OpenBazaar-Server/blob/master/.gitignore Of course this would need to be checked for every software title, before we switch it to direct destination git clone.

All 18 comments

Tests:

  • ๐Ÿˆฏ๏ธ Fresh install of DietPi on RPi Zero W + OpenBaz install.

๐Ÿˆด Issue with the OpenBazaar client, clicking next has no effect:
image

  • ๐Ÿˆด ARMv7
  • Debug log
2017-07-22 13:50:56+0000 [Server] [ERROR] failed to query seed: [Errno 111] Connection refused
2017-07-22 13:50:56+0000 [Server] [WARNING] no known neighbors, so not writing to cache.
2017-07-22 13:51:07+0000 [-] [CRITICAL] Libbitcoin server offline
2017-07-22 13:51:23+0000 [NoneType (WebSocketProtocol),0,192.168.0.26] Unhandled Error
        Traceback (most recent call last):
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 306, in addCallbacks
            self._runCallbacks()
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/base.py", line 430, in _continueFiring
            callable(*args, **kwargs)
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/base.py", line 625, in disconnectAll
            failure.Failure(main.CONNECTION_LOST))
        --- <exception caught here> ---
          File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 101, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
            return func(*args,**kw)
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 293, in connectionLost
            protocol.connectionLost(reason)
          File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/policies.py", line 125, in connectionLost
            self.wrappedProtocol.connectionLost(reason)
        exceptions.AttributeError: 'NoneType' object has no attribute 'connectionLost'

2017-07-22 13:51:38+0000 [Server] [WARNING] no known neighbors, so not writing to cache.

No issues during our installation, everything compiled/installed fine. I believe this is a bug in the OB server and/or client.
Change in deps? Cant see any changes to official install notes: https://slack-files.com/T02FPGBKB-F0KJU1CLX-cbbcf8a02c

@Fourdee
Not sure if it's related, but something I generally wanted to check throughout dietpi-software installs:

  • cp -R OpenBazaar-Server/* /etc/openbazaar-server/ does not copy hidden files/folders. For .gitignore, .github/ and such, if no regular update via git is needed, this is no issue or even wanted, but OpenBazaar repo has at least one other hidden files that might affect the build/execution: https://github.com/OpenBazaar/OpenBazaar-Server/blob/master/.pylintrc
  • Generally I suggest for git installs, that we clone them directly to destination folder and build them there (if needed). This has also the benefit, that on reinstalls, obsolete files are removed as well.
    The .gitignore skips config/data/build files well: https://github.com/OpenBazaar/OpenBazaar-Server/blob/master/.gitignore Of course this would need to be checked for every software title, before we switch it to direct destination git clone.

@MichaIng

Yep.

git clone http://git.git /etc/wherewewantit should do it.

@Fourdee
Hmm just wanted to test on Stretch VM, but the service itself fails to start with OpenSSL error:

Sep 08 01:02:17 VM-Stretch systemd[1]: Started openbazaar.
Sep 08 01:02:18 VM-Stretch python[28180]: Traceback (most recent call last):
Sep 08 01:02:18 VM-Stretch python[28180]:   File "openbazaard.py", line 12, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from api.restapi import RestAPI
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/etc/openbazaar-server/api/restapi.py", line 5, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     import obelisk
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/obelisk/__init__.py", line 3, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from client import *
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/obelisk/client.py", line 3, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from zmqbase import ClientBase
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/obelisk/zmqbase.py", line 11, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.internet import defer, reactor
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/reactor.py", line 38, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.internet import default
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 56, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     install = _getInstallFunction(platform)
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.internet.epollreactor import install
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.internet import posixbase
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 18, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.internet import error, udp, tcp
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 29, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.internet._newtls import (
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 41, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     from OpenSSL import rand, crypto, SSL
Sep 08 01:02:18 VM-Stretch python[28180]:   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 124, in <module>
Sep 08 01:02:18 VM-Stretch python[28180]:     SSL_ST_INIT = _lib.SSL_ST_INIT
Sep 08 01:02:18 VM-Stretch python[28180]: AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
Sep 08 01:02:18 VM-Stretch systemd[1]: openbazaar.service: Main process exited, code=exited, status=1/FAILURE
Sep 08 01:02:18 VM-Stretch systemd[1]: openbazaar.service: Unit entered failed state.
Sep 08 01:02:18 VM-Stretch systemd[1]: openbazaar.service: Failed with result 'exit-code'.

Can you replicate, perhaps something with libssl version?

Interesting:
https://github.com/OpenBazaar/OpenBazaar-Server#note-this-project-is-no-longer-maintained-please-see-version-2-at-httpsgithubcomopenbazaaropenbazaar-go

Ok installation and service now works, however, cannot find documentation on how to set the user/password for server.
https://github.com/OpenBazaar/openbazaar-go

Client requires a user/password for server connection.

Had no effect:

cat << _EOF_ > $G_FP_DIETPI_USERDATA/go/src/github.com/OpenBazaar/openbazaar-go/ob.cfg
USERNAME = openbazaar
PASSWORD = $GLOBAL_PW
_EOF_

Online doc updated: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=1796#p1796

Everything seems to be running, however, unable to connect client.

^^ low install count.

@Fourdee

Interesting:
https://github.com/OpenBazaar/OpenBazaar-Server#note-this-project-is-no-longer-maintained-please-see-version-2-at-httpsgithubcomopenbazaaropenbazaar-go

Really good find ๐Ÿ‘! Would have been a waste of time to fix a deprecated software version ๐Ÿคฃ.

unable to connect client.

Hmm, will try as well later. Also docs.openbazaar.org (whole openbazaar.org) is down, which is still linked here and there.

^^ low install count.

True... However I like the concept and the new version shows ongoing development.


Tiny fix: https://github.com/Fourdee/DietPi/commit/d59cf68e629924c88740540f6fe357a6bb13d2dc


Just tested. Install and service start works fine.

Does the client authentication works now for you with $G_FP_DIETPI_USERDATA/openbazaar/config edit as you wrote into the updated docs?
In my case, running the server on VM Stretch, connection fails, but looks due to another reason than authentication:

[SERVER-CONNECT] Browser has been started or refreshed.
[SERVER-CONNECT] [5e888627] Will attempt to connect to server "MichaIng" at 192.168.178.29.
[SERVER-CONNECT] [5e888627] Clearing any proxy that may be set.
[SERVER-CONNECT] [5e888627] Status is "connecting" for connect attempt 1 of 10.
[SERVER-CONNECT] [5e888627] Status is "clearing-tor-proxy" for connect attempt 1 of 10.
[SERVER-CONNECT] [5e888627] Status is "tor-proxy-cleared" for connect attempt 1 of 10.
[SERVER-CONNECT] [5e888627] Clearing any proxy that may be set.
...

Docs say: Install Go 1.9 or greater, thus we could try to use v1.11 directly and switch to official download source: https://golang.org/dl/
โ‚ฌ: https://github.com/Fourdee/DietPi/commit/e3ec25781646cbd8cac39c25e2e60548f05c2e4c
๐Ÿˆฏ๏ธ VM Stretch
๐Ÿˆฏ๏ธ VM Jessie


Btw: Starting/Restarting the service takes quite much time. Several compile and other shorter and longer init processes are starting, before everything calms down and the two final processes "go run" and "openbazaard start" stay in place. Takes as well 1-5 minutes depending on device, I guess, which should be added to our docs.

@MichaIng

Btw: Starting/Restarting the service takes quite much time. Several compile and other shorter and longer init processes are starting, before everything calms down and the two final processes "go run" and "openbazaard start" stay in place. Takes as well 1-5 minutes depending on device, I guess, which should be added to our docs.

Yep, although, i didn't notice this with go 1.9 and ARMv7. Only go 1.11 and ARMv8.

~Debug logging has no effect?~
https://github.com/OpenBazaar/openbazaar-go#options

/mnt/dietpi_userdata/openbazaar/logs

root@DietPi:~# $(which go) run $G_FP_DIETPI_USERDATA/go/src/github.com/OpenBazaar/openbazaar-go/openbazaard.go start -a 0.0.0.0 -l debug -d $G_FP_DIETPI_USERDATA/openbazaar
________                      __________
\_____  \ ______   ____   ____\______   \_____  _____________  _____ _______
 /   |   \\____ \_/ __ \ /    \|    |  _/\__  \ \___   /\__  \ \__  \\_  __ \
/    |    \  |_> >  ___/|   |  \    |   \ / __ \_/    /  / __ \_/ __ \|  | \/
\_______  /   __/ \___  >___|  /______  /(____  /_____ \(____  (____  /__|
        \/|__|        \/     \/       \/      \/      \/     \/     \/

OpenBazaar Server v0.12.4
[Press Ctrl+C to exit]

root@DietPi:~# ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1e:06:33:c5:2c brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.114/24 brd 192.168.0.255 scope global eth0
  • No changes to ob.log when trying to connect from OB client
04:26:31.162 [DEBUG] [core/CheckAndSetUlimit] Successfully raised file descriptor limit to 32000
04:26:31.238 [INFO] [cmd/Execute] Peer ID:  QmfHySzEcMGW7BFD1XkY6iVpP395zuw92puwLqBuu5NV72
04:26:31.246 [INFO] [cmd/printSwarmAddrs] Swarm listening on /ip4/127.0.0.1/tcp/4001
04:26:31.247 [INFO] [cmd/printSwarmAddrs] Swarm listening on /ip4/127.0.0.1/tcp/9005/ws
04:26:31.247 [INFO] [cmd/printSwarmAddrs] Swarm listening on /ip4/192.168.0.114/tcp/4001
04:26:31.247 [INFO] [cmd/printSwarmAddrs] Swarm listening on /ip4/192.168.0.114/tcp/9005/ws
04:26:31.247 [INFO] [cmd/printSwarmAddrs] Swarm listening on /ip6/::1/tcp/4001
04:26:31.247 [INFO] [cmd/printSwarmAddrs] Swarm listening on /ip6/::1/tcp/9005/ws
04:26:31.362 [INFO] [cmd/newHTTPGateway] Gateway/API server listening on /ip4/127.0.0.1/tcp/4002
04:26:51.276 [INFO] [service/New] OpenBazaar service running at /openbazaar/app/1.0.0
04:26:51.276 [INFO] [cmd/func4] Starting bitcoin spv wallet
04:26:51.303 [DEBUG] [recordAgingNotifier/PerformTask] notifications created/records updated: sales: 0/0, purchaseTimeout: 0/0, purchaseExpire: 0/0, dispute$
04:26:51.330 [DEBUG] [service/SendRequest] Sending STORE request to QmY8puEnVx66uEet64gAf4VZRo7oUyMCwG6KdB9KM92EGQ
04:26:51.330 [DEBUG] [service/SendRequest] Sending STORE request to QmPPg2qeF3n2KvTRXRZLaTwHCw8JxzF4uZK93RfMoDvf2o
04:26:51.530 [ERROR] [core/func1] Error pushing data to peer QmPPg2qeF3n2KvTRXRZLaTwHCw8JxzF4uZK93RfMoDvf2o: dial backoff
04:26:51.627 [ERROR] [core/func1] Error pushing data to peer QmY8puEnVx66uEet64gAf4VZRo7oUyMCwG6KdB9KM92EGQ: dial backoff
[SERVER-CONNECT] [c2c66e45] Clearing any proxy that may be set.
[SERVER-CONNECT] [c2c66e45] Status is "connecting" for connect attempt 10 of 10.
[SERVER-CONNECT] [c2c66e45] Status is "clearing-tor-proxy" for connect attempt 10 of 10.
[SERVER-CONNECT] [c2c66e45] Status is "tor-proxy-cleared" for connect attempt 10 of 10.
[SERVER-CONNECT] [c2c66e45] Failed to connect to "test"
[SERVER-CONNECT] [c2c66e45] ====> Reason: undefined
[SERVER-CONNECT] [c2c66e45] ====> Code: 1006

Only changes to config ($G_FP_DIETPI_USERDATA/openbazaar/config) are (password is dietpi):

"Authenticated": true,
"Password": "ab0c16f2769c75b4d63dc9acf8b4fef1b67ebc57e8fa3fa1ca3b279b3efe1cde",
"Username": "dietpi"

Endless logfile created for networking info, even with -l warning set:

  • After 2 minutes of running
root@DietPi:~# ls -lha /mnt/dietpi_userdata/openbazaar/logs/ipfs.log
-rw-r--r-- 1 root root 6.1M Sep  9 04:40 /mnt/dietpi_userdata/openbazaar/logs/ipfs.log

Still broken. Flagging for removal due to low install count.

@Fourdee
I am also doing final test currently. If without success I agree, but give me a change, since I still like the concept of this software.
Low install count is expected, since it currently doesn't work ๐Ÿ˜‰. Or is there a use without connected client?

Easier user/PW setup: https://api.openbazaar.org/
go run openbazaard.go init -d $G_FP_DIETPI_USERDATA/openbazaar

  • Afterwards $G_FP_DIETPI_USERDATA/openbazaar/config exists

go run openbazaard setapicreds => Enter username, password, verify password (dietpi not allowed, too simple!)

  • Since setapicreds does not allow simple passwords, perhaps manual config file edit is better solution, or leave it to end user.

https://github.com/OpenBazaar/openbazaar-desktop/blob/master/docs/connectionIssues.md#remote-server

  • Authenticated => true (part of setapicreds)
  • Gateway => /ip4/<server_ip>/tcp/4002

For your protection, the client will only connect to a remote server via SSL. The above error indicates that your server is not set-up to run SSL.

๐Ÿค” Why there is a switch for SSL on client, of it anyway requires SSL to connect??

๐Ÿˆฏ๏ธ Success with:

  • Created SSL certificate according to the linked SSL guide above,
  • Enabled SSL settings for server and client.
  • Added certificate to client system trusted root CAs, following the nested guides. Not sure which steps was really required. However should be done anyway with e.g. letsencrypt cert.
  • argument -a 0.0.0.0 and
    "AllowedIPs": [
      "0.0.0.0"
    ],

does not work. The real client IP needs to be entered.

  • So real remote client then should only work on local network, via VPN or static external client IP.

๐Ÿˆบ Unbelievable long compiling time on service start.... Retest with Go v1.9. Config and openbazaard argument tests are done after all compiling finished of course. But bad stuff if after waiting for 5 - 10 minutes, you are told that there was a syntax error or "no space left", see below.
๐Ÿˆบ Go leaves 130M obsolete execution dirs inside /tmp. After two restarts, depending on available RAM, OpenBazaar fails. journalctl reveal that it's due to "no space left". Looking into htop shows all rum is eaten by obsolete /tmp/go-build* dirs, which are not removed by go, when related steps is finished ๐Ÿ˜ . Also this should be retested with Go 1.9.

  • Isn't it somehow possible to compile it only once? And keep the produced binaries for future restart etc.? Again runtime system topic...

Retest without SSL ๐Ÿˆฏ๏ธ

  • It was really just the required server and client IPs inside the config file:
    "Gateway": "/ip4/<server_ip>/tcp/4002",
...
    "AllowedIPs": [
      "<client_ip>"
    ],
  • Requires manual user input then. After the go init at least we can auto add server IP, default user+PW (dietpi/$GLOBAL_PW). Maybe during install we can prompt info and ask user to adjust client IP, open nano config file and go on after done. Otherwise the service start after dietpi-software finished is just unnecessary.
  • Will go on tomorrow, check if manual "simple" password works (๐Ÿˆฏ๏ธ), check Go v1.9 and implement the above.

PR up: https://github.com/Fourdee/DietPi/pull/2224

  • ToDo: Check Go v1.9
  • Check possibility to hard code data dir, since otherwise this needs to be added to every openbazaard call.

NB: Automated user/pw addition is not possible, since related entries appear doubled and/or may appear at the and ob an json array or not, thus require a , sometimes, sometimes not. Having it, even with entry at end of array breaks OB start. I am not keen to rely on this default config always looking the same. And since user anyway manually needs to enter client IP, no harm to leave user/pass input via sage go run openbazaard setapicreds to user as well.
ToDo: aSOFTWARE_REQUIRES_USERINPUT=1

@Fourdee
PR ready. Tested on all distros (amd64), works well with new start method via compiled openbazaar-go binary within /mnt/dietpi_userdata/go/bin.
This starts much faster (especially on go 1.11) and allows easier end user access by adding this to $PATH as well.

Test installs + UI:

  • ๐Ÿˆฏ๏ธ ARMv7 (ASUS TB)
  • ๐Ÿˆฏ๏ธ ARMv8 (C2)

You call that a password? Try again.
Enter a veerrrry strong password:

๐Ÿคฃ

@MichaIng

Works a charm, legend, great fix ๐Ÿ‘

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Invictaz picture Invictaz  ยท  3Comments

pgferr picture pgferr  ยท  3Comments

bhaveshgohel picture bhaveshgohel  ยท  3Comments

pfeerick picture pfeerick  ยท  3Comments

mok-liee picture mok-liee  ยท  3Comments