Brother Printer Automatic Certificate Renewal

This script will automate the certificate renewal of Brother printers.

Description

I recently decided to build a home lab and started to put SSL Certificate on web application hosted internally. My certificate is generated using ACME.SH by automatically generate a new valid certificate on *.mydomain.com. This way, I can use the certificate on multiple web application.

I was trying to find a way to automate the certificate renewal of my printer Brother MFC-L3750CDW and I didn't find any way to do it. Even online, there was no existing script from my research.

So, I created this python script that will automatically renew the certificate by doing request on the web administrative portal.

The only prerequisites is to pass the following arguments:

  • Protocol

  • Hostname or ip of your printer

  • Filepath of the certificate

Phase of the script

  1. Authenticate on the web portal

  2. Delete any existing certificate

  3. Upload the new certificate

  4. Select the new uploaded certificate in the dropdown menu

Generate the certificate

My certificate was generated this way by:

I'm using Cloudflare for my domain management.

#!/bin/bash
export CF_Token="";
export CF_Account_ID="";
export CF_Zone_ID="";
export CF_Key="";
export CF_Email="";

/root/.acme.sh/acme.sh --issue --dns dns_cf -d *.mydomain.com

Then, once the certificate is generated, I export it in the PKCS12 format because this is the only format accepted on the Brother portal.

openssl pkcs12 -export -out brother.pfx -inkey .acme.sh/*.mydomain.com/*.mydomain.com.key -in .acme.sh/*.mydomain.com/*.mydomain.com.cer

brother.pfx is the file used to pass in the python script

Running the script

Here is a preview of the execution of the script.

Repository

The script can be accessed on the following Github repository.

Last updated