Can OSMC/Kodi show strm files pointing to an https server?

OSMC Kodi on Raspberry Pi3B
I have a Linux (Ubuntu 18 LTS) server sitting at home and it is configured to show videos via a web browser. To secure the system I have published the server via https (self-signed certificate). My videos are accessible on a certain https url in a directory structure. This works fine using Firefox or Chrome. The source dir is also shared locally to my Kodi box at home and it can browse the files and play the videos.
Now I am in my summer home with another OSMC (on RPi3) and no file share access to the videos…
So I figured that I might be able to use Kodi acting as a web stream player…
This is what I have found:
If I create a file with the extension strm containing the URL to an mp4 file on a webserver and I store this in a “stream” directory on my Kodi box Kodi can actually play that file!
However, my test was done towards my ISP web server with straight http:// protocol.
When I modify the strm file to contain the URL to my home server it does not work even if I add the user:login to the URL as follows:

https://<username>:<password>@< URL to mp4 file >

When I try this strm file Kodi just “blinks” some kind of error message impossible to read and then stays in the stream directory.

What is needed in order to play a stream file on Kodi from a https server?

My alternate solution is to transfer all the videos to my ISP webserver and use http:// protocol instead, but it would involve massive file transfers to the server and also makes it less secure not using https:// protocol…

So if at all possible I want to use my home server as the source…

I guess a https server that can stream

Why not use an openvpn connection to your server. Would be more performant and more secure

Why not use https://letsencrypt.org/ in combination with a dyndns provider of your choice, to make a real cert and not use self signed?

It’s rather simple and FREE.

Then setup the webserver to use the FQDN you used in the cert, as virtual host.

Probably because it’s now (self-signed) https.

Have you tried to wget a file:

https://< URL to mp4 file >

and also with the username/password, just for completeness, though I doubt if it’s supported:

https://<username>:<password>@< URL to mp4 file >

When you access the self-signed certificate via a browser, since it’s not been issued by a trusted Certificate Authority you’ll probably get a warning and the option to back out or proceed. While I’m not familiar with the way Kodi handles https, it’s likely to operate in a similar way. To overcome this issue, you might want to consider @joakim_s’s advice and use Let’s Encrypt.

I did not think about wget, but now I have used PuTTY to get to a command prompt on the OSMC Kodi box:

wget https://user:passwd@home.mydomain.com/videos/myvideo.mp4
--2019-07-30 15:13:20--  https://user:*password*@home.mydomain.com/videos/myvideo.mp4
Resolving home.mydomain.com (home.mydomain.com)... 176.10.xx.yy
Connecting to home.mydomain.com (home.mydomain.com)|176.10.xx.yy|:443... connected.
ERROR: The certificate of 'home.mydomain.com' is not trusted.
ERROR: The certificate of 'home.mydomain.com' hasn't got a known issuer.

So there is an error regarding the certificate…
Is there no way to declare this specific certificate OK?

But I cannot do that, because the server also is a Subversion backup server and the configuration including the https access is already fixed…

Seems like what I need. :slight_smile:
I had a look at /etc/ssl/certs and it contains a lot of entries that are not really files by the look of things…
How does one go about importing a cert from the server into OSMC?
a) What file from tghe server to use?
b) What does one do on the OSMC box?

Wouldn’t it be a lot easier just using Plex?

What is “Plex”?

It is a project that forked off of XBMC many years ago. You would install a Plex server on your Ubuntu box and set that to scrape your media. Once you have that done you would be able to stream any of your media local or remote just by installing a Plex Player and feeding it a user/pass. You can use the server and some of the players for free. I believe the Kodi plugin works without having a paid account (Plexpass). You would get an easier setup, the ability to browse your content in a manner similar to Kodi, and it will even transcode on the fly if needed.

I don’t use it for my own use but I installed it for my kid when she moved out of town. I have the Plex server running on my server along side of everything else and I am able to just ignore it. It does not seem to have much impact on the system and it auto scrapes so I don’t have to do any maintenance. When she wants to watch something she just pulls up Plex on her game console and it has been working well.

1 Like

Where you stored the .crt file on your Ubuntu box i don’t know, but the guide you followed should have the destination folder mentioned like this does:

https://hostadvice.com/how-to/how-to-install-a-self-signed-ssl-certificate-for-apache-on-ubuntu-18-04-server/

Copy the server generated crt file to your osmc device, then run this on your osmc client device:

sudo cp my.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

Replace my.crt with your .crt file

Still unsure if Kodi uses this method

Thanks a lot!
I did as follows using PuTTY to OSMC and to the video server:

  • Created a new file myserver.crt inside /home/osmc
  • Used nano to edit it
  • copy/pasted the crt file content from the server’s /etc/ssl/certs/ dir
  • Then used your commands above to copy the file and update the certs
  • Opened Kodi on the TV and selected the strm file that did not work before

Result: The file plays OK!

So I am good now, I just have to modify the script I use to manage the video files so it enters the correct URL into the strm files it creates.

Thanks again!!! :slight_smile:

PS:
Is there a way to put user:password@ somewhere else than in cleartext in the URL?
Maybe some kind of placeholder that is replaced by Kodi on execution with the proper login?

1 Like