Proxy configuration
Configure the proxy for your node. Part 4 of 5 in the Zero to Node tutorial.
This section will help you set up the proxy setting on your node.
Setup SSL
Pocket requires that nodes have an SSL certificate for secure communications. SSL (Secure Sockets Layer) is a layer of security that sits on top of TCP/IP. It's used to encrypt the data sent between a client and a server. To use SSL, you need to have a certificate and a key. Thankfully, getting an SSL certificate is straightforward and free.
To get a certificate, we'll be using Let's Encrypt which is a service that issues SSL certificates for free. We'll also be using software called certbot to register, install, and renew the certificate.
Registering an SSL certificate
We installed certbot in a previous step so we just need to use it to request a certificate.
To get a certificate, we'll need to use the certbot
command with the following options:
--register-unsafely-without-email
: This option is required to get a certificate without an email address.--agree-tos
: This option is required to agree to the Let's Encrypt Terms of Service.--nginx
: This option is required to use the nginx plugin.--no-redirect
: This option is required to disable the redirect to the Let's Encrypt website.--domain
: This option is required to specify the domain name.
Here's an example of how to request a certificate. Just replace $HOSTNAME
with the DNS name of your node:
The output from this command should confirm that the certificate was successfully registered.
Testing your certificate
To be sure, you'll also want to test that the certificate is working.
There is a command that certbot provides to test your certificate. It's used for testing the auto-renewal of the certificate but it also confirms that the certificate is working. You can run it using the following command:
The resulting output should confirm that the certificate is working.
Configure Nginx
Nginx is a web server. We installed it in aprevious step but we need to do some additional configuration.
Nginx uses config files to define servers and routes for incoming requests. For Pocket nodes, nginx needs to relay public requests to a local HTTP server that pocket core is running. This is referred to as the proxy. We'll also need to proxy requests made by the Pocket CLI. For example, when we run the command pocket query height
, the CLI makes an http request to the node's local HTTP server.
Config files
The nginx configuration files we're interested in are located in the /etc/nginx/sites-available/
directory. In that directory there is a default configuration file named default
. This is the configuration that is created when you install nginx, but we'll be creating our own for our node.
To configure nginx:
Confirm the name of your SSL certificate:
Create a new config file with nano:
Add the following code but change the hostname values (
pokt001.pokt.run
) to your node's DNS hostname:Save the change with
Ctrl+O
.Exit nano with
Ctrl+X
.Stop nginx with:
Disable the default configuration:
Enable our new configuration:
Start nginx:
Enable UFW
We're almost done, but before we finish we'll make our server more secure by setting firewall rules to limit network exposure. The Uncomplicated Firewall (UFW) is a security tool that makes configuring the firewall reasonably simple. We'll use it to disable unnecessary ports.
Ports you need to open
For running a Pocket node, you'll need to open the following ports:
22
: SSH80
: HTTP443
: HTTPS8081
: For the Pocket HTTP API26656
: For the Pocket RPC API
Use UFW to disable unnecessary ports
To use UFW to configure the firewall:
Enable UFW. When prompted, press
y
to confirm:Set the default to deny all incoming connections:
Allow the SSH port:
Allow port 80:
Allow port 443:
Allow port 8081:
Allow port 26656:
That's it for the UFW setup. Let's just check the status to confirm the ports are open. To do that, run the following command:
After confirming only the necessary ports are open, you can move on to the final steps.
Last updated