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

New: Tor2IP (ip2tor) Bridge Subscriptions #1194

Closed
1 task done
rootzoll opened this issue May 20, 2020 · 29 comments
Closed
1 task done

New: Tor2IP (ip2tor) Bridge Subscriptions #1194

rootzoll opened this issue May 20, 2020 · 29 comments
Assignees
Milestone

Comments

@rootzoll
Copy link
Collaborator

rootzoll commented May 20, 2020

As part of the Lightning Hackathons a tor2ip bdrige concept was developed to make it easy for a RaspiBlitz running behind TOR to buy a tunnel bridge giving it a clearnet IP+port to make services like the REST API reachable for Mobile Apps, POS systems or other apps.

The goal if this issue is to make it possible to make a subscription to a automated shop offering such bridges - running the open shop software: https://github.com/frennkie/django-ip2tor

@rootzoll rootzoll added this to the 1.6 Release milestone May 20, 2020
@rootzoll
Copy link
Collaborator Author

To create a subscription script its needed to easily parse JSON data from such a shop. This may get complicated with bash .. so I looked at python and to make user interaction using the following UI dialogs: http://pythondialog.sourceforge.net

This python dialog wrapper can be installed from the debian repos with:
apt-get install python3-dialog
To be tested.

@rootzoll
Copy link
Collaborator Author

rootzoll commented May 21, 2020

Consider a new config valaue format for storing the list of subscription to bridges - see: #1185
The data for the subscriptions can be in a seperate file next to raspiblitz.conf - so we can maybe test a new config value format here.

@frennkie
Copy link
Contributor

I noticed yesterday that a key part was missing in the API.. but now this workflow should work:

@frennkie
Copy link
Contributor

frennkie commented May 21, 2020

Extending is slightly different (shorter) steps:

@frennkie
Copy link
Contributor

frennkie commented May 21, 2020

I included many/most of the data in the nested relations. So after POSTing the order all info should be available here: https://shop.ip2t.org/api/v1/public/pos/22a942b3-89de-48e4-841c-f15d4d21e69f/

rootzoll pushed a commit that referenced this issue May 22, 2020
rootzoll pushed a commit that referenced this issue May 22, 2020
rootzoll pushed a commit that referenced this issue May 23, 2020
rootzoll pushed a commit that referenced this issue May 24, 2020
rootzoll pushed a commit that referenced this issue May 24, 2020
rootzoll pushed a commit that referenced this issue May 24, 2020
rootzoll pushed a commit that referenced this issue May 25, 2020
@rootzoll rootzoll changed the title Experimental: Tor2IP (ip2tor) Bridge Subscriptions New: Tor2IP (ip2tor) Bridge Subscriptions May 27, 2020
@rootzoll rootzoll added the final testing was fixed - needs testing label Jun 4, 2020
@rootzoll
Copy link
Collaborator Author

rootzoll commented Jun 8, 2020

TODO: after RC1 release change default shop to production server

@rootzoll
Copy link
Collaborator Author

rootzoll commented Jun 14, 2020

Check again if Subscriptions can be canceld - got this error report:
Bildschirmfoto 2020-06-14 um 11 44 35

There seems some problems with the permissions on the toml file, when scripts run from menus ...check sudo calls.

rootzoll pushed a commit that referenced this issue Jun 14, 2020
@rootzoll rootzoll added SHOWSTOPPER needs fixing to make release and removed final testing was fixed - needs testing labels Jun 19, 2020
rootzoll pushed a commit that referenced this issue Jun 22, 2020
@rootzoll
Copy link
Collaborator Author

rootzoll commented Jun 22, 2020

  • cannot reproduce on my test machines - test on a fresh RaspiBlitz install
    OK - added fix. Ready for final testing.

@rootzoll rootzoll removed the SHOWSTOPPER needs fixing to make release label Jun 24, 2020
@rootzoll
Copy link
Collaborator Author

  • Setup a FULMO IP2TOR shop for v1.5RC2

@frennkie let me know when you have time to setup the IP2TOR store

rootzoll pushed a commit that referenced this issue Jul 11, 2020
@frennkie
Copy link
Contributor

frennkie commented Jul 12, 2020

To have it more seperated and prevent cleartext data spillage I think we should make nginx forward from http to https once a IP2TOR/lentsencrypt is activated for that service. Use this kind of nginx feature:
https://www.bjornjohansen.com/redirect-to-https-with-nginx

In the context of the IP2Tor bridges the HTTP (typically port 80) to HTTPS (typically port 443) would not work that easily. Normally nginx just changes the port from 80 to 443.. but with the bridges neither HTTP will have 80 nor HTTPS will have 443.

Would it worth to separate the HTTPS .onion services under an other Hidden Service address?
It would complicate the setup,but currently the port 80 and 443 is forwarded the the same Tor hostname.

My feeling is that it's ok, that we have 80 and 443 on the same .onion.

Is there a check in the shop that it does not expose cleartext data?

Not yet... I'd be happy for any help on this. I think doing an "inspection" of flowing data borders on evil. But the Shop could attempt a TLS handshake before accepting the order.

