Sign inSign up free

571. Report Certificates About to Expire

medium 20 XP ~12 minHands-on lab

Expired certificates cause outages that are entirely preventable. A scheduled job should warn the team early.

Task

Create the executable script /home/student/bin/cert-expiry.sh DIR. For every *.pem certificate file directly in DIR it prints one line:

<days left> <file name> <subject CN>
  • <days left>: whole days until the certificate's notAfter (rounded down; negative if already expired),
  • <file name>: the base name, for example api.pem,
  • <subject CN>: the certificate's Common Name,
  • lines sorted by days left, soonest first.

Exit status: 1 if any certificate expires within 30 days (days left < 30, including expired ones), otherwise 0.

Try it on /etc/ssl/lab, which has a few certificates. The grader also runs it on other directories.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Cloud & Networking Foundations. Next step: Serve HTTPS with Your Own CA

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.