Need help setting up OwnCloud with SSL

Status
Not open for further replies.

INCSlayer

Contributor
Joined
Apr 4, 2015
Messages
197
have you tried looking in that thread? because i know for a fact that within the first 5 pages cyberjock has a guide which contains everything you need. and I know it works because i used it about 2 weeks ago when i set my owncloud up
 

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
have you tried looking in that thread? because i know for a fact that within the first 5 pages cyberjock has a guide which contains everything you need. and I know it works because i used it about 2 weeks ago when i set my owncloud up

+1 Cyberjocks instructions will get you setup with a self-created SSL certificate.
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
Yeah, I am going to do the cyberjock's instructions again, because I forgot to register the website after I made it with no-ip.com (lol) and thought that it wasn't working :)
Thank you all for the help, will post back in a lil bit...
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
...and if you have the system configured to do SSL, it shouldn't be too hard to get a trusted cert for free from letsencrypt.org--though probably easier to use one of the unofficial clients like letsencrypt.sh.
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
...and if you have the system configured to do SSL, it shouldn't be too hard to get a trusted cert for free from letsencrypt.org--though probably easier to use one of the unofficial clients like letsencrypt.sh.
I think that cyberjocks guide is about making your own signed certificate...no? or what you are saying is different?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Two important parts of TLS/SSL configuration are getting the cert, and configuring your server software (nginx, in this case) to use the cert. @cyberjock's guide does describe creating your own self-signed certificate, and also configuring nginx to use that cert. What I'm saying is that, having configured your server to do TLS, it's easy enough to put in a "real", trusted cert, and those are fairly easy (and completely free) to get from Let's Encrypt.
 
Last edited:

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
Two important parts of TLS/SSL configuration are getting the cert, and configuring your server software (nginx, in this case) to use the cert. @cyberjock's guide does describe creating your own self-signed certificate, and also configuring nginx to use that cert. What I'm saying is that, having configured your server to do TLS, it's easy enough to put in a "real", trusted cert, and those are fairly easy (and completely free) to get from Let's Encrypt.
ohhhh, got you..! but I am very new to all this, how would I go about doing that? can you please help me?? I have setup the owncloud jut like Joshua posted here
https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/
and now I am going to do all the remote access things, what would be my next step (I have NOT done the cyberjock stuff yet). If you could please tell me, that would be awesome. Thanks mate.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Well, here's a start, but it's going to be rough. I'm somewhat familiar with using letsencrypt.sh, but only on Linux systems, and things are a little different on FreeBSD. These steps will pretty much replace step 3 in @cyberjock's instructions. Assumptions:
  • You have a hostname accessible from the Internet
  • Port 80 is forwarded to your Owncloud jail. IOW, http://yourhostname.tld will bring up the web server in your owncloud jail.
  • You've already installed Owncloud as described, and it's running.
  • Nano is installed as an editor. If you prefer a different editor, substitute it for nano in the instructions below
Edit: Caveat: The instructions below should be basically correct, but I can't directly test them, because I run my own server that listens on port 80. I therefore can't forward port 80 to a jail on my FreeNAS box, which would be necessary in order to properly test.

Letsencrypt.sh is a bash script to handle generating and renewing certificates from letsencrypt.org. Conveniently, it's available as a FreeBSD package. These steps should get you started, from inside your owncloud jail:
  • pkg install letsencrypt.sh
  • mkdir -p /usr/local/www/.well-known/acme-challenge
  • cd /usr/local/etc/letsencrypt.sh
  • nano domains.txt
  • Enter your hostname. That's it. Ctrl-X to exit, Y to save
  • cp config.sh.example config.sh
  • nano config.sh
  • Most of the contents here can be left at their defaults. Uncomment the line setting WELLKNOWN, and set it to "/usr/local/www/.well-known/acme-challenge". You'll also want to uncomment the CONTACT_EMAIL line and set it to an email address to receive notifications from the LE system. Ctrl-X to exit, Y to save.
  • nano /usr/local/www/.well-known/acme-challenge/test.txt
  • Enter whatever you want in test.txt. chmod 666 /usr/local/www/.well-known/acme-challenge/test.txt
  • Browse to http://$YOURHOSTNAME/.well-known/acme-challenge/test.txt, and make sure you see the contents of that file. Ideally, you should do this test from outside your network (using the Tor browser, for example, or by turning off the WiFi on your smartphone/tablet). If you don't, then stop--something's wrong (or at least not as I expect it to be) with your nginx configuration. $YOURHOSTNAME should be exactly the same as you entered in domains.txt.
  • If the test above succeeded, run 'letsencrypt.sh -c'. It should run and create your certificate.
  • If the above succeeded, your certificate is in /usr/local/etc/letsencrypt.sh/certs/$YOURHOSTNAME/fullchain.pem, and the server private key is in /usr/local/etc/letsencrypt.sh/certs/$YOURHOSTNAME/privkey.pem. Use these pathnames for the remainder of @cyberjock's walkthrough
