Setting up https on Moodle4Mac

Setting up https on Moodle4Mac

by Jason Ginsburg -
Number of replies: 21

I have Moodle4Mac version 3.11 (https://download.moodle.org/macosx/) running on a Mac Mini server with MAMP. My site works but it is http, which is problematic since it sometimes gets blocked. I have a domain but I don't know how to set up HTTPS. Instructions here didn't work at all. 

https://docs.moodle.org/400/en/Installation_Package_for_OS_X#Secure_connections_with_HTTPS

I'm not that knowledgable about servers. How do I set up HTTPS on Moodle?  


Average of ratings: -
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This implies you are using Moodle4Mac for a live/production site. That's probably not a good idea. These Windows/Mac installers are really only intended for 'localhost' evaluations of Moodle.

Having said that - you pointed to the instructions. Setting up HTTPS isn't especially simple. Did you try? Which bit didn't you understand?
In reply to Howard Miller

Re: Setting up https on Moodle4Mac

by Jason Ginsburg -

Thanks for the response. For better or worse (mainly due to lack of expertise), I am using Moodle4Mac for a live site (for a few courses that I teach). I have no use for an evaluation site. What should I use instead? I can change in the future. 

If I understand correctly, the instructions explain how to make certificates. 

  1. enter: openssl genrsa -des3 -out server.key 1024. Enter a password twice.
  2. enter: openssl req -new -key server.key -out server.csr. Enter the previous password. You need to answer some questions. Common name expects your local name (for me it was jerome.moodle.local)
  3. enter: openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  4. enter: cp server.key server.tmp
  5. enter: openssl rsa -in server.tmp -out server.key. Enter the previous password.
  6. enter: mkdir /Applications/MAMP/conf/ssl
  7. enter: cp server.crt /Applications/MAMP/conf/ssl
  8. enter: cp server.key /Applications/MAMP/conf/ssl
But since this is a working site, I wonder if I these certificates aren't useful. The instructions here maybe are more useful. 

https://docs.moodle.org/400/en/Transitioning_to_HTTPS

I got an SSL certificate from Let's Encrypt. I think I did this correctly. But I don't know how to enable SSL on my server and get Moodle to work, using MAMP (which comes with Moodle3Mac). As far asI can tell, simply changing the cofig file to https doesn't get https to work on the server.  I don't use MAMP PRO now, but I could use it if that's easier. 

In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Ken Task -
Picture of Particularly helpful Moodlers

+ 1 to what Howard is telling you. smile

Your Mac has a terminal application.   Launch it and when you see the prompt, let's see what DNS says about your Mac.

Type:

dig jerome.moodle.local [ENTER]

What do you get for a response.

Is that how your students are accessing your site?   By jerome.moodle.local?

Can they access you site when at home or from their smart phones browser using jerome.moodle.local?

A .local top level domain is non-routable ... cannot be used outside a private IP lan.

If that's what you used with Let's Encrypt .... don't think it worked.  Let's Encrypt renews certs and their servers need to be able to talk to your moodle server by it's fully qualified domain name.

Think you need to look into Moodle Cloud - IF you have 50 students or less.

With MoodleCloud free plan, you get to create unlimited courses for up to 50 users and 250 MB of storage. Once you reach this limit of 50 active users or 250 MB of storage space, you must upgrade to one of their premium plans, which starts from $150 per year and go all the way up to $1,510 per year.

See their FAQ @

'SoS', Ken


In reply to Ken Task

Re: Setting up https on Moodle4Mac

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
(Just clarifying MoodleCloud) You get a free site for 45 days and then can choose a package to suit your needs https://moodlecloud.com/app/en/signup/login?plan=lms_50.0
See Choose your plan on this page: https://moodle.com/solutions/moodlecloud/
In reply to Mary Cooch

Re: Setting up https on Moodle4Mac

by Ken Task -
Picture of Particularly helpful Moodlers

Thanks, Mary!   So much for Google! sad

'SoS', Ken


In reply to Mary Cooch

Re: Setting up https on Moodle4Mac

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Mary

If there is an overview on the web of their products, we can spare repeatedly explaining Moodle Cloud to newcomers. I am talking of a successor to this matrix https://moodle.org/mod/forum/discuss.php?d=388064#p1564254. Instead this is how it goes today, https://moodle.org/mod/forum/discuss.php?d=439044#p1767004 (and the follow-up).
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Let's Encrypt is great but (this isn't completely true) your hostname needs to be accessible from the public internet. They confirm who you are by accessing a file that the software writes into your web area. If that's a possibility then it can be a one-command thing. I've never used it on a Mac. Even though I'm a Mac user, I only use Linux for hosting.
In reply to Howard Miller