rootzoll pushed a commit that referenced this issue Jul 12, 2020
rootzoll pushed a commit that referenced this issue Jul 15, 2020
@rootzoll
Copy link
Collaborator Author

@frennkie I added more details in case that a IP2TOR order is not working. Here is an example ao an oder that was payed but then timed out ... let me know if this is good enough for debug:

###### ERROR DETAIL FOR DEBUG #######

Error Short:
timeout bridge not getting ready
Shop:
https://ip2tor.fulmo.org
Bridge:
{'id': 'de5f9e86-dd35-4a75-88e8-652f91cd2330', 'site': 'ip2tor.fulmo.org', 'created_at': '2020-07-03T10:07:55Z', 'modified_at': '2020-07-03T20:17:41Z', 'ip': '91.109.21.148', 'name': 'tondro01', 'is_testnet': False, 'offers_tor_bridges': True, 'tor_bridge_duration': 86400, 'tor_bridge_price_initial': 40000, 'tor_bridge_price_extension': 24000, 'offers_rssh_tunnels': False, 'rssh_tunnel_price': 1000, 'terms_of_service': '-', 'terms_of_service_url': '-', 'owner': 2, 'tor_bridge_duration_hours': 24, 'tor_bridge_price_initial_sats': 40, 'tor_bridge_price_extension_sats': 24}
Error Detail:
{'id': '2c150c15-eeb2-4de9-8dfe-d6374d113c0b', 'status': 'P', 'host_id': 'de5f9e86-dd35-4a75-88e8-652f91cd2330', 'port': 20828, 'suspend_after': '2020-07-16T13:00:55Z', 'comment': 'test', 'target': 'ak2oywmlr5m35igvm3vd4kraoxxtshqpuqhvn364nr24ufgkbfhbixqd.onion:8080'}

rootzoll pushed a commit that referenced this issue Jul 17, 2020
rootzoll pushed a commit that referenced this issue Jul 17, 2020
@grnqrtr
Copy link
Contributor

grnqrtr commented Jul 18, 2020

I've been running a subscription for several days now and went to check in SUBSCRIBE. On the details of the subscription I set up it doesn't seem to be showing the details correctly. It says I've only paid 24 sats so far, but looking at RTL I can see I've been paying 24 sats a day for several days.

subscription

@frennkie
Copy link
Contributor

frennkie commented Jul 18, 2020

@grnqrtr Thanks for reporting - I also noticed it and already fixed it: a403a7b

@frennkie
Copy link
Contributor

frennkie commented Jul 18, 2020

@grnqrtr from "aws1" and the pruchase date I can look your subscription up in the database. As far as I see it you set up this subscription to port 80. Are you using this IP2TOR bridge for HTTP or HTTPS connections?

If you are using cleartext HTTP then the next renew should fail as I merged a change into the backend that rejects if you don't use encrypted HTTPS traffic. Would be great if you could give some feedback.

@grnqrtr
Copy link
Contributor

grnqrtr commented Jul 18, 2020

I set it up to be able to access BTCPayServer over clearnet. I actually want it to be for HTTPS, but when I go to it in browser it's not secure. I'm not exactly sure how to specify that. I thought maybe having the Let's Encrypt Client enabled from SETTINGS would work, but seems like not. Is that something I should have specified when setting up the subscription?

EDIT: I'm happy to test & give more feedback. If this isn't the place to go back and forth over my HTTPS issue, feel free to contact me on Telegram or Keybase instead (same username, grnqrtr).

@rootzoll
Copy link
Collaborator Author

@grnqrtr v1.6 RC3 will give you more details on the IP2TOR in the mainmenu for BTCPay.

@rootzoll
Copy link
Collaborator Author

@frennkie trying to order a bridge I got the following timeout:

