MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.85k stars 495 forks source link

DietPi-Software | OpenBazaar client login fails #1090

Closed Fourdee closed 5 years ago

Fourdee commented 7 years ago

https://twitter.com/vp39216130/status/887943516202172417

Fourdee commented 7 years ago

Tests:

Fourdee commented 7 years ago

🈴 Issue with the OpenBazaar client, clicking next has no effect: image

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

Fourdee commented 7 years ago

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

MichaIng commented 6 years ago

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

Fourdee commented 6 years ago

@MichaIng

Yep.

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

MichaIng commented 6 years ago

@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?

Fourdee commented 6 years ago

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

Fourdee commented 6 years ago

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_
Fourdee commented 6 years ago

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.

Fourdee commented 6 years ago

^^ low install count.

MichaIng commented 6 years ago

@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.

Fourdee commented 6 years ago

@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.

Fourdee commented 6 years ago

~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
[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:

Fourdee commented 5 years ago

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

MichaIng commented 5 years ago

@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

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

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

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:

🈺 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.

MichaIng commented 5 years ago

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

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

MichaIng commented 5 years ago

@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.

Fourdee commented 5 years ago

Test installs + UI:

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

🤣

@MichaIng

Works a charm, legend, great fix 👍