Re: Setting up https on Moodle4Mac

by Jason Ginsburg -

My website is accessible from the public internet. Students access and use my Moodle site. I have a folder on my server (Mac mini) that I called certs. It contains the following which I think I got from Let's Encrpyt: myCA.key and myCA.pem 

I'm running MAMP. I don't know how to configure MAMP to accesses the certificates. Port 8888 is open. Port 443 (which I hear is needed for https) is probably open, but I'm not sure if my MAMP is properly configured to access it. 


In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Ken Task -
Picture of Particularly helpful Moodlers

Outside access by what fully qualified domain?  Surely not .local.

Access your site.  Look at the lock next to browser url line.   Is it an open lock icon ... no red line through it?

Click on lock.  Then 'Connection Secure' if that's what it says.   does it say 'Verified by LetsEncrypt'?   Then click -> and more information about the cert.

Verified by?

Click 'View Cert'.

Info there ... common name?   Also note the Validity.

I have a cron job bot that uses a python 'certbot' script and checks for renewal of cert.

python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew

if in need of renewal, gets new cert.

As far as hosting ... could you afford 'top of the line' shared hosting?  I say 'top of the line' cause many offer real cheapo, medium cheapo, pro cheapo.  Pro cost more but one gets Terminal and Git icons in cPanel ... which allows one to do a lot more!  And for a few courses, is doable.

That would be on a linux server - many do offer Let's Encrpt.

'SoS', Ken


In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
I use MAMP, but only for local development. However, your discussion caught my interest. MAMP does provide some guidance (perhaps only for MAMP PRO). This documentation page mentions: Note: SSL functionality is not available for the host “localhost”.

I support Ken's advice to get a web server for your Moodle.
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

On the question:
> I am using Moodle4Mac for a live site (for a few courses that I teach). I have no use for an evaluation site. What should I use instead? I can change in the future.

Some more information won't hurt. What I know is a) your Moodle runs on a (your own) Mac Mini b) the site is reachable from the Internet and c) is small.

Now the questions: How small? How many registered users? How many are active at a given time? "Online users (last 5 minutes)" are sufficient for a small site. How is your Mac Mini hosted: In your home office? At school? Public IP? Or a private IP hidden behind a NAT router? How is DNS handled: Permanent or a dynamic DNS?

The first thing I notice is that, if your site is not really used day and night, keeping a dedicated machine running 24/7 is a waste of energy. A VPS is much more energy efficient and no hardware for you to maintain, means more reliable. That is the preferred approach here for the DIY people. Performance-wise even a shared hosting would do, but you are restricted in those "panels", not something for the DIY people.
In reply to Visvanath Ratnaweera

Re: Setting up https on Moodle4Mac

by Jason Ginsburg -
There are about 250 registered users, and probably 200-230 actual users. The address is hosted by my university, and Mac Mini is in my university office.
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

You are in a comfortable situation: Not only the university IT permits the "alien" called Moodle, they actively host your machine in their network. In light of that your current solution, docking your own machine to their network, is the most logical.

Before we move on to the future solution, a fundamental question: Why doesn't your IT provide you the machine? Ultimately it is their terrain. I'm sure they have a virtualization architecture in their racks. Spawn a virtual machine (VM) of type Linux, boot it from a free Linux install ISO file, a couple of clicks and you have a minimal (headless) Linux running. Installing the LAMP stack on it and then Moodle are all well documented. If they don't want to maintain the VM, they can handover the root password to you. End of the story, no additional hardware, no energy consuming Mac heating your office (and the environment).