Let's Encrypt will give you a trusted TLS certificate for your server. It's only good for 90 days, however. letsencrypt.sh is designed to be run automatically, from a cron job, to renew your cert whenever it has less than 30 days remaining. To enable this, edit /etc/periodic.conf and add the following lines:
  • weekly_letsencrypt_enable="YES"
  • weekly_letsencrypt_deployscript="/usr/local/etc/rc.d/nginx reload"
Yes, this is more involved than the steps @cyberjock gave. However, it will give you a trusted certificate (green padlock in your browser), and it will automatically renew indefinitely.
 
Last edited:

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
OK, nice, thanks for the guide and the thorough explanation. So, I will follow cyberjock's sguide step 1 and 2, then do what you tole me above, and continue with steps 4 and 5? or by doing this am i exempt from that? Again, thanks for the HUGE help mate. I really want to setup this owncloud for remote use. THANKS THANKS THANKS.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
So, I will follow cyberjock's sguide step 1 and 2, then do what you tole me above, and continue with steps 4 and 5?
Correct, though note the caveat I added above. In step 5, you'll use the pathnames I mentioned (/usr/local/etc/letsencrypt.sh/...) for ssl_certificate and ssl_certificate_key.

The other thing you'd probably want to do is set a redirect so that http://yourserver goes to https://yourserver. I don't know nginx well enough to tell you how to do that (I barely know how to do it with Apache).
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
Ah ok got it..! Thanks mate. I will report back to you with the results of your masterpiece :) ill be in contact..!
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
  • If the test above succeeded, run 'letsencrypt.sh -c'. It should run and create your certificate.
Hello, everything is going good so far, but when I get to the ---- run 'letsencrypt.sh -c'.---- part, it tells me that:
run: Command not found.

any idea what is going on?
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
NVM, got it, just had to put " " and put it closer to the = sign :)

still working on the rest...
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
Correct, though note the caveat I added above. In step 5, you'll use the pathnames I mentioned (/usr/local/etc/letsencrypt.sh/...) for ssl_certificate and ssl_certificate_key.

The other thing you'd probably want to do is set a redirect so that http://yourserver goes to https://yourserver. I don't know nginx well enough to tell you how to do that (I barely know how to do it with Apache).
OOOOOK, sooo.....I finished the setup, everything went pretty smooth from there on out. BUT,
when I try to access the different places i get the following: (80 is the port i setup in nginx and router)

1- for https://<HOSTNAME>/owncloud/
i get
This site can’t be reached
192.168.0.2 refused to connect.

ERR_CONNECTION_REFUSED

2- for https://<JAILIP>:80/owncloud/
i get
a blank page and a lock with a RED X next to the adress bar (where the greenpad lock is supposed to be)

3- for https://<HOSTNAME>/owncloud/
i get
This site can’t be reached
freenasowncloud.info refused to connect.

ERR_CONNECTION_REFUSED

4- for https://<HOSTNAME>:80/owncloud/
i get
a blank page with a greenpad lock next to the adress bar

any idea what is going on? why can I not see the owncloud server gui??

5- for http://<JAILIP>/owncloud
i get
400 Bad Request
The plain HTTP request was sent to HTTPS portnginx/1.8.1
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
2- for https://192.168.0.2:80/owncloud/
i get
a blank page and a lock with a RED X next to the adress bar (where the greenpad lock is supposed to be)
The red X is because the cert is issued for freenasowncloud.info, but you're going to 192.168.0.2. The names don't match, hence the warning. But you're serving https on port 80, which is broken.

for https://freenasowncloud.info:80/owncloud/
i get
a blank page with a greenpad lock next to the adress bar
The green padlock indicates you have a valid cert, which you do--you've properly set up the Let's Encrypt certificate in the nginx configuration

I don't know nginx configuration, so I couldn't point to exactly what's wrong, but the effect is that you're doing https on port 80, and not listening at all on port 443. I think there's another issue as well (that it isn't showing the owncloud page).
 
Status
Not open for further replies.
Top