Production upload over FTPS (explicit TLS, no fallback) instead of plain FTP
Continuous Integration / check (pull_request) Successful in 2m9s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m9s
Continuous Integration / deploy-production (pull_request) Skipped
Continuous Integration / check (pull_request) Successful in 2m9s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m9s
Continuous Integration / deploy-production (pull_request) Skipped
The hosting partner offers FTP over TLS after all. upload-production.sh now forces AUTH TLS (ssl-force, protect-data, protect-list), verifies the certificate and stays passive; the three rounds and the folder restrictions are unchanged. Docs, workflow comments and the lftp tests follow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,11 @@
|
||||
# De doelmap is de map met voorgerenderde pagina's van de CMS-host; de host
|
||||
# (en zijn web.config) staat er los van en wordt door de CMS-pijplijn gedeployd.
|
||||
# Verbinding: FTP_HOST, FTP_USER en LFTP_PASSWORD uit de omgeving, optioneel
|
||||
# FTP_PORT. Gewone FTP, geen FTPS: het productiepakket biedt alleen dat. De
|
||||
# gegevens gaan dus onversleuteld over het netwerk (zie docs/deploy-and-ci.md,
|
||||
# "Plain FTP"); daarom nooit TLS proberen en een eigen FTP-account met rechten
|
||||
# alleen op deze map.
|
||||
# FTP_PORT. Alleen FTP over TLS (FTPS, explicit: AUTH TLS): de inlog en de
|
||||
# bestanden gaan versleuteld, zonder terugval naar gewone FTP, en het
|
||||
# certificaat van de server wordt gecontroleerd (zie docs/deploy-and-ci.md,
|
||||
# "FTPS to production"). Gebruik een eigen FTP-account met rechten alleen op
|
||||
# deze map.
|
||||
# Alleen voor de test: LFTP_OPEN (bijvoorbeeld file:///) vervangt de
|
||||
# verbinding, en UPLOAD_PASS=1|2|3 voert maar één ronde uit.
|
||||
set -euo pipefail
|
||||
@@ -53,7 +54,10 @@ wants() { [ "$pass" = all ] || [ "$pass" = "$1" ]; }
|
||||
# Geen back-ups: lftp zet standaard een kopie met een tijdstempel
|
||||
# (web.config~20261101221045~) naast elk bestand dat het overschrijft. Op de
|
||||
# host zou elke deploy er een achterlaten, bereikbaar voor wie de naam raadt.
|
||||
settings="set ftp:ssl-allow no; set ftp:passive-mode on; set net:max-retries 3; set xfer:make-backup no;"
|
||||
# TLS: explicit FTPS afdwingen (de sessie weigert inloggen zonder TLS, ook de
|
||||
# datakanalen en de lijsten zijn versleuteld) en het certificaat controleren.
|
||||
tls="set ftp:ssl-allow yes; set ftp:ssl-auth TLS; set ftp:ssl-force yes; set ftp:ssl-protect-data yes; set ftp:ssl-protect-list yes; set ssl:verify-certificate yes;"
|
||||
settings="$tls set ftp:passive-mode on; set net:max-retries 3; set xfer:make-backup no;"
|
||||
|
||||
# Elke opdracht krijgt een eigen lftp-sessie, zodat het script bij een mislukte
|
||||
# ronde stopt (set -e) voordat de volgende ronde begint: de HTML gaat nooit
|
||||
@@ -70,7 +74,7 @@ run_lftp() {
|
||||
[[ "$FTP_PORT" =~ ^[0-9]+$ ]] || { echo "Ongeldige FTP_PORT" >&2; exit 2; }
|
||||
port=(-p "$FTP_PORT")
|
||||
fi
|
||||
lftp --env-password -u "$FTP_USER" "${port[@]}" "$FTP_HOST" -e "$commands"
|
||||
lftp --env-password -u "$FTP_USER" "${port[@]}" "ftp://$FTP_HOST" -e "$commands"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -666,7 +666,7 @@ touch '${slash(marker)}'
|
||||
},
|
||||
);
|
||||
|
||||
it('zet in elke lftp-sessie de back-ups uit en TLS uit (gewone FTP)', async () => {
|
||||
it('zet in elke lftp-sessie de back-ups uit en TLS aan zonder terugval (FTPS)', async () => {
|
||||
const dist = await makeDist();
|
||||
const bin = await makeTemp('andreaslop-fakebin-');
|
||||
const log = join(bin, 'opdrachten');
|
||||
@@ -694,9 +694,15 @@ printf '%s\\n' "$2" >> '${slash(log)}'
|
||||
expect(sessions).toHaveLength(3);
|
||||
for (const commands of sessions) {
|
||||
expect(commands).toContain('set xfer:make-backup no;');
|
||||
expect(commands).toContain('set ftp:ssl-allow no;');
|
||||
expect(commands).toContain('set ftp:ssl-allow yes;');
|
||||
expect(commands).toContain('set ftp:ssl-auth TLS;');
|
||||
expect(commands).toContain('set ftp:ssl-force yes;');
|
||||
expect(commands).toContain('set ftp:ssl-protect-data yes;');
|
||||
expect(commands).toContain('set ftp:ssl-protect-list yes;');
|
||||
expect(commands).toContain('set ssl:verify-certificate yes;');
|
||||
expect(commands).toContain('set ftp:passive-mode on;');
|
||||
expect(commands).not.toContain('ssl-force');
|
||||
expect(commands).not.toContain('ssl-allow no');
|
||||
expect(commands).not.toContain('verify-certificate no');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -736,7 +742,9 @@ printf '%s\n' "$*" >> '${slash(log)}'
|
||||
for (const line of (await readFile(log, 'utf8'))
|
||||
.split('\n')
|
||||
.filter(Boolean)) {
|
||||
expect(line).toContain('-u gebruiker -p 2121 ftp.example.test');
|
||||
expect(line).toContain(
|
||||
'-u gebruiker -p 2121 ftp://ftp.example.test',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user