# Custom actions with Virtualmin's Letsencypt renewals?

**URL:** <https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248>\
**Category:** Virtualmin\
**Created:** [December 24, 2024, 9:18pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248 "2024-12-24T21:18:45Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 26, 2024, 10:04pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/21 "2024-12-26T22:04:56Z")

</div>

It’s an old server (still on CentOS 7.9) and it stopped showing me any available updates a while ago:

![Screenshot 2024-12-26 at 22.00.45](https://cdn.forum.virtualmin.com/uploads/default/original/3X/f/2/f279a37a8f8a056386a08e863d3215c5bff2b7ab.png)

(Some of the sites still rely on old PHP/MySQL versions so have also avoided updating those in fear of breaking anything)

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 26, 2024, 10:07pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/22 "2024-12-26T22:07:18Z")

</div>

Head exploding over CentOS 7, now.

But, you can get a newer Virtualmin.

Do this:

```auto
virtualmin setup-repos

```

And, then update packages.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 26, 2024, 10:08pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/23 "2024-12-26T22:08:01Z")

</div>

Oh, wait, if you’re on an expired Virtualmin Pro, that would explain it, and `setup-repos` won’t fix it without downgrading to GPL.

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 26, 2024, 10:09pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/24 "2024-12-26T22:09:05Z")

</div>

> [@Joe](#):
>
> `virtualmin setup-repos`

It’s saying: `Command setup-repos.pl was not found`

> [@Joe](#):
>
> Oh, wait, if you’re on an expired Virtualmin Pro

It’s not Virtualmin Pro (I am a subscriber buy only run the GPL version on my servers) 😃

---

<div class="post-metadata">

**Author:** ![Jamie](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/jamie/32/8589_2.png) [@Jamie](https://forum.virtualmin.com/u/Jamie)\
**Post date:** [December 26, 2024, 10:10pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/25 "2024-12-26T22:10:52Z")

</div>

> [@Brook](#):
>
> Will post-actions still run (even pre 7.30.x) after the virtualmin renewal script runs? (i.e if `Automatically renew certificate?` has been checked in Virtualmin \> `Server Configuration > SSL Certificate > Let's Encrypt`) or will it not work at even for that for anything prior to 7.30?

I don’t recall in which version we fixed the bug so that post-actions were run on SSL cert rewals, but it’s definitely fixed in 7.30

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 26, 2024, 10:14pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/26 "2024-12-26T22:14:21Z")

</div>

No problem - I intend to move all these sites to a new server at some point so in the meantime I’ll set up an hourly cron job to copy over the certs to HAProxy, that way it will still use the existing certs until Virtualmin updates them.

Is there any way to trigger (or verify) the virtualmin Let’s Encrypt renewal script manually so I can just double check it’s all working as expected otherwise?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 26, 2024, 10:18pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/27 "2024-12-26T22:18:45Z")

</div>

Oh, it’s so old you don’t have that command.

Just grab the latest install script and run it with the `--setup` option:

```auto
sudo sh -c "$(curl -fsSL https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh)" -- --setup

```

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 26, 2024, 10:23pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/28 "2024-12-26T22:23:02Z")

</div>

Making me nervous Joe 🙈 could it potentially break anything? (it won’t up upgrade or change PHP/MySQL or anything like that will it?) 🙈 🙈

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 26, 2024, 10:36pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/29 "2024-12-26T22:36:54Z")

</div>

The `--setup` option only sets up the repos, or updates them if they are out of date.

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 26, 2024, 10:57pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/30 "2024-12-26T22:57:14Z")

</div>

Thanks Joe… should it show me a different message to this?

> `sudo sh -c "$(curl -fsSL https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh)" --setup`

> [INFO] Installation log is written to /root/virtualmin-install.log
> 
> Welcome to the Virtualmin GPL installer, version 7.5.2
> 
> This script must be run on a freshly installed supported OS. It does not  
> perform updates or upgrades (use your system package manager) or license  
> changes (use the “virtualmin change-license” command).
> 
> The systems currently supported by the install script are:
> 
> ```
> Red Hat Enterprise Linux and derivatives
> - RHEL 8 and 9 on x86_64
> - Alma and Rocky 8 and 9 on x86_64
> - CentOS 7 on x86_64
>   
> Debian Linux and derivatives
> - Debian 10, 11 and 12 on i386 and amd64
> - Ubuntu 20.04 LTS, 22.04 LTS and 24.04 LTS on i386 and amd64
> 
> ```
> 
> If your OS/version/arch is not listed, installation will fail. More  
> details about the systems supported by the script can be found here:
> 
> ```
> https://www.virtualmin.com/os-support
> 
> ```
> 
> The selected package bundle is LAMP and the size of install is  
> full. It will require up to 2 GB of disk space.
> 
> Exit and re-run this script with --help flag to see available options.
> 
> Continue? (y/n)

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 26, 2024, 11:28pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/31 "2024-12-26T23:28:53Z")

