Re-subscribe to Let’s Encrypt Renewal Reminder Emails

Linux No Comments

Let’s Encrypt will automatically email expiration notices when your domain’s SSL certificate is coming up for renewal at 20 days, 10 days, and 1 day before the expiration date. (Recently, I received notices at 19 days and again at 10 days.)

I’ve found these renewal reminders very helpful because in the past, they’ve told me that the certificate auto-renewal process I had created (see Free SSL Certificate from Let’s Encrypt for Nginx) was broken. (Initially, I had attempted to setup the auto-renewal process to execute as a non-root user, but frequent updates requiring root access kept breaking it. I ended up configuring the auto-renewal to use root access.)

The renewal email body contains a link with the title “If you want to stop receiving all email from this address, click…” at the end. Unfortunately, the link is very long, taking up 3 to 4 lines of text (on my screen) and making it easy to click on by accident. More unfortunate, clicking on the link will disable the sending of expiration reminders to your email address for all domain certificates, not just the particular domain certificate in question. This change cannot be undone; you cannot re-register the same email address.

However, there is a re-registration workaround documented at Let’s Encrypt’s Expiration Emails page. The workaround takes advantage of how most email services will ignore the plus symbol and whatever follows it in an email address. For example, “myuser+1@mydomain.com” is treated the same as “myuser@mydomain.com”.

To re-subscribe your email address, run the command below in your certbot installation directory. (You will be prompted to input your sudo password if necessary.)

$ cd certbot
$ ./certbot-auto register --update-registration --email myuser+1@mydomain.com

Requesting to rerun ./certbot-auto with root privileges...
Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'
d like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: N

IMPORTANT NOTES:
 - Your e-mail address was updated to myuser+1@mydomain.com.

The community support page, Accidentally Unsubscribed, mentions an alternative workaround using LetsMonitor.org. LetsMonitor.org appears to be an external website which periodically checks the expiration date on your domain’s SSL certificate. I haven’t tried it but I don’t see any reason why it wouldn’t work.

No Comments

Create Animated GIF With Photoshop

Audio Visual No Comments

Creating an animated GIF is pretty easy with Adobe Photoshop. I will show you how I created the animated eye that you see to the right, using instructions from Build Animated GIFs in Photoshop. The secret is to use Photoshop’s Animation window.

Note: I found other web instructions that recommend using a Timeline window, but I could not find such a feature in my Adobe Photoshop CS5 version.

Layers Galore

The first step is to create layers, one or more of which together will construct each animation frame. While I could construct each frame using just one layer each, I decided to separate out the static “Animate Me” eyebrow image into its own layer and to include that layer in every frame.

  1. Create a new Photoshop project.
  2. The project is created with a default background layer.
  3. Draw the eyebrow. In my case, I wrote the eyebrow text using the Typing Tool and then warped the text using the Arc style.

I drew the eye using an oval for the outer rim and a circle for the pupil. (I lost the original image so re-created it to the right below by horizontally flipping one of the partial eye image and combining. That’s why the lines look too thick.)

To animate the eye blinking, I subtracted and added arc lines as necessary.

  1. Create a new layer by using menu Layer, New, Layer…, and click Ok.
  2. Select the new layer.
  3. Draw the eye using a circle and an oval.
  4. Duplicate the eye layer using menu Layer, Duplicate Layer…, and click Ok.
  5. Edit the eye by subtracting and adding arc lines.
  6. Repeat the above to create additional eye layers as necessary.

Animation Frames

Open the Animation window by going to menu Window and selecting Animation. The Animation window will appear at the bottom and there will be one frame already existing.

  1. To create another frame, select the existing frame and then click on the page icon (“Duplicates selected frames”) to the left of the trash icon (“Deletes selected frames”) at the bottom of the Animation window.
  2. Repeat to create the number of frames you desire.
  3. Select each frame and then select the layer(s) you want to be visible in that frame.
  4. The number of second(s) under each frame indicates the delay before the animation moves to the next frame. Adjust those delay times accordingly.

Note: Selecting the frame determines what is visible on the screen (that is, whatever layers are selected as visible in that frame). Selecting the layer (in the Layer window) still determines which layer a graphical operation will affect. To avoid confusion, you might want to manually ensure that the layer you select is enabled for the frame selected.

Save that GIF

To save the project to an animated GIF file, use menu File, Save for Web & Devices…. I just accept the defaults and click Save.

