Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer to Peer mode questions #39

Closed
ynasida opened this issue Apr 19, 2022 · 35 comments
Closed

Peer to Peer mode questions #39

ynasida opened this issue Apr 19, 2022 · 35 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@ynasida
Copy link

ynasida commented Apr 19, 2022

Hello,

I follow the instruction 'Building from source' but do not see that p2p mode is started.
May be I should configure with some options ?

health-check is fine but I do not see any bad actors ip addresses.

In console:
'Failed to prepare statement: no such table: honey'

sentrypeer -drawps

SentryPeer node id: 5d9c4356-4471-402a-af0c-93b0bb1fcda8
Starting sentrypeer...
API mode enabled, starting http daemon...
Web GUI mode enabled...
SIP mode enabled...
Configuring local address...
Creating UDP socket...
Binding socket to local address...
Listening for incoming connections...
SIP responsive mode enabled. Will reply to SIP probes...

GET /ip-addresses from Client IP: 127.0.0.1
Checking url: /ip-addresses, against route: /health-check
Checking url: /ip-addresses, against route: /
Checking url: /ip-addresses, against route: /ip-addresses
Route is an exact match.
Failed to prepare statement: no such table: honey
Failed to select bad actors from database

@ynasida ynasida added the bug Something isn't working label Apr 19, 2022
@ghenry ghenry self-assigned this Apr 19, 2022
@ghenry ghenry added question Further information is requested documentation Improvements or additions to documentation and removed bug Something isn't working labels Apr 19, 2022
@ghenry
Copy link
Collaborator

ghenry commented Apr 19, 2022

Hi @ynasida

If you re-run ./configure and check this part:

checking for opendht-c... yes
checking we have opendht-c >= 2.3.5... yes

it probably says no. I should either disable the -p option if OPENDHT_C is not detected or issue an error. What do you think works best as a user?

If you'd like p2p mode, you should use the Docker container or install opendht from source first or via Homebrew.

The message:

 'Failed to prepare statement: no such table: honey'

is just because there are no bad_actors yet, so the table hasn't been created in sentrypeer.db. I should squash that message.

Thanks,
Gavin.

@ghenry ghenry changed the title Bug: Compiled from source at debian 11. Looks good but Peer to peer DHT mode is NOT started. Not sure why. Compiled from source at debian 11. Looks good but Peer to peer DHT mode is NOT started. Not sure why. Apr 19, 2022
@ghenry
Copy link
Collaborator

ghenry commented Apr 20, 2022

How did you get on @ynasida ?

@ynasida
Copy link
Author

ynasida commented Apr 26, 2022

Hi @ghenry

Thanks a lot for your response!

Yes opendht is not installed it it's the reason. Some error message would be very useful but the best option would be to have good instruction how to compile opendht :) I tried but had not luck.

I am not so familiar with docker but have to use this way because I need p2p mode.
Can you please advice a bit here ? I would like to see work logs of SentryPeer like i see when i start ./sentrypeer -drawps without docker. A log of useful information like:

'SentryPeer node id: 8ae32230-d9d8-4a04-9f83-9bb00f16735f
Starting sentrypeer...
API mode enabled, starting http daemon...
Web GUI mode enabled...
SIP mode enabled...
Peer to Peer DHT mode enabled...
Starting peer to peer DHT mode...
Configuring local address...
Creating socket...
Binding socket to local address...
Listening for incoming connections...'

How can I see same things with docker variant? I already set env variables you mentioned on the page but can see sentrypeer_json.log only (almost nothing)

@ghenry
Copy link
Collaborator

ghenry commented Apr 26, 2022

Thanks for replying. If you're using the Docker hub one and not doing https://github.com/SentryPeer/SentryPeer#docker then you'd need to rebuild the container and just add a -d to the CMD section in the Dockerfile.

I'd install OpenDHT via Homebrew and rebuilt SentryPeer:

https://brew.sh/
then set your env like in https://docs.brew.sh/Homebrew-on-Linux

What OS are you on? I'm still working on rpms and debs for v1.4.0 as OpenDHT needs to be updated for the C libs.

Thanks.

@ghenry
Copy link
Collaborator

ghenry commented Apr 26, 2022

Sorry, I forget the issue subject says Debian 11 :-D

@ynasida
Copy link
Author

ynasida commented Apr 27, 2022

Thanks again @ghenry !

I added -d to the CMD section in the Dockerfile and did rebuild. Now I see that sentrypeer process (in docker container) is started with -d flag but... I still not sure where I should see logs I need ( like 'Peer to Peer DHT mode enabled', etc )? sentrypeer_json.log has not this. In general I would like to see logs like 'connected to p2p node - ip address, downloading, etc'
The main goal is - p2p mode and I still can not be sure if it is enabled and working.

Btw, can you please advice how many p2p members SentryPeer currently have ?

I also tried to install OpenDHT via Homebrew.

useradd ynasida
usermod -a -G sudo ynasida
su ynasida

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/ynasida/.linuxbrew/bin/brew shellenv)"' >> /home/ynasida/.profile
eval "$(/home/ynasida/.linuxbrew/bin/brew shellenv)"

cd /home/ynasida
brew install opendht

It download many things and get stuck here (please look at picture).
photo_2022-04-27_11-36-56

@ghenry
Copy link
Collaborator

ghenry commented Apr 27, 2022

Hmm, that is strange for Homebrew.

For your container, check out this post - https://stackoverflow.com/a/41147654/1072411

@ynasida
Copy link
Author

ynasida commented Apr 27, 2022

@ghenry,

Thanks for good advice about container's logs!

I did like you said and also disabled SIP mode to see p2p logs only.
Please look at logs below. I wait several minutes but do not see p2p connections so far. Should I do something else ?

root@sentrypeer:/usr/src/SentryPeer-git# tail -f docker inspect --format='{{.LogPath}}' 65cf0a45b63e

{"log":"Starting sentrypeer...\n","stream":"stderr","time":"2022-04-27T14:12:28.660215746Z"}
{"log":"API mode enabled, starting http daemon...\n","stream":"stderr","time":"2022-04-27T14:12:28.660220296Z"}
{"log":"Web GUI mode enabled...\n","stream":"stderr","time":"2022-04-27T14:12:28.660224646Z"}
{"log":"Peer to Peer DHT mode enabled...\n","stream":"stderr","time":"2022-04-27T14:12:28.660228806Z"}
{"log":"Starting peer to peer DHT mode...\n","stream":"stderr","time":"2022-04-27T14:12:28.660233226Z"}
{"log":"Peer to peer DHT mode started.\n","stream":"stderr","time":"2022-04-27T14:12:28.672485113Z"}
{"log":"DHT InfoHash for key 'bad_actors' is: 14d30143330e2e0e922ed4028a60ff96a59800ad\n","stream":"stderr","time":"2022-04-27T14:12:28.672515183Z"}
{"log":"Bootstrapping the DHT\n","stream":"stderr","time":"2022-04-27T14:12:28.672520393Z"}
{"log":"Waiting 5 seconds for bootstrapping to bootstrap.sentrypeer.org...\n","stream":"stderr","time":"2022-04-27T14:12:28.672524743Z"}
{"log":"Listening for changes to the bad_actors DHT key\n","stream":"stderr","time":"2022-04-27T14:12:33.672280064Z"}

{"log":"GET /ip-addresses from Client IP: My_IP\n","stream":"stderr","time":"2022-04-27T14:18:10.594584098Z"}
{"log":"Checking url: /ip-addresses, against route: /health-check\n","stream":"stderr","time":"2022-04-27T14:18:10.594706519Z"}
{"log":"Checking url: /ip-addresses, against route: /\n","stream":"stderr","time":"2022-04-27T14:18:10.594715699Z"}
{"log":"Checking url: /ip-addresses, against route: /ip-addresses\n","stream":"stderr","time":"2022-04-27T14:18:10.594721759Z"}
{"log":"Route is an exact match.\n","stream":"stderr","time":"2022-04-27T14:18:10.594727529Z"}
{"log":"Failed to prepare statement: no such table: honey\n","stream":"stderr","time":"2022-04-27T14:18:10.598949438Z"}
{"log":"Failed to select bad actors from database\n","stream":"stderr","time":"2022-04-27T14:18:10.599016448Z"}

May be some iptables settings ?

I have these:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8082 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 8082 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 4222 -j ACCEPT

@ghenry
Copy link
Collaborator

