Secure Connection in Android App

This my question too. It looks like Android app needs a certificate installed. Where do I get this? Here are some screen shots.

Here is my second screen shot.

You quoted a question @gitMiguel already quoted from someone else. Did you read and understand what @gitMiguel answered?

1 Like

It really doesn’t need any certificates. They are optional.

You have to make them.

Please get your self familiar with server and client certificates and how to setup them. As I stated in my earlier post google is your friend. Here’s a few links to get you started:

Can you make a screenshot of the preference subpages (local and remote)? You should redact the user name before posting.

There’s a post by @slawekjaranowski about SSL client certificates: Using NGINX Reverse Proxy for client certificate authentication - start discussion

In fact that one is opened when touching the question mark in the screenshot :wink:
Maybe we could/should improve context by linking the help icon to a short docs page giving a bit of context, which then links to the discussion thread.

That’s a good idea :+1:

Did you change something? Or does it still show “Insecurely connected to myopenHAB” on the main settings page?

No.

Still the same. It says “Insecurely connected” but it’s not connected like I explain in the next post.

I am adding this info in hopes it will shed more light on it. On my phone I can login fine to myopenHAB.org using a browser but not with the app. This is what I get when trying to connect remotely.

There’s a bug that causes all connections shown as insecure: https://github.com/openhab/openhab-android/pull/1649

@elwyngoossen Your connections shouldn’t be shown as insecure anymore with the latest beta.

@elwyngoossen I’m having the same problem as you. I have a reverse proxy (Nginx) set up on openhabian. I can connect fine from a browser, but not the OpenHab app. I get the same message as you. Have tried the Beta version, but is the same.
Did you manage to fix yours?

Does openhabian come with an nginx reverse proxy? Can you post the config here?

@mueller-ma The Nginx remote proxy can be installed using one of the options in openhabian-config. There is a guide here:

It’s not exactly plug and play though. I’m using DuckDns so I had to use the troubleshooting guide near the end to get the certificates accepted. Also, for some reason the secure certificate location entries in my /etc/nginx/sites-enabled folder entry were hashed out, so I had to unhash them to get it working.

As I mentioned above, I can connect remotely with a Web browser, but not with the OpenHAB Android app.

1 Like

Please post the files in /etc/nginx/sites-enabled/ (redact any personal information, like url).

I have one file in /etc/nginx/sites-enabled named openhab. Contents as below (I have replaced my Internet URL with <your_internet_url>):

#################################
# openHABian NGINX Confiuration #
#################################

## Redirection
server {
   listen                          80;
   server_name                    <your_internet_url>;
   return 301                      https://$server_name$request_uri;
}

## Reverse Proxy to openHAB
server {
#    listen                          80;
   listen                          443 ssl;
    server_name                     <your_internet_url>;
   add_header                      Strict-Transport-Security "max-age=31536000; includeSubDomains";

    # Cross-Origin Resource Sharing.
 add_header 'Access-Control-Allow-Origin' 'http://localhost:8080/rest';
    add_header 'Access-Control-Allow_Credentials' 'true';
    add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';

## Secure Certificate Locations
   ssl_certificate                 /etc/letsencrypt/live/<your_internet_url>/fullchain.pem;
   ssl_certificate_key             /etc/letsencrypt/live/<your_internet_url>/privkey.pem;

    location / {
        proxy_pass                              http://localhost:8080/;
#        proxy_buffering                         off;  # openHAB supports non-buffering specifically for SSEs now
        proxy_set_header Host                   $http_host;
        proxy_set_header X-Real-IP              $remote_addr;
        proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto      $scheme;

# Password Protection
       auth_basic                              "Username and Password Required";
       auth_basic_user_file                    /etc/nginx/.htpasswd;
    }

## Let's Encrypt webroot location
#   location /.well-known/acme-challenge/ {
#       root                                    /var/www/<your_internet_url>;
#   }
}

# vim: filetype=conf