Note: If you save using menu File, Save As…, and select Format as “CompuServe GIF (*.GIF)”, you will end up with a static GIF image (containing the layer selected in the frame selected), not an animated GIF.

To test the GIF file, open it in a browser. If you open it in the default image or photo viewer, you will only see the first frame and no animation.

For your reference, you can download my Photoshop project file, animate_me.psd, containing the eye animation above.

No Comments

Re-install MacPorts After MacOS Upgrade

Mac OS X No Comments

I upgraded from Mac OS X 10.10 Yosemite to macOS 10.12 Sierra. After that, any MacPorts command I ran returned the following error:

Error: Current platform "darwin 16" does not match expected platform "darwin 14"
Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

The problem is that MacPorts is specific to a Mac OS X platform. The best way to fix this problem is to follow the Migrating a MacPorts installation guide.

Totally Clean Slate

MacPorts migration provides a “restore_ports.tcl” script to restore all the ports (a.k.a. packages) once you have upgraded MacPorts. However, I decided to start from a clean slate and only install ports as I needed them.

# Save list of installed ports (FYI for myself)
port -qv installed > ~/ports_installed.txt

# Save list of ports you manually installed (exclude dependency ports)
port installed requested > ~/ports_requested.txt

# Uninstall all installed ports
sudo port -f uninstall installed