ghenry commented Apr 27, 2022

Hi @ynasida

If any other SentryPeer nodes are online, enabled with p2p mode and connected bootstrap.sentrypeer.org or other nodes, then when they get a probe, you will get their bad_actor.

p2p mode is best effort replication, i.e. you get bad_actors from other peers if they are online and you are too. No catch up like blockchain etc. The data would be too stale otherwise.

In the unreleased version of SentryPeer (main branch) is the new -b flag, where you can run your own bootstrap node.

Does this all make sense and read OK?

Thanks,
Gavin.

@ghenry ghenry changed the title Compiled from source at debian 11. Looks good but Peer to peer DHT mode is NOT started. Not sure why. Peer to Peer mode questions Apr 27, 2022
@ghenry
Copy link
Collaborator

ghenry commented Apr 27, 2022

We do store bad actors permanently on the DHT, so we could get them on start up. I've just done it so we listen on that key and get other nodes data when they PUT it. So we could catch up somewhat, to build an historic database.

@ynasida
Copy link
Author

ynasida commented Apr 28, 2022

Thanks, @ghenry !
I think I understood but still have two questions.

'If any other SentryPeer nodes are online, enabled with p2p mode and connected bootstrap.sentrypeer.org or other nodes, then when they get a probe, you will get their bad_actor.'

I see that node I have is connected to bootstrap.sentrypeer.org. Thus I should get bad_actor from others nodes when they get a probe. But I do not see any activity during the night. Does it means that there is not nodes online that wants to share ?

'In the unreleased version of SentryPeer (main branch) is the new -b flag, where you can run your own bootstrap node.'
I probably can set like -b bootstrap.mydomain.com. But I am not sure how should I configure bootstrap.mydomain.com node itself. That should be just one more SentryPeer node ? What flags I should use at bootstrap instance ? Without -b my own bootstrap node will be connected to bootstrap.sentrypeer.org.

Please advice.

@ghenry
Copy link
Collaborator

ghenry commented Apr 28, 2022

Thanks, @ghenry ! I think I understood but still have two questions.

My pleasure.

'If any other SentryPeer nodes are online, enabled with p2p mode and connected bootstrap.sentrypeer.org or other nodes, then when they get a probe, you will get their bad_actor.'

I see that node I have is connected to bootstrap.sentrypeer.org. Thus I should get bad_actor from others nodes when they get a probe. But I do not see any activity during the night. Does it means that there is not nodes online that wants to share ?

Yeah, maybe no one online. This is a new project. My node is usually on sharing things, but it's down just now as I'm working on TCP mode. I'm speaking at various places to get others online like https://chat.uknof.org.uk/public/channels/uknof49ops and Comms Council (this Friday)

'In the unreleased version of SentryPeer (main branch) is the new -b flag, where you can run your own bootstrap node.' I probably can set like -b bootstrap.mydomain.com. But I am not sure how should I configure bootstrap.mydomain.com node itself. That should be just one more SentryPeer node ? What flags I should use at bootstrap instance ? Without -b my own bootstrap node will be connected to bootstrap.sentrypeer.org.

Just apt-get install dhtnode then run it as dhtnode -p 4222. I'm running the vanilla node from OpenDHT on bootstrap.sentrypeer.org:

https://github.com/savoirfairelinux/opendht/wiki/Running-a-node-with-dhtnode

Please advice.

@ynasida
Copy link
Author

ynasida commented Apr 30, 2022

Thank you so much for your answers! I think discussion can be closed :)

@ghenry
Copy link
Collaborator

ghenry commented Apr 30, 2022

Trying running two nodes on different IP addresses and then using sipsak against one. You should see the replication on the other node.

@ghenry
Copy link
Collaborator

ghenry commented May 6, 2022

Going to close for now. Get back in touch with any other questions @ynasida

Thanks!

@ghenry ghenry closed this as completed May 6, 2022
@ynasida
Copy link
Author

ynasida commented May 6, 2022

Thanks @ghenry !

Seems like I got extra questions.
I have sentrypeer installed (docker version) at Linode and got Linode Alert - Outbound Transfer Quota.
It has used 3265GB of 4000GB. Wow... 3265GB.
I see that sentrypeer process does something (htop) but not sure that exactly.
tail -f docker inspect --format='{{.LogPath}}' 5a09f5a1a858 but almost nothing in logs. Just some new fraud attempts that sentrypeer noted and saved. Really few of them.
sngrep also shows few attempts only.