</div>

Oh, wait, stop. I made a copypasta error.

It needs an extra `--`

```auto
sudo sh -c "$(curl -fsSL https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh)" -- --setup

```

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 26, 2024, 11:35pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/32 "2024-12-26T23:35:19Z")

</div>

Thanks Joe, running that I get:

```plaintext
# sudo sh -c "$(curl -fsSL https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh)" -- --setup
[INFO] Setup log is written to /root/virtualmin-repos-setup.log
[INFO] Started Virtualmin 7 GPL software repositories setup
Downloading Virtualmin 7 release package ✔ 
Installing Virtualmin 7 release package ✔ 
[SUCCESS] Repository configuration successful. You can now install Virtualmin
[SUCCESS] components using your OS package manager.

```

Should I be able to run setup-repos now? (Still not found)

```plaintext
# virtualmin setup-repos
Command setup-repos.pl was not found

```

Or should I install via the OS package manager? (If so any command in particular?)

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 26, 2024, 11:47pm UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/33 "2024-12-26T23:47:22Z")

</div>

No, that did the same thing as `setup-repos`. Now you can update Virtualmin.

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 27, 2024, 12:01am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/34 "2024-12-27T00:01:33Z")

</div>

Am getting this Joe: `Webmin > System > Software Package Updates > Installed`

 ![Screenshot 2024-12-26 at 23.57.44](https://cdn.forum.virtualmin.com/uploads/default/original/3X/0/3/03d052cb8cd3321bbf8217ceb9a0e9561ab5dd2b.png)

(Basically everything says no update exists)

![Screenshot 2024-12-26 at 23.59.51](https://cdn.forum.virtualmin.com/uploads/default/optimized/3X/d/3/d32790fb7b1aac6fc9228d9bcb91e3e3acfa6446_2_690x47.png)

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [December 27, 2024, 12:03am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/35 "2024-12-27T00:03:26Z")

</div>

What happens when you do:

```auto
dnf update

```

Or:

```auto
yum update

```

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 27, 2024, 12:06am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/36 "2024-12-27T00:06:39Z")

</div>

It’d have to be yum for this server… but will that update PHP/MySQL etc? I don’t want those updated as some of the sites are reliant upon old versions : /

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [December 28, 2024, 12:39am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/37 "2024-12-28T00:39:11Z")

</div>

Then simply update the packages you wish, e.g.:

```plaintext
yum update webmin usermin wbm*

```

---

<div class="post-metadata">

**Author:** ![Brook](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Brook](https://forum.virtualmin.com/u/Brook)\
**Post date:** [December 28, 2024, 3:17am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/38 "2024-12-28T03:17:58Z")

</div>

Thanks @Ilia, I’m getting:

```plaintext
# yum update webmin usermin wbm*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

```

Looks like as of July 24 I need to switch the contents of `/etc/yum.repos.d/CentOS-Base.repo` from:

```plaintext
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

```

to:

```plaintext
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

```

However in fear of something potentially breaking I might leave this until I’m ready to port the sites on this server to updated software with newer versions of PHP/MySQL 🐤

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [December 28, 2024, 11:15am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/39 "2024-12-28T11:15:57Z")

</div>

> [@Brook](#):
>
> However in fear of something potentially breaking I might leave this until I’m ready to port the sites on this server to updated software with newer versions of PHP/MySQL

You don’t need to update other system packages together with Webmin and Virtualmin. This can be done entirely separately.

> [@Brook](#):
>
> ```auto
> # yum update webmin usermin wbm*
> Loaded plugins: fastestmirror
> Loading mirror speeds from cached hostfile
> Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
> 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
> 
> ```

Since CentOS 7 has reached its EOL, you will need to update the system repositories to point to Vault or completely disable them. Virtualmin repositories operate differently, providing only packages related to Webmin and modules, such as Virtualmin `virtual-server`.

---

<div class="post-metadata">

**Author:** ![pixel\_paul](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/pixel_paul/32/5262_2.png) [@pixel\_paul](https://forum.virtualmin.com/u/pixel_paul)\
**Post date:** [January 2, 2025, 7:54am UTC](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248/40 "2025-01-02T07:54:26Z")

</div>

A couple of improvements you could apply to this script:

1. Virtualmin provides a `ssl.everything` file which also contains the private key (although may be dependent upon Virtualmin version)

2. You could use `reload` instead of `restart` to update the certificate. Reloading is seamless (you’d need to be running a more recent version, \> 1.7):  
`systemctl reload haproxy.service`

[Previous page](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248.md?page=1)

[Next page](https://forum.virtualmin.com/t/custom-actions-with-virtualmins-letsencypt-renewals/131248.md?page=3)
