Bubble proxy service
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

README.md 5.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. bubble-flexrouter
  2. =================
  3. bubble-flexrouter provides HTTP/HTTPS proxy services for Bubble.
  4. Some websites and apps refuse to respond to requests originating from a cloud IP address.
  5. Thus, when a user is connected to their Bubble, some sites and apps will not work.
  6. With flex routing, Bubble can route these requests through a device connected to the Bubble that is running bubble-flexrouter.
  7. Now, from the perspective of the website or app, these requests will originate from a "clean" IP, and so a valid response
  8. will be sent.
  9. Note that using flex routing does remove some privacy protection - sites and apps that are flex-routed will see
  10. one of your device's real IP addresses.
  11. # Installation
  12. There are a few steps to installation:
  13. * Generate the flex-router password
  14. * Create an SSH key pair
  15. * Create an empty auth token file
  16. * Install system service
  17. ## Generate the bubble-flexrouter password
  18. During installation, choose a password for the service. It should be random and at least 30 characters long.
  19. Store this password in securely someplace where the app can read it. Ideally this is *not* on the filesystem,
  20. but in some internal app storage mechanism, since it will be stored in plaintext.
  21. Bcrypt the password (use 12 rounds) and store the bcrypted value in a file. This file should only be readable by
  22. the bubble-flexrouter system service.
  23. ## Create an SSH key pair
  24. During installation, generate an RSA key pair:
  25. ssh-keygen -t rsa -f /some/secure/location
  26. In the above, `/some/secure/location` should be a path that is only readable by the bubble-flexrouter system service.
  27. When this step is done, `/some/secure/location` should be the path to the SSH private key and
  28. `/some/secure/location.pub` should be the path to the SSH public key.
  29. ## Create an empty auth token file
  30. bubble-flexrouter uses an auth token to secure its connection to a Bubble. This token is written to a file during
  31. registration (described below).
  32. During installation, create an empty file that is only readable/writeable by the bubble-flexrouter service.
  33. ## Install system service
  34. Install bubble-flexrouter as a system service (Windows Service or Mac OS launch daemon) during Bubble app installation.
  35. It should always be running. Set it to run at system startup.
  36. The service requires some environment variables to be set:
  37. * `BUBBLE_FR_SSH_KEY` - full path to the *private* SSH key
  38. * `BUBBLE_FR_PASS` - full path to the bcrypted password file
  39. * `BUBBLE_FR_TOKEN` - full path to the auth token file
  40. Run the service with these environment variables set.
  41. ## Uncommon configuration
  42. By default bubble-flexrouter will listen on 127.0.0.1 on ports 9823 and 9833.
  43. If these ports are unavailable, you can change them with command line arguments to bubble-flexrouter.
  44. Run `bubble-flexrouter --help` to see the full list of command line options. Usually you will not need to set any arguments.
  45. # Registering
  46. When a user successfully logs in to a Bubble node, the API response will include a session token. Use this token
  47. and the bubble-flexrouter password to register the flexrouter with the Bubble.
  48. To register the flexrouter with the Bubble, send a registration request to the admin port, listening on 127.0.0.1:9833
  49. This request must include the request header `Content-Type: application/json`
  50. POST http://127.0.0.1:9833/register
  51. {
  52. "password": "<password>",
  53. "session":"<session-token>",
  54. "bubble":"<bubble-hostname>",
  55. "ip":"<client-vpn-ip>"
  56. }
  57. Where:
  58. * `<password>` is the bubble-flexrouter password that was generated during installation
  59. * `<session-token>` is the session token returned when the used logged in (usually from the `auth/login` API call)
  60. * `<bubble-hostname>` is the hostname of the Bubble that the app has connected to
  61. * `<client-vpn-ip>` is the VPN IP address that was assigned to the device (usually starts with `10.`)
  62. A successful registration request will return HTTP status 200. Any other response indicates a failure, and the response
  63. body will contain a plaintext string with an error message.
  64. An example using curl:
  65. curl -v -H 'Content-Type: application/json' \
  66. -d '{"password":"Uy6dDwNP5msid3P6QEpeVmQMuUiAda","session":"47cc4974-2eca-47d8-8c74-c2cc106b9ba8","bubble":"nexus-dr66b-wn85d-ux27e.bubv.net","ip":"10.19.49.12"}' \
  67. http://127.0.0.1:9833/register
  68. # Unregistering
  69. When a user logs out of a Bubble node, unregister the flexrouter by sending a request to the admin port.
  70. This request must include the request header `Content-Type: application/json`
  71. POST http://127.0.0.1:9833/unregister
  72. {
  73. "password": "<password>"
  74. }
  75. Where:
  76. * `<password>` is the bubble-flexrouter password that was generated during installation
  77. A successful unregister request will return HTTP status 200. Any other response indicates a failure, and the response
  78. body will contain a plaintext string with an error message.
  79. An example using curl:
  80. curl -v -H 'Content-Type: application/json' \
  81. -d '{"password":"Uy6dDwNP5msid3P6QEpeVmQMuUiAda"}' \
  82. http://127.0.0.1:9833/unregister
  83. # Uninstallation
  84. If the Bubble app is uninstalled from the system, then also:
  85. * Stop and remove the system service
  86. * Remove the bcrypted password file
  87. * Remove both files of the SSH key pair
  88. * Remove the auth token file