# Clean any partially-completed builds
# Remove leftover build files (this should be done automatically already)
sudo rm -rf /opt/local/var/macports/build/*

# Remove download files
sudo rm -rf /opt/local/var/macports/distfiles/*

Note: I noticed that executables like svn (from subversion port) were left behind in /usr/bin and could still be used.

Partially Clean Slate

If you decide to keep your existing ports and to use the “restore_ports.tcl” script, you might consider cleaning out inactive packages:

# Get list of inactive ports you likely no longer need
# Alternative command: port echo inactive
port installed inactive

# Remove all of the inactive ports
sudo port uninstall inactive

Install macOS-specific MacPorts

Install the latest MacPorts for your macOS version:

  1. Install or upgrade to the latest version of Xcode Developer Tools (free from the Mac’s App Store) and run it once.
  2. Install the latest Command Line Developer Tools by running this command in the Terminal app:
    xcode-select --install
  3. Download and install the MacPorts package matching your Mac OS X version. It will overwrite the existing MacPorts installation.

Update MacPorts Configuration

The new MacPorts installer won’t modify the existing configuration file so you will need to update it manually. The updated configuration file “macports.conf.default” is located in the “/opt/local/etc/macports” directory. The old configuration file “macports.conf” is also in the same location.

Before overwriting the old file with the new, I recommend doing a file comparison:

cd /opt/local/etc/macports/
diff macports.conf macports.conf.default

Note: If you prefer a nice graphical user interface, you can use the FileMerge application which comes with Xcode. Just run FileMerge and input the paths to the two files to compare them.

There wasn’t any significant difference between the two files (beyond comments), but I went ahead and overwrote the old one with the new.

cd /opt/local/etc/macports/
sudo cp macports.conf.default macports.conf

Note: There are two other MacPorts configuration files, “variants.conf” and “sources.conf”, which the migration guide doesn’t mention. I compared them anyways and the only significant difference I found was in the “sources.conf” where the “rsync” value was different. I overwrote the “sources.conf” with the latest to ensure that everything is updated.

If you didn’t do a totally clean slate, you will want to follow the migration instructions on how to run the “restore_ports.tcl” script.

Some info above derived from:

No Comments

iPhone Missing From Windows 10 File Explorer

Mobile Devices, Windows No Comments

Under Windows 7, whenever I connected my iPhone, I would see a device drive appear in the File Explorer, which allowed me to manually copy photos from the iPhone to my computer. Under Windows 10, the device drive no longer appeared. I found the solution to this problem at iPhone doesn’t show up in Windows 10 File Explorer [Solved].

On my system, the cause is Windows 10 neglecting to install the “MTP USB Device” driver. MTP stands for Media Transfer Protocol, which Microsoft uses to allow access to files (like photos and videos) on iOS and Android devices. Under my Windows 10 machine, when I connect my iPhone, Windows 10 only installs the “Apple Mobile Device USB Driver” which iTunes uses. It does not install the “MTP USB Device” driver which File Explorer requires.

The solution is to manually install the “MTP USB Device” driver. This fix also worked for my iPad and iPod Touch.

Note: You may also have this problem under Windows 7 or 8. Or with an Android device. The steps below should still work.

Install MTP USB Device

To manually install the “MTP USB Device” driver:

  1. Connect the iPhone, iPad, or iPod to the Windows computer. Trust the computer if prompted to (only need to do this once when you first connect a new device).
  2. On the computer, run the “Device Manager” application.
  3. Open the “Universal Serial Bus controllers” section.
  4. Right-click on the “Apple Mobile Device USB Driver” and select “Update driver”. A dialog window will appear.
  5. Select “Browse my computer for driver software” and then “Let me pick from a list of available drivers on my computer”.
  6. Select the “MTP USB Device” driver in the “Show compatible hardware” listbox. Click Next.
  7. Once done, you will get a “Windows has successfully updated your drivers” message. Click Close to quit the dialog window.
  8. In the “Device Manager”, if you open “Portable Devices”, you will now see a new “MTP USB Device” driver listed. However, the device still doesn’t appear in the File Explorer and worse, the “Apple Mobile Device USB Driver” is gone (iTunes won’t show the attached device icon any longer).
  9. Disconnect and reconnect the iOS device. Windows will now load both the “Apple Mobile Device USB Driver” and “MTP USB Device” driver.
  10. The iOS device should now appear in the File Explorer under “This PC” and “Devices and drives”.

Note: If you check “Portable Devices” under the “Device Manager” again, you will now see the “Apple iPhone”, “Apple iPad”, or “Apple iPod” driver listed. The “MTP USB Driver” is renamed to the specific device type.

You should only need to manually install the “MTP USB Device” driver once for each new iOS device. Windows 10 should automatically load the “MTP USB Device” driver on subsequent connections.

Re-install MTP USB Device

I have seen a behavior when on a subsequent connection, Windows 10 did not successfully load the “MTP USB Device” for my iPhone. When I checked “Portable Devices” in the “Device Manager”, I saw the “Apple iPhone” driver with a caution icon, meaning it was in error state.

To fix the issue, I just right-clicked on the “Apple iPhone” and selected the “Update driver” option. And then I followed the instructions above from step 5 onward.

Hopefully your Windows 10 system does not have this problem. If it does, I hope the steps above will resolve your issue.

No Comments

Factory Image Flash a Nexus 5 Android Phone

Mobile Devices No Comments

I needed to re-image a Google Nexus 5 Android GSM smartphone with its stock factory image. Because I haven’t done this in a long while, I thought I would document what I did.

The instructions below should also work for the Google Pixel phone. I did the re-image using my Windows 10 desktop, but you can also do it on a Mac.

Note: Please backup your data because a factory image flash will destroy everything!

Install ADB and Fastboot

We need to install the software tools necessary to flash an Android phone. These are the Android Debug Bridge (adb), used to communicate with an Android device, and fastboot, used for writing directly to a device’s flash memory.

Thankfully, Google has separated these tools from the Android SDK into a smaller “SDK Platform Tools” package.

  1. Download the SDK Platform Tools package; I downloaded “platform-tools-latest-windows.zip”.
  2. Unzip to a directory, say “C:\Program Files\platform-tools”.
  3. Add that directory to the %PATH% environment variable.
  4. Launch a Command Prompt window and run “adb version”. I got “Android Debug Bridge version 1.0.39” as the response.

Enable USB Debugging

Enable USB debugging so adb can talk to the phone:

  1. On the phone, go to Settings, “About phone”, and scroll to the bottom until you see “Build number”.
  2. Click on the “Build number” seven times. You’ll see popups telling you how many times more to press to enable “Developer options”. (Ex: “You are now 3 steps away from being a developer.”)
  3. Once done (you’ll see a “You are now a developer!” popup message), go back to Settings and you will see a new menu “Developer options”. Click to go into it.
  4. Near the top, you will see an option “USB debugging”. Enable it.
  5. Plug the phone into the computer and answer “OK” when prompted with “Allow USB debugging?”. (Windows 10 was able to automatically find and install the Nexus 5 driver. If your operating system fails to do so, you may need to find and install the driver for your phone manually.)
  6. Open a Command Prompt window and run “adb devices”. It should list one device.

Note: You can see the status of and control how the USB connection behaves. On the connected phone, drag from the top, and you will see a message relating to the USB connection. If USB debugging is enabled, you will see the “USB debugging connected, Touch to disable USB debugging” message. If you disable USB, you will see a new “USB for charging, Touch for more options” message. You can change USB options to “File transfers” if you wish to browse files (such as pictures) located on the phone.

Find Factory Image

The hardest part of this process was finding the correct factory image to download for the Nexus 5. There were so many listed without any helpful instructions as to which image to download.

Here’s what I did:

  1. Locate Google’s Factory Images for Nexus and Pixel Devices page.
  2. Find the factory images for the “Nexus 5”, which is code-named “hammerhead”. (The “Nexus 5X” has code-name “bullhead”.)
  3. Locate the last image, which is the latest and greatest version, “6.0.1 (M4B30Z, Dec 2016)”. (“M4B30Z” and similar are build labels, not model numbers, as I originally thought. So any of them should work with the Nexus 5, though an older Nexus 5 image would prompt you to update the latest.)
  4. Unzip the downloaded “hammerhead-m4b30z-factory-625c027b.zip” file to any location; I just left the unzipped “hammerhead-m4b30z” folder in the Downloads folder.

Flash Factory Image

This is the easiest step because Google has provided a script with the factory image that does all the work.

  1. Open a Command Prompt window and change directory to the unzipped factory image folder.
  2. Run the “flash-all.bat” script. It only took 125 seconds to complete, ending with the message “finished. total time: 125.757s”.

The Nexus 5 then rebooted.

Note: It is recommended to do a data reset after a factory image flash. To do so, go to Settings on the phone, “Backup & reset”, and “Factory data reset”.

Need To Know

For your reading pleasure, below is the output of the “flash-all.bat” script:

C:\Users\username\Downloads\hammerhead-m4b30z> flash-all.bat
target reported max download size of 1073741824 bytes
sending 'bootloader' (3124 KB)...
OKAY [  0.316s]
writing 'bootloader'...
OKAY [  0.543s]
finished. total time: 0.863s
rebooting into bootloader...
OKAY [  0.100s]
finished. total time: 0.101s
target reported max download size of 1073741824 bytes
sending 'radio' (45489 KB)...
OKAY [  1.748s]
writing 'radio'...
OKAY [  3.130s]
finished. total time: 4.881s
rebooting into bootloader...
OKAY [  0.100s]
finished. total time: 0.102s
extracting android-info.txt (0 MB) to RAM...
extracting boot.img (8 MB) to disk... took 0.033s
target reported max download size of 1073741824 bytes
archive does not contain 'boot.sig'
archive does not contain 'dtbo.img'
archive does not contain 'dt.img'
extracting recovery.img (9 MB) to disk... took 0.061s
archive does not contain 'recovery.sig'
extracting system.img (996 MB) to disk... took 6.279s
archive does not contain 'system.sig'
archive does not contain 'vbmeta.img'
archive does not contain 'vendor.img'
wiping userdata...
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 7137786 4k blocks and 1785856 inodes
Filesystem UUID: b6135b46-f5a1-11e7-9dd3-33ea8476e3c7
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

wiping cache...
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 179200 4k blocks and 44832 inodes
Filesystem UUID: b66edade-f5a1-11e7-be2f-2fbe1c3d8ae8
Superblock backups stored on blocks:
        32768, 98304, 163840

Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

--------------------------------------------
Bootloader Version...: HHZ20h
Baseband Version.....: M8974A-2.0.50.2.30
Serial Number........: 04a0b345437de8e6
--------------------------------------------
checking product...
OKAY [  0.100s]
checking version-bootloader...
OKAY [  0.098s]
checking version-baseband...
OKAY [  0.099s]
sending 'boot' (9156 KB)...
OKAY [  0.529s]
writing 'boot'...
OKAY [  0.780s]
sending 'recovery' (10014 KB)...
OKAY [  0.587s]
writing 'recovery'...
OKAY [  0.828s]
erasing 'system'...
OKAY [  0.988s]
sending 'system' (1020657 KB)...
OKAY [ 35.063s]
writing 'system'...
OKAY [ 69.580s]
erasing 'userdata'...
OKAY [ 14.754s]
sending 'userdata' (4416 KB)...
OKAY [  0.369s]
writing 'userdata'...
OKAY [  0.497s]
erasing 'cache'...
OKAY [  0.580s]
sending 'cache' (428 KB)...
OKAY [  0.229s]
writing 'cache'...
OKAY [  0.217s]
rebooting...

finished. total time: 125.757s
Press any key to exit...

For more details, I found this page, How to flash a factory image | Return to stock | Unroot your Nexus 5, very helpful.

No Comments