Sunday, December 4, 2016

Here come the Bash clients for Let's Encrypt - Acme.sh, Dehydrated and creating SSL Certificates

I was recently working on a server with a pretty old OS. In the past I've configured SSL using EFF's Certbot, a Python based client for managing Let's Encrypt's certificates, but Certbot requires Python 2.7 or better and the server only shipped with Python 2.4. I initially started on the journey of "jumping through hoops" getting Python 2.7 installed on the old system but then I discovered bash based clients for Let's Encrypt. So here are some short notes for my future self which might save some time.

In terms of shell scripts that re-implement the Certbot client there are two shell scripts that I currently know of, one called dehydrated and the other, which I discovered a day or two later, is called acme.sh.  I ended up using acme.sh, I found the acme.sh implementation to be a bit simpler than the dehydrated implementation. If you're interested in using dehydrated, there's reasonable documentation on how to install and use it at https://www.aaflalo.me/2016/09/dehydrated-bash-client-lets-encrypt/.

Acme.sh

Acme.sh promotes itself as follows:

  • An ACME protocol client written purely in Shell (Unix shell) language.
  • Full ACME protocol implementation.
  • Simple, powerful and very easy to use. You only need 3 minutes to learn it.
  • Bash, dash and sh compatible.
  • Simplest shell script for Let's Encrypt free certificate client.
  • Purely written in Shell with no dependencies on python or the official Let's Encrypt client.
  • Just one script to issue, renew and install your certificates automatically.
  • DOES NOT require root/sudoer access.
It basically installs itself in the home folder of the active user and also adds itself to the PATH.
Installation is as easy as:

curl https://get.acme.sh | sh
Or:
wget -O -  https://get.acme.sh | sh

After that you can create an SSL certificate for the domain with the following command:
acme.sh --issue -w /home/mysite/public_html/example.com -d example.com -d www.example.com
Unfortunately, while the certificate was created without a problem, the server was so old that the version of OpenSSL didn't support multiple domains on the same IP address according to this article I needed at least OpenSSL v0.9.8j. 

Truth be told the best course of action will be to upgrade the server since it is otherwise vulnerable. The knowledge won't be lost as I can use it on other projects on newer servers.

Wednesday, November 30, 2016

Small Plone team ready for interesting problems




Starting December 1, 2016 the Alteroo team will be available for new Plone gigs.

Our team members are ready to dive into modern Plone development including Diazo and Mosaic on Plone 5. We also have experience with older versions of Plone.

If you're into checking boxes we also have experience with Javascript/ReactJS/Webpack/Babel, Pyramid/Kotti, Firebase, QA, Linux server administration and General Design skills.

Send an email to newgigs - [ at ]- alteroo.com.

Monday, November 28, 2016

Dear future ReactJS using self, thanks to IE11, you will need to know about babel-pollyfil

Hello future self. This is a quick note on how to use the babel-polyfill.
Perhaps it is so far enough into the future that all browsers now support all of ES6 or better natively. Just in case you're still needing to support the few stubborn Internet Explorer 11 (IE11) users then you'll find this helpful.

It is November 2016 and we now use polyfills to make browsers support futures that they otherwise would not.  Here's how to use the babel-polyfill to help to make your project IE11 compatible.

In my case the specific issue was that my production code was shipping with calls to Object.assign(). Unfortunately IE11 has no idea what .assign() is. In the meantime Chrome just worked, this is how I used the polyfill approach with babel-polyfill to trick IE11 into doing Object.assign().

1. Install it with npm

This command is run in the directly that contains the package.json file:
npm i babel-polyfill --save-dev

2. Edit your webpack.config.js file to make use of it

The snippet below shows how the babel-polyfill is added to the entry array.

module.exports = {
  ...,
  entry: [
    'webpack-hot-middleware/client',
    'babel-polyfill',
    './app/client.js'
  ],

3. Import it into your project

Here's what importing babel-polyfill looks like in my project file which is located at app/client.js:
import 'react-toolbox/lib/commons.scss';
import React from 'react';
import ReactDOM from 'react-dom';
import 'babel-polyfill';
import App from './App.js';

There you go future self, if you found this helpful, you're welcome. I still need to check if this fixes IE10 compatibility issues.

Thursday, November 17, 2016

Installing Plone 5 on Windows: Part 2 - Installing Plone

This is part 2 of installing Plone 5 on Windows. The following instructions are specific to installing Plone 5 on Windows. Part 1 covered preparing your Windows machine for Plone.

Assumptions




You now have all the tools needed to build a full Plone environment. Plone uses a tool called "buildout" for managing builds, this makes it possible to distribute build configurations using git or other revision management tools. The folder where your build configuration exists is also referred to as a buildout. We will checkout an existing buildout called "themedev.buildout". The intention of the "themedev.buildout" is to provide all the tools needed for Plone theme development.

In the steps below you will clone the buildout then run an initializaton script called "setup.bat"

Step 1 - Install Virtualenv

Launch git bash and run the following to install virtualenv.

pip install virtualenv

Step 2 - Clone the buildout, run the setup script and bin/buildout


git clone https://github.com/collective/themedev.buildout
cd themedev.buildout
./setup.bat
bin/buildout

Day to Day Usage

To launch the instance run the following:

bin/instance fg




Wednesday, November 9, 2016

Installing Plone 5 on Windows: Part 1 - Preparing the machine

Windows does not ship with all the tools needed to install Plone for development. These are the steps needed to prepare your Windows machine for Plone 5.

Assumptions

I assume that you're using a Windows machine on which you have enough permissions to run commands as an administrator. That's it!

What you will need to install

I recommend that you install the following to run Plone:
  • Git for Windows
  • Python 2.7
  • Visual C++ for Python 2.7
  • Pywin32
  • NodeJS
If you don't have a preferred text editor gedit is a simple editor for beginners.

The Steps

Step 1 - Download and install Git for Windows

IMPORTANT, Install Git for Windows First, it adds some context tools to Windows which you will use later.
Download and install git for windows from https://git-for-windows.github.io.

Step 2 - Download and install Python 2.7 from https://www.python.org/downloads/windows/

The latest version at the time of writing was Python 2.7.12. Basically it's a matter of clicking "next, next, next" EXCEPT on the "Customize" dialog. Look for "Add python.exe to Path" and make sure it is enabled (it is disabled by default).






Apart from one adjustment it is basically "next, next, next" to install



























.                                                                                                                                                             .

Step 3 - Download and install Visual C++ for Python 2.7 

Download from https://www.microsoft.com/en-us/download/details.aspx?id=44266

Make sure it is downloaded to your "Downloads" folder.

Right click on your Downloads folder and from the context menu select Git Bash Here.

save image

In the resulting console type the following and hit the enter key:

msiexec /i VCForPython27.msi ALLUSERS=1

This launches the Windows installer with administrator privileges. Click "Ok" to proceed.

save image


Step 4 - Install Pywin32

Make sure you download the latest build (220 at the time of writting) and the one for Python 2.7.
save image

Step 5 - Install NodeJS


Download NodeJS from https://nodejs.org/en/download/ and make sure to select the recommended version LTS.

save image

Step 6 - Install Gedit (optional)

You can skip this step if you already have a text editor, otherwise download and install gedit https://wiki.gnome.org/Apps/Gedit#Download

Why this approach?

  • Visual C++ for Python 2.7 results in faster modules which means that Plone will run faster than if you had used an equivalent compiler like GCC+.
  • It is more common in the Windows world to point and click rather than run commands on the command line, I tried my best to minimize interactions with the command line. The approach should feel more natural for Windows users, especially more casual users.


Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos