Jump to content

How to run BLOCK Enterprise Xrouter through Cloudflare Proxy


buzzkillb
 Share

Recommended Posts

Read the docs over a few times on how to setup Enterprise Xrouter.

https://gist.github.com/Aderks/e3ebee5730b337ca7e0d3510155c9e05 and https://github.com/blocknetdx/exrproxy

Basically the first example is putting the uwsgi.ini file in /xrproxy directory so I am going to throw the extra cloudflare certificates in same folder to make this as easy as possible.

Once you get setup the docker run command I am using for this setup is

docker run -d --name=xrproxy -p 80:80 -p 443:443 -v=/xrproxy:/opt/uwsgi/conf blocknetdx/xrouterproxy:latest

First we want to put the Cloudflare Certificates into the /xrproxy folder, so login to Cloudflare.

Go to SSL/TLS -> Origin Server -> Create Certificate and either use the default or like I did, specifiy the full subdomain. Here I am showing example.denarius.pro for the example. Click Next.

image.png.b898b8b522abe1afdc51597b6072c2c1.png

Insert Origin Certificate into a cert.pem

sudo nano /xrproxy/cert.pem

Insert Private Key into key.pem

sudo nano /xrproxy/key.pem

Not sure if cloudflare.crt matters but do it anyways.

Download and copy https://support.cloudflare.com/hc/en-us/article_attachments/360044928032/origin-pull-ca.pem into  cloudflare.crt

sudo nano /xrproxy/cloudflare.crt

below for easy to copy and paste cloudflare.crt

-----BEGIN CERTIFICATE-----
MIIGCjCCA/KgAwIBAgIIV5G6lVbCLmEwDQYJKoZIhvcNAQENBQAwgZAxCzAJBgNV
BAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMRQwEgYDVQQLEwtPcmln
aW4gUHVsbDEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzETMBEGA1UECBMKQ2FsaWZv
cm5pYTEjMCEGA1UEAxMab3JpZ2luLXB1bGwuY2xvdWRmbGFyZS5uZXQwHhcNMTkx
MDEwMTg0NTAwWhcNMjkxMTAxMTcwMDAwWjCBkDELMAkGA1UEBhMCVVMxGTAXBgNV
BAoTEENsb3VkRmxhcmUsIEluYy4xFDASBgNVBAsTC09yaWdpbiBQdWxsMRYwFAYD
VQQHEw1TYW4gRnJhbm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zVEwXKf34pPFCACWVMZxbQjkNRTiH8iRur9EsaNQ5oXCPJkhwg2+IFyoPAAYURoX
VcI9SCDUa45clmYHJ/XYwV1icGVI8/9b2JUqklnOTa5tugwIUi5sTfipNcJXHhgz
6BKYDl0/UP0lLKbsUETXeTGDiDpxZYIgbcFrRDDkHC6BSvdWVEiH5b9mH2BON60z
0O0j8EEKTwi9jnafVtZQXP/D8yoVowdFDjXcKkOPF/1gIh9qrFR6GdoPVgB3SkLc
5ulBqZaCHm563jsvWb/kXJnlFxW+1bsO9BDD6DweBcGdNurgmH625wBXksSdD7y/
fakk8DagjbjKShYlPEFOAqEcliwjF45eabL0t27MJV61O/jHzHL3dknXeE4BDa2j
bA+JbyJeUMtU7KMsxvx82RmhqBEJJDBCJ3scVptvhDMRrtqDBW5JShxoAOcpFQGm
iYWicn46nPDjgTU0bX1ZPpTpryXbvciVL5RkVBuyX2ntcOLDPlZWgxZCBp96x07F
AnOzKgZk4RzZPNAxCXERVxajn/FLcOhglVAKo5H0ac+AitlQ0ip55D2/mf8o72tM
fVQ6VpyjEXdiIXWUq/o=
-----END CERTIFICATE-----

Now that we have the certs setup, make sure your Cloudflare is showing proxied, and start or restart the docker container.

docker restart xrproxy

Enter the Docker container to edit the nginx file to add the certs.

docker exec -it xrproxy /bin/bash

I use nano so I installed nano before editing the file.

apt update
apt install nano

Edit nginx.conf

nano /etc/nginx/nginx.conf

An example of what this ends up looking like

    server {                                                                       
        # Running port                                                             
        #listen 80;                                                                 
        listen              443 ssl;                                              
        server_name         api.denarius.pro;                                      
        ssl_certificate     /opt/uwsgi/conf/cert.pem;                                  
        ssl_certificate_key /opt/uwsgi/conf/key.pem;                                  
                                                                                   
        # Proxying connections to application servers                              
        location / {                                                               
                                                                                   
        } 

Save and exit nano, restart nginx inside the docker container.

service nginx restart

Type exit to exit the docker container. If you remove this docker container, you will need to setup nginx again. This part should now work.

On the blocknet service node, xrouter.conf I used port=80 and tls=1

I forked the original and added api.denarius.pro just so I could test this out myself. https://github.com/buzzkillb/exrproxy/blob/master/Dockerfile#L76

Examples below of calls to different coin daemons.

https://api.denarius.pro/xr/BTC/xrGetBlockCount
https://api.denarius.pro/xr/D/xrGetBlockCount

https://api.denarius.pro/xr/LTC/xrGetBlockCount
https://api.denarius.pro/xr/XSN/xrGetBlockCount

image.png.d300a191c614152cf795930a1cf9487d.png

After its all working your node should show up here under whatever coins you are running, and also say Enterprise under Type.

https://service-explorer.core.cloudchainsinc.com/#/spv-wallets

  • The D 1

If you enjoy my content please consider donating to the Denarius creator - https://www.patreon.com/carsenk
Join Denarius Discord - https://discord.gg/JQEmXwb

Link to comment
Share on other sites

If you want to try running exrproxy in a docker container on Proxmox LXC, create your ubuntu 20.04 template container, don't start it yet, then go to Options and double click Features and checkmark nesting.

image.png.1954dea893a0f7a139134ab0e968f250.png

Startup the container and install docker

apt update
apt install docker.io
docker run hello-world

 

If you enjoy my content please consider donating to the Denarius creator - https://www.patreon.com/carsenk
Join Denarius Discord - https://discord.gg/JQEmXwb

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...