Https setup of Freematics Hub

Discussion about software developed by Freematics, including Freematics Builder and Freematics Emulator GUI
Post Reply
victorch
Posts: 11
Joined: Wed Jun 10, 2020 11:42 pm

Https setup of Freematics Hub

Post by victorch »

Hello,

I setup Freematics hub in linux cloud platform running on http(http://www.serverxxx.com:8080) without problem and that is great. How can I setup Freematics hub(the mini server) to run on https (https://www.serverxxx.com) - similar to https://hub.freematics.com ?


Best regards and thanks,

Victor
wally2511
Posts: 11
Joined: Fri Apr 09, 2021 3:11 pm

Re: Https setup of Freematics Hub

Post by wally2511 »

This is a good question! I imagine that you are going to have to purchase a ssl cert and configure the webserver to use it.
Sometimes you can generate a self-signed SSL cert and manually install it on the client and server.
victorch
Posts: 11
Joined: Wed Jun 10, 2020 11:42 pm

Re: Https setup of Freematics Hub

Post by victorch »

Hi Matt,

Yes, I can use self-signed SSL and enable SSL on a Apache web server by using a2enmod ssl etc on a Linux platform. However, I would like to
enable SSL on FreeMatics hub server so that everything sends to this server is secure.

Currently, I can start FreeMatics hub server by ./teleserver -p 8080 or even ./teleserver -p 443, but I believe it is just
port assignment, not SSL enabled in teleserver.c . Do you have idea how to enable SSL in some place
of Freematics-master\server\teleserver, thanks.


Best regards and thanks,


Victor
victorch
Posts: 11
Joined: Wed Jun 10, 2020 11:42 pm

Re: Https setup of Freematics Hub

Post by victorch »

Hi Matt,

I use Nginx and it works, thanks.

Cheers,

Victor
wally2511
Posts: 11
Joined: Fri Apr 09, 2021 3:11 pm

Re: Https setup of Freematics Hub

Post by wally2511 »

Hey Victor,

This is great new, have you got a walk through or rough guide on how you did it?

Cheers

Matt
victorch
Posts: 11
Joined: Wed Jun 10, 2020 11:42 pm

Re: Https setup of Freematics Hub

Post by victorch »

Hi Matt,

Please see below some steps for linux platform :


1. sudo apt update
sudo apt install nginx

2. Type below to check version
nginx -v

# Ubuntu repositories
nginx version: nginx/1.1x.0 (Ubuntu)

3. Create self sign certificate for testing
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/private1.key -out /etc/ssl/certs/cert1.crt

4 . In /etc/nginx/sites-available/default file, modify as following :

server {

listen 443 ssl default_server;
listen [::]:443 ssl default_server;

root /var/www/html;
ssl_certificate /etc/ssl/certs/cert1.crt;
ssl_certificate_key /etc/ssl/private/private1.key;

server_name _;
location / {

# forward to 8080
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://127.0.0.1:8080";
}

5. Restart ngnix
systemctl restart nginx

**Ensure to stop apache if you have apache installed to prevent conflict

6. Run the ./teleserver -p 8080 in linux platform to start Freematics hub server
7. In telelogger , put ip or url e.g. www.serverxxx.com, port 443, so that traffic will go to Freematics hub server running in 8080 port via
ssl.


Cheers,

Victor
Post Reply