I checked by iftop and see a lot of weird traffic. Please look at some screens and advice.
The traffic gradually disappeared when I stopped the container and docker.

photo_2022-05-06_19-42-21

image

@ghenry ghenry reopened this May 6, 2022
@ghenry
Copy link
Collaborator

ghenry commented May 6, 2022

It will be all the peer to peer traffic. As we're listening on port 4222, you start to become part of the main OpenDHT (https://jami.net) DHT - which you can see in your iftop.

@ynasida
Copy link
Author

ynasida commented May 6, 2022

I see but... 3265GB.. I expected I would send and receive fraud ip addresses and numbers. I have 200+ ip addresses and about 1000+ numbers in the database. Is it possible to use opendht for traffic we need only ?

@ghenry
Copy link
Collaborator

ghenry commented May 6, 2022

Yeah, good point!

I'll ask the team, but I don't think so. You're part of a public DHT and that means all bad_actors will get distributed and HA/DR is fantastic for that.

Running it on your own private VLAN and with your own bootstrap node firewalled off would probably be the best way to limit that.

Thanks.

@ghenry
Copy link
Collaborator

ghenry commented May 6, 2022

Was discussing this here too savoirfairelinux/opendht#589

@ynasida
Copy link
Author

ynasida commented May 10, 2022

Hello, @ghenry

Thanks again for you answers!

'Running it on your own private VLAN and with your own bootstrap node firewalled off would probably be the best way to limit that.'

But I think p2p will work between my opendht nodes only ?

I have read discussion you mentioned but looks like they have not problem I mentioned. 3265GB..

@ghenry
Copy link
Collaborator

ghenry commented May 10, 2022

Are you sure that figure is right? I'm running our public bootstrap node on the free Oracle Cloud tier.

@ynasida
Copy link
Author

ynasida commented May 11, 2022

@ghenry I got alert from Linode and it is the only software installed. You think I should try re-install at oracle cloud ?

@ghenry
Copy link
Collaborator

ghenry commented May 11, 2022 via email

@ynasida
Copy link
Author

ynasida commented May 18, 2022

@ghenry I did not try oracle cloud but did re-installing of simple docker version at new linode VPS. Old linode VPS was tested with different ways to install sentrypeer and I thought something could be the reason of my issue.

But... I had not luck.

'Your Linode, SentryPeer1, has exceeded the notification threshold (10) for outbound traffic rate by averaging 19.82 Mb/s for the last 2 hours. '
Wow...

I am pretty sure it's related with OpenDHT and still don't understand how to use p2p in this case.
I don't think I will get different result with oracle cloud.

May be you have some special iptables rules that prevent OpenDHT to use so many traffic ?

Please advice.

@ghenry
Copy link
Collaborator

ghenry commented May 18, 2022

I'll get some udp nftables or iptables examples to you and maybe see if I can bake it into the Docker container.

@ghenry
Copy link
Collaborator

ghenry commented May 18, 2022

In your logs, do you see anything like this:

savoirfairelinux/opendht#599

@ynasida
Copy link
Author

ynasida commented May 19, 2022

Yes I see
image

@ghenry
Copy link
Collaborator

ghenry commented May 19, 2022 via email

@ynasida
Copy link
Author

ynasida commented May 19, 2022

I see. Can we fix ? Or we should wait till opendth will fix ?

@ghenry
Copy link
Collaborator

ghenry commented May 19, 2022 via email

@ynasida
Copy link
Author

ynasida commented Jun 13, 2022

Hello, @ghenry, do we have any news ?

@ghenry
Copy link
Collaborator

ghenry commented Jun 13, 2022

Looking at new designs...:

savoirfairelinux/opendht#599 (comment)
d4b2a66#commitcomment-75714036

Thanks.

@ynasida
Copy link
Author

ynasida commented Sep 28, 2022

Hello @ghenry ,

Just would like to ask if it is possible to use sentrypeer with p2p currently.

Thanks

@ghenry
Copy link
Collaborator

ghenry commented Sep 28, 2022 via email

@ghenry ghenry closed this as completed Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants