Good question. I tested this because I was not sure either.
I renamed the files so that the ordering was intentionally reversed:
issuer-1.pem → z-issuer.pem
issuer-2.pem → a-issuer.pem
After restarting strongSwan, ipsec listcacerts showed that the load order had changed. Previously the certificates were listed as:
root@tyo1:~# ipsec listcacerts
List of X.509 CA Certificates
subject: "C=US, O=Let's Encrypt, CN=YR2"
issuer: "C=US, O=ISRG, CN=Root YR"
validity: not before Sep 03 09:00:00 2025, ok
not after Sep 03 08:59:59 2028, ok (expires in 824 days)
serial: 4e:bd:24:94:7e:24:d3:94:80:2d:84:a5:2f:d5:b3:19
flags: CA CRLSign serverAuth
CRL URIs: http://yr.c.lencr.org/
pathlen: 0
certificatePolicies:
2.23.140.1.2.1
authkeyId: de:e7:5b:60:d0:22:6d:40:28:7d:3f:0d:01:fe:a4:b5:52:b4:51:94
subjkeyId: 40:15:2d:26:79:ed:32:20:9e:df:9a:72:1d:d6:32:1f:81:0c:81:0c
pubkey: RSA 2048 bits
keyid: 93:28:4e:7c:5b:ca:60:0b:02:11:63:65:38:09:04:66:6a:c8:9e:0c
subjkey: 74:89:42:7e:67:9e:4b:01:f7:6e:0b:a6:e5:76:13:c1:06:62:d7:f3
subject: "C=US, O=ISRG, CN=Root YR"
issuer: "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
validity: not before May 13 09:00:00 2026, ok
not after Sep 03 08:59:59 2032, ok (expires in 2285 days)
serial: f2:4b:6d:17:f9:d9:ad:7c:b1:c9:fe:a7:87:82:69:9f
flags: CA CRLSign serverAuth
CRL URIs: http://x1.c.lencr.org/
certificatePolicies:
2.23.140.1.2.1
authkeyId: 79:b4:59:e6:7b:b6:e5:e4:01:73:80:08:88:c8:1a:58:f6:e9:9b:6e
subjkeyId: de:e7:5b:60:d0:22:6d:40:28:7d:3f:0d:01:fe:a4:b5:52:b4:51:94
pubkey: RSA 4096 bits
keyid: c9:b9:a1:13:c3:db:0d:6d:09:d2:3e:a8:ea:b8:1d:ce:c1:e6:52:20
subjkey: 3f:28:d0:db:e5:3f:20:d9:fa:65:12:04:de:aa:af:68:d8:3a:45:a9
After renaming, they appeared in the opposite order:
root@tyo1:~# ipsec listcacerts
List of X.509 CA Certificates
subject: "C=US, O=ISRG, CN=Root YR"
issuer: "C=US, O=Internet Security Research Group, CN=ISRG Root X1"
validity: not before May 13 09:00:00 2026, ok
not after Sep 03 08:59:59 2032, ok (expires in 2285 days)
serial: f2:4b:6d:17:f9:d9:ad:7c:b1:c9:fe:a7:87:82:69:9f
flags: CA CRLSign serverAuth
CRL URIs: http://x1.c.lencr.org/
certificatePolicies:
2.23.140.1.2.1
authkeyId: 79:b4:59:e6:7b:b6:e5:e4:01:73:80:08:88:c8:1a:58:f6:e9:9b:6e
subjkeyId: de:e7:5b:60:d0:22:6d:40:28:7d:3f:0d:01:fe:a4:b5:52:b4:51:94
pubkey: RSA 4096 bits
keyid: c9:b9:a1:13:c3:db:0d:6d:09:d2:3e:a8:ea:b8:1d:ce:c1:e6:52:20
subjkey: 3f:28:d0:db:e5:3f:20:d9:fa:65:12:04:de:aa:af:68:d8:3a:45:a9
subject: "C=US, O=Let's Encrypt, CN=YR2"
issuer: "C=US, O=ISRG, CN=Root YR"
validity: not before Sep 03 09:00:00 2025, ok
not after Sep 03 08:59:59 2028, ok (expires in 824 days)
serial: 4e:bd:24:94:7e:24:d3:94:80:2d:84:a5:2f:d5:b3:19
flags: CA CRLSign serverAuth
CRL URIs: http://yr.c.lencr.org/
pathlen: 0
certificatePolicies:
2.23.140.1.2.1
authkeyId: de:e7:5b:60:d0:22:6d:40:28:7d:3f:0d:01:fe:a4:b5:52:b4:51:94
subjkeyId: 40:15:2d:26:79:ed:32:20:9e:df:9a:72:1d:d6:32:1f:81:0c:81:0c
pubkey: RSA 2048 bits
keyid: 93:28:4e:7c:5b:ca:60:0b:02:11:63:65:38:09:04:66:6a:c8:9e:0c
subjkey: 74:89:42:7e:67:9e:4b:01:f7:6e:0b:a6:e5:76:13:c1:06:62:d7:f3
Despite that, Windows clients still connected successfully and the certificate chain validation continued to work.
So based on my testing, filename ordering does not appear to matter. My assumption is that strongSwan builds the chain from the Subject/Issuer relationships of the CA certificates loaded from /etc/ipsec.d/cacerts/, rather than relying on filename order.
Of course, this is based on my environment and testing, but at least for my setup, alphabetical ordering was not required.