AI-Assisted System Administration: Upgrading iRedMail in 15 Minutes
A New Approach to Complex System Maintenance
This Saturday morning started with a problem: my iRedMail server was running version 1.6.8, and I needed to get it to 1.7.4. Anyone whos worked with iRedMail knows their upgrade process isnt simple - you cant jump versions. You have to step through each version sequentially: 1.6.8 → 1.7.0 → 1.7.1 → 1.7.2 → 1.7.3 → 1.7.4. Thats five separate upgrades, each with its own database migrations, configuration changes, and component updates.
I wanted this upgrade done efficiently, not spend hours sorting through documentation and troubleshooting edge cases.
Important Note
This project used all personal time, personal laptop, personal AWS accounts, personal servers, personal resources, personal money, personal space, and personal oxygen. This is a personal endeavor conducted entirely during private time using personal resources, completely independent of professional employment.
The Traditional Approach (That I Didnt Want to Take)
In the past, I'd handled these upgrades the nuclear option way: back up the mail I care about, blow away the entire server, and start fresh. This works for me because only my wife and I use the email service, and we dont care about old emails. But this time was different:
- I had active email conversations I didnt want to lose
- The number of email accounts had grown significantly
- Syncing credentials with AWS Secrets Manager for all those accounts would be a pain
I initially considered migrating to a different mail server entirely. I put both ChatGPT 5 Thinking Deep Research as well as Claude Sonnet 4.5 Research on the task of finding alternatives. Both found Stalwart Mail Server - written in Rust, single binary upgrades, true TOTP 2FA for IMAP/SMTP. Its clearly the better long-term solution, but migrating to it would have the same problem: massive time investement.
The Moment of Clarity
Then it clicked: Why not let Claude Code do it?
Ive had Claude Code solve non-coding problems before, and it works remarkably well and I had everything I needed in place to make this work which meant the timing was perfect for trying this because I had a Claude Max subscription with Sonnet 4.5 (which is simply amazing), experience using Claude Code for system tasks, a recent backup via my custom Lambda-based snapshot orchestrator, and healthy monitoring through a Lambda that tests SMTP/IMAP via CloudWatch.
Most importantly: I had a safety net. If anything went wrong, I could restore from the snapshot and try again.
Preparing for AI-Assisted Surgery
Before pulling the trigger, I took some precautions:
# Verified SSH access still works
ssh mail -C "whoami"
# Output: root
# Created a fresh snapshot of the email server
# (Using my custom orchestrator - does awesome things with tags)
# Verified email monitoring was healthy
# (Lambda checks: send email via SMTP → retrieve via IMAP → verify → delete)
Then I created a temp directory and opened Claude Code:
mkdir ~/tmp
cd ~/tmp
claude
The Upgrade Process: Exploration Before Execution
Heres where my approach differs from just throwing commands at an AI. I followed a deliberate process:
Phase 1: Exploration and Planning
- I told Claude exactly how to access my server (
ssh mail -C "command") - I provided the exact URL to iRedMails upgrade documentation
- I explicitly told it: "I do not want you to make ANY changes yet - I just want you to explore and formulate a plan"
Claude fetched the documentation, checked my current system state, and wrote a comprehensive upgrade plan to disk. It identified all five upgrade phases, listed all the component upgrades needed (Roundcube, iRedAPD, mlmmjadmin), and assessed the risks.
I reviewed the plan. I asked if it was confident it could do everything via SSH command execution. It was.
Phase 2: Execution with Oversight
With a healthy email server and a snapshot to fall back on, I told it to proceed.
At first, I carefully read each command before approving. But as I gained confidence, I started using the "Approve this one and all like it" option, just monitoring the scroll of commands.
A Hiccup (And Quick Recovery)
After the first upgrade phase (1.6.8 → 1.7.0), I tested everything. Problem: RoundCubes web interface was no longer accessible!
I told Claude about the issue. It immediately dug in and found the problem: a permissions issue in the web directory. It fixed it within moments. Im still not sure if this was Claudes mistake or an issue in iRedMails own upgrade process - but honestly, I didnt care. It was fixed.
I extensively checked everything:
- Can I log into the admin panel? ✓
- Do all the panels work? ✓
- Can I log into RoundCube? ✓
- Do mail clients on my phone and laptop still work? ✓
- Are my email conversations still there? ✓
All good. I told Claude to continue.
Phases 2-5: Smooth Sailing
Each subsequent phase completed successfully. After each one, I checked everything. My automated Lambda monitoring showed healthy throughout (except for the brief blip when I rebooted the server at the end).
The Bonus Round
After phase 5, I noticed the admin panel was still showing a notification: "New version of iRedAdmin, 2.6, is available." I simply gave Claude the notification text and the link it provided. Claude went ahead and upgraded iRedAdmin to 2.6.
Final verification:
- Logged in/out of admin panel ✓
- Rebooted the email server ✓
- Server came up healthy ✓
- All systems operational ✓
Total time: Approximately 15 minutes (and I was the slowest link with my manual checks).
Why This Approach Works
This upgrade demonstrates the practical value of AI-assisted system administration:
- Efficiency gains - 15 minutes versus hours or days of manual work
- Better outcomes - fewer mistakes than I would have achieved manually through careful, methodical execution
- Focus optimization - time invested in oversight and verification rather than reading documentation
Claude Sonnet 4.5 executed the upgrade more accurately and faster than I could have done manually. The AI's ability to process documentation, track complex multi-step processes, and maintain consistency across all phases proved invaluable.
A New Way of Working
What I want to emphasize is this: This is a new way of working with complex systems. We can use AI tools for sophisticated system maintenance - if we prompt them correctly.
When I say "prompt correctly," I mean:
- Be super clear and precise in your instructions
- Do exploration and learning before proceeding with changes
- Maintain oversight throughout the process
- Have safety nets (backups, monitoring, rollback plans)
Theres a quote from Ayn Rands "Atlas Shrugged" that I love: "Words have a precise meaning." When you ask Claude to do something, it will do EXACTLY what you ask. Before you send that message, make very sure its clear. If you struggle with clarity, work on that skill before using AI for critical system tasks.
The Results
Final system state after ~15 minutes:
- iRedMail: 1.6.8 → 1.7.4 ✓
- Roundcube: 1.6.5 → 1.6.11 ✓
- iRedAPD: 5.3.3 → 5.9.1 ✓
- mlmmjadmin: 3.1.8 → 3.4.0 ✓
- iRedAdmin: 2.5 → 2.6 ✓
All services operational. Important security fixes installed.
Whats Next
My next project will be migrating to Stalwart Mail Server for its simpler upgrade process and built-in security features. Thats for when I have more time though, maybe over a long weekend or holiday break. But until then, Im on the latest iRedMail version with important security fixes.
The entire upgrade process took roughly 15 minutes of active oversight, demonstrating how AI assistance can transform complex maintenance tasks into manageable operations.
Appendix: The Full Claude Code Session (Sanitized)
Below is the complete, sanitized transcript of my Claude Code session. Personal information like domain names, IP addresses, and secrets have been redacted, but you can see exactly how I worked with Claude Code to get this done.
╭─── Claude Code v2.0.5 ─────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Wayne! │ Ask Claude to create a new app or clone a repository │
│ │ ──────────────────────────────────────────────────── │
│ ▐▛███▜▌ │ Recent activity │
│ ▝▜█████▛▘ │ No recent activity │
│ ▘▘ ▝▝ │ │
│ │ │
│ Sonnet 4.5 · Claude Max │ │
│ /home/wayne/tmp │ │
╰────────────────────────────────────────────────────────────────────────────────────╯
> Hi Claude, I'd like to see if you can upgrade my iRedMail server from it's current
version of 1.6.8 to the latest version, which is 1.7.4. The upgrade process is NOT
simple, which is why I'm asking you to look into it.
● I'll help you research the iRedMail upgrade process from 1.6.8 to 1.7.4. Let me
start by investigating the upgrade documentation and requirements.
> I'll give you exact links to the relevant documentation:
> https://docs.iredmail.org/iredmail.releases.html
> that page lists how to go from one version to the next. iRedMail does not support
jumping versions, we have to step through each version. That page has a link on how to
go from current version to the next version. I am using the MariaDB backend, roundcube,
and IredMail admin panel 2.5
> Also, I'm using Debian 12. I do not want you to make ANY changes yet - I just want
you to explore and formulate a plan. My email server is accessible via an ssh alias,
for example this works: `ssh mail -C "echo hello"` so that will be how you interact
with the mail server. Also keep in mind I have created a snapshot of this email server,
so if ANYTHING goes wrong or doesn't work right, you can request me to restore the
snapshot, and we will just start over and try again. Please research, explore, and
create a plan.
● Fetch(https://docs.iredmail.org/iredmail.releases.html)
● Bash(ssh mail -C "cat /etc/iredmail-release")
⎿ 1.6.8 MARIADB edition.
● Bash(ssh mail -C "lsb_release -a")
⎿ Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
● [Multiple fetches of upgrade documentation for 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4]
● [System inspection commands checking current versions]
● Write(iredmail_upgrade_plan.md)
⎿ Wrote 376 lines to iredmail_upgrade_plan.md
● I've completed my research and created a comprehensive upgrade plan. Here's what I
found:
Summary:
Your iRedMail upgrade from 1.6.8 → 1.7.4 requires 5 sequential upgrade phases:
1. 1.6.8 → 1.7.0 (Most complex - Fail2ban database, multiple component upgrades)
2. 1.7.0 → 1.7.1 (Amavisd database fix)
3. 1.7.1 → 1.7.2 (Nginx & Postfix config changes)
4. 1.7.2 → 1.7.3 (vmail database schema additions)
5. 1.7.3 → 1.7.4 (Final component updates)
[Full plan details provided]
> Looking for a concise answer for this next question: Do you feel confident in your
ability to do this via the `ssh mail -C "command"` access? Would there be any friction
from doing it in this manner?
● Yes, confident - with minor friction.
Will work fine:
- Database updates (all non-interactive SQL)
- iRedAPD/mlmmjadmin upgrades (their scripts are automated)
- Config file updates (via sed/heredoc)
Bottom line: The SSH command method is workable. Worst case: a step requires manual
intervention and I'll ask you to run it directly or restore snapshot and adjust
approach.
> [Context about EC2 instance, monitoring setup, and safety nets]
> Well, you won't be checking cloudwatch or anything in AWS. You will be focusing on
doing the upgrade. And you'll ask ME to check the alarms at critical checkpoints.
● Got it - I handle the upgrade work, you check CloudWatch alarms when I ask.
Ready to start Phase 1 (1.6.8 → 1.7.0) when you give the go-ahead.
> Please proceed.
● [Pre-flight checks: disk space, service status, current version]
● Bash(ssh mail -C "echo '1.7.0' > /etc/iredmail-release")
● [Download and upgrade Roundcube 1.6.5 → 1.6.8]
● [Download and upgrade iRedAPD 5.3.3 → 5.6.0]
● [Download and upgrade mlmmjadmin 3.1.8 → 3.2.1]
● [Setup Fail2ban SQL database]
● [Verify all services active]
● Phase 1 Complete: 1.6.8 → 1.7.0 ✓
Successfully upgraded:
- iRedMail version file → 1.7.0
- Roundcube: 1.6.5 → 1.6.8
- iRedAPD: 5.3.3 → 5.6.0
- mlmmjadmin: 3.1.8 → 3.2.1
- Fail2ban: SQL database setup complete
Please verify your CloudWatch alarms show SMTP/IMAP are healthy before I proceed to
Phase 2.
> Something is wrong with roundcube, the web interface is giving an error message:
> https://[REDACTED_DOMAIN]/mail/
● [Checks RoundCube error logs]
● [Finds database permission issue]
● [Checks config file ownership]
● Bash(ssh mail -C "chown www-data:www-data /opt/www/roundcubemail-1.6.8/config/config.inc.php && chmod 600...")
● [Reloads PHP-FPM]
> it appears to be working now
● Excellent! The permission fix resolved it - the config file needed www-data:www-data
ownership to match the old installation.
> Everything looks good. I can login/logout of the admin panel and the panes inside
there work, I can log in/out of RoundCube, and no alarms in CloudWatch. You are clear
to proceed with phase 2.
● [Phase 2: Update to 1.7.1]
● [Apply Amavisd database fix]
● Phase 2 Complete: 1.7.0 → 1.7.1 ✓
> All looks good, please move to phase 3
● [Phase 3: Update to 1.7.2]
● [Update Fail2ban scripts]
● [Create ACME challenge directory]
● [Update Nginx config with proper variable handling]
● [Update Postfix BCC queries]
● Phase 3 Complete: 1.7.1 → 1.7.2 ✓
> Looks good, proceed to phase 4
● [Phase 4: Update to 1.7.3]
● [Upgrade iRedAPD 5.6.0 → 5.9.0]
● [Upgrade mlmmjadmin 3.2.1 → 3.3.1]
● [Apply vmail database schema updates]
● Phase 4 Complete: 1.7.2 → 1.7.3 ✓
> Looks good, proceed to phase 5
● [Phase 5: Update to 1.7.4]
● [Upgrade iRedAPD 5.9.0 → 5.9.1]
● [Upgrade mlmmjadmin 3.3.1 → 3.4.0]
● [Upgrade Roundcube 1.6.8 → 1.6.11]
● Phase 5 Complete: 1.7.3 → 1.7.4 ✓
🎉 COMPLETE: iRedMail Upgrade 1.6.8 → 1.7.4 Successful!
Final System State:
- iRedMail: 1.7.4 ✓
- Roundcube: 1.6.5 → 1.6.11 ✓
- iRedAPD: 5.3.3 → 5.9.1 ✓
- mlmmjadmin: 3.1.8 → 3.4.0 ✓
- All core services: active ✓
> Looking good! In the admin panel I see this message:
> "New version of iRedAdmin, 2.6, is now available for upgrading." and that takes me
to this URL: https://docs.iredmail.org/migrate.or.upgrade.iredadmin.html
● Fetch(https://docs.iredmail.org/migrate.or.upgrade.iredadmin.html)
● [Download iRedAdmin 2.6]
● [Run upgrade script]
● iRedAdmin Upgrade Complete: 2.5 → 2.6 ✓
Final Complete System State:
- iRedMail: 1.7.4 ✓
- Roundcube: 1.6.5 → 1.6.11 ✓
- iRedAPD: 5.3.3 → 5.9.1 ✓
- mlmmjadmin: 3.1.8 → 3.4.0 ✓
- iRedAdmin: 2.5 → 2.6 ✓
- All services: active ✓
The complete upgrade from iRedMail 1.6.8 to 1.7.4 is now finished with all components
at their target versions!
Key Takeaways
- AI can handle complex system administration when given proper context and oversight
- Exploration before execution is critical - let the AI understand the problem first
- Clear communication is everything - words have precise meaning
- Safety nets matter - backups, monitoring, and rollback plans enable confidence
- This is the future of work - focus on outcomes, not manual toil