I am of course biased. (See my profile.) But people who know the other systems clearly said MAMP and XAMPP are not for production sites. (I believe, your IT doesn't know. wink)

Invest some time on scanning the discussions here. You'll see that people get excellent help for Linux on VPS, the VM is in effect a VPS, meaning the Unix command interpreter (CLI), with which you are already familiar through the Mac. Have no illusions: The CLI is the key, if you are averse to that, forget my whole post!

If Linux is the future, and if you don't get a Linux VM from your IT, from what I read you can install Linux on the Mac Mini. Alternatively, you may look for energy saving hardware for the successor. 230 active users don't need much power. My favourite is the MoodleBox https://moodlebox.net/. BTW, it is a turn-key solution, including the latest Moodle. Please note that MoodleBox is a separate project from moodle.org, with their own support forum.
Average of ratings: Useful (1)
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Ken Task -
Picture of Particularly helpful Moodlers

So your server is in your office at a university and rather than Univ IT involvement, you are hosting your own on Moodle4Mac.   So you are getting no Uni IT support?  Bet there is a story there!  but ...

Now some more questions/thoughts/comments - food for thought?

You have 3.11 ... but what's the point release?
3.11.whatnumber?  Is it .8?

Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022
Bug fixes for security issues in 3.11.x will end 13 Nov 2023

Circle that 13 Nov 2023 date on your calendar cause that's when ALL
versions lower than 4.1 support will end ... code fixes + security.

Not sure that moodle has ever done it before, but 29 July 2021
there was a 3.11.2 released that was noted as 'Emergency minor release'

https://download.moodle.org/macosx/
Shows there is now available a 4.0.4 Stable release for Moodle4Mac.

So a question for you ... can't stay a 3.11.x forever.
How hard will it be for you to upgrade to the next long term support version of 4.1
when it comes out?

'SoS', Ken

In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Ken Task -
Picture of Particularly helpful Moodlers

Just today ... on a Linux box using MySQL's own repos, an update to mysql.

Oct 11 06:16:49 Updated: mysql-community-common.x86_64 5.7.40-1.el7
Oct 11 06:16:49 Updated: mysql-community-libs.x86_64 5.7.40-1.el7
Oct 11 06:16:54 Updated: mysql-community-client.x86_64 5.7.40-1.el7
Oct 11 06:17:30 Updated: mysql-community-server.x86_64 5.7.40-1.el7

In your Moodle4Mac setup, what is version of mysql server?

Can you update mysql by itself? (uhhhh, answer is no).

For reasons such as above, Moodle4Mac should be considered for development only and not run as a remotely accessible app.

Anyhoo ... 2 cents more?

'SoS', Ken



In reply to Ken Task

Re: Setting up https on Moodle4Mac

by Jason Ginsburg -
Thanks for the responses. These are helpful. From my perspective, I just need a working Moodle site for a few classes, and I want to be able to control the settings. Moodle4Mac works just fine, and it's relatively easy to install (which is good for someone who doesn't know much about servers). It can be updated and upgaded. I'm not quite sure why it isn't good for a production site, but maybe it isn't as secure as would be desired (missing latest updates)? It sounds like due to the https issue, I may need to switch to Linux, etc. in the near future.
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

"Moodle4Mac works just fine"

Except....

The issue is that stuff like MAMP, XAMPP and so on are intended for creating development environments on platforms that are not generally thought of as being for server use. So there's a whole bunch of potential problems. It's not designed as a secure, sever platform - it's designed to facilitate development and these can be conflicting requirements. 

If you want to run a Moodle server "under your desk" then that's perfectly ok. We've all done it. But I would recommend begging an old PC and sticking (something like) Ubuntu Server on it. It's probably less hassle in the end. 

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Setting up https on Moodle4Mac

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
+1 to what Howard says: But I would recommend begging an old PC and sticking (something like) Ubuntu Server on it. It's probably less hassle in the end.

In reply to AL Rachels

Re: Setting up https on Moodle4Mac

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> I would recommend begging an old PC and sticking (something like) Ubuntu Server on it. It's probably less hassle in the end.

Agree on the less hassle part, if one invest on the Unix command language. But where I completely disagree is running a full desktop PC 24/7, cooking the atmosphere.
In reply to Jason Ginsburg

Re: Setting up https on Moodle4Mac

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> it's relatively easy to install (which is good for someone who doesn't know much about servers)

No, it is not! I have come across many cases where the "easy install" becoming a nightmare.

The fact is, compared to the hundreds or even thousands of hours spent over the years for maintenance the hour of so saved during the initial installation is laughably small. The uncertain component is, if this "black box" happen to break, you don't know how to fix it, because you've never seen the inside nor you know how it worked.