Error Short:
timeout on getting invoice
Shop:
https://ip2tor.fulmo.org
Bridge:
{'id': '58b61c0b-6d84-466e-9d56-bdf5d902ebdf', 'site': 'ip2tor.fulmo.org', 'created_at': '2020-06-28T19:35:56Z', 'modified_at': '2020-06-28T19:35:56Z', 'ip': '3.127.188.50', 'name': 'aws1', 'is_testnet': False, 'offers_tor_bridges': True, 'tor_bridge_duration': 86400, 'tor_bridge_price_initial': 40000, 'tor_bridge_price_extension': 24000, 'offers_rssh_tunnels': False, 'rssh_tunnel_price': 1000, 'terms_of_service': '-', 'terms_of_service_url': '-', 'owner': 2, 'tor_bridge_duration_hours': 24, 'tor_bridge_price_initial_sats': 40, 'tor_bridge_price_extension_sats': 24}
Error Detail:
{'url': 'https://ip2tor.fulmo.org/api/v1/public/pos/51b5fc57-65fe-4e28-83ac-7eeb1253c132/', 'status': 'T', 'message': None, 'item_details': [{'url': 'https://ip2tor.fulmo.org/api/v1/public/po_items/42c8485e-85a4-418a-8591-0085fbd8998e/', 'product_id': '81668a8e-997f-4ede-840d-54a92a30a64c', 'product': {'url': 'https://ip2tor.fulmo.org/api/v1/tor_bridges/81668a8e-997f-4ede-840d-54a92a30a64c/', 'id': '81668a8e-997f-4ede-840d-54a92a30a64c', 'comment': 'test', 'status': 'I', 'host': {'ip': '3.127.188.50', 'name': 'aws1', 'site': {'domain': 'ip2tor.fulmo.org', 'name': 'IP2Tor@Fulmo'}, 'is_testnet': False}, 'port': 39352, 'target': 'wckfqsu4sq3k6zw3nexixdrbfwmloz4vsh7iuwmnnjoyw6umd6ifzvid.onion:443', 'suspend_after': '2020-07-23T21:08:43Z'}, 'position': 0, 'price': 40000, 'quantity': 1, 'po': 'https://ip2tor.fulmo.org/api/v1/public/pos/51b5fc57-65fe-4e28-83ac-7eeb1253c132/'}], 'ln_invoices': [{'url': 'https://ip2tor.fulmo.org/api/v1/public/invoices/bf90b424-0ab7-4189-99c9-81c808caa7c3/', 'lnnode_id': '8051ccde-3d83-436d-a4cb-7a79fbcb3897', 'tax_currency_ex_rate': '8096.15', 'info_currency_ex_rate': '9367.00', 'price_in_tax_currency': '0.00 €', 'tax_in_tax_currency': '0.00 €', 'price_in_info_currency': 'US$0.00', 'created_at': '2020-07-22T20:58:50Z', 'modified_at': '2020-07-22T20:59:03Z', 'label': 'PO: 51b5fc57-65fe-4e28-83ac-7eeb1253c132', 'msatoshi': 40000, 'tax_rate': '16.00', 'tax_currency_ex_rate_currency': 'EUR', 'info_currency_ex_rate_currency': 'USD', 'payment_hash': None, 'payment_request': None, 'status': 1, 'pay_index': None, 'description': None, 'metadata': '', 'expiry': 900, 'creation_at': None, 'expires_at': None, 'paid_at': None, 'qr_image': None}], 'timestamp': '2020-07-22T21:01:02Z'}

@frennkie
Copy link
Contributor

Autossh ist still not working for me... I have to change the - M 0 to - M 20000 every time and forgot after upgrading to RC3.

Invoices should work again.

@rootzoll
Copy link
Collaborator Author

@frennkie should we change something in the internet.sshtunnel.py script?

Autossh ist still not working for me... I have to change the - M 0 to - M 20000 every time and forgot after upgrading to RC3.

ExecStart=/usr/bin/autossh -M 0 -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=2 [PLACEHOLDER]

@frennkie
Copy link
Contributor

frennkie commented Jul 23, 2020

I'm wondering whether I am the only person using this or if I misconfigured something on the sshd side.

I would say the safest thing would be that we stick with the default (-M 0) but allow for customization via raspiblitz.conf.

@frennkie frennkie reopened this Jul 23, 2020
@rootzoll
Copy link
Collaborator Author

@frennkie can you open a seperate issue for that - marked for v1.7?

@frennkie
Copy link
Contributor

frennkie commented Jul 23, 2020

Done.... I'm in parallel working on Django-IP2Tor to implement a heartbeat from the Hosts and a alive check for the Lightning Nodes..

Makes no sense to list stale hosts or hosts for which no LND backend is available to create invoices.

@grnqrtr
Copy link
Contributor

grnqrtr commented Jul 25, 2020

After getting my other issues figured out, I got back to testing this again and just wanted to report that my new ip2tor bridge subscription for BTCPay is up and running fine with the Let's Encrypt subscription. Things are working well, very cool!

btcpay_works

Just thought I'd mention one thing, after seeing this screen it took probably 5~10 minutes before I could access the new bridge:

btcpay_tor2ip

I almost cancelled the subscription and was going to try with the other option tondro01 instead of aws1 because I thought it wasn't working. But give it a few minutes and things are working well :)

@frennkie
Copy link
Contributor

frennkie commented Jul 25, 2020

Just thought I'd mention one thing, after seeing this screen it took probably 5~10 minutes before I could access the new bridge

From the server logs I have:

>>> b.created_at.isoformat()
'2020-07-25T01:51:43.347113+00:00'
>>> b.modified_at.isoformat()
'2020-07-25T01:52:22.458111+00:00'

Systemd: active (running) since Sat 2020-07-25 01:52:22 UTC; 9h ago

So it should not have taken more than one minute to be available.

@grnqrtr
Copy link
Contributor

grnqrtr commented Jul 25, 2020

I don't know, maybe it was something on my end then. I kept refreshing the page, but didn't come up for a while.

@rootzoll rootzoll modified the milestones: 1.6 Release, 1.6.1 Release Aug 5, 2020
@rootzoll
Copy link
Collaborator Author

OK tested again and making a subscription is still working. Closing this issue for v1.6.1 release.
For reporting operational problems to improve the service further new issues shoulbe be opened or added to existing like: #1662

@rootzoll rootzoll removed the final testing was fixed - needs testing label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants