Merge ~cjwatson/txpkgupload:charm-send-sftp-port into txpkgupload:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 4429bb36df619ede77ff9e72761372c9e2a29ff0
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/txpkgupload:charm-send-sftp-port
Merge into: txpkgupload:master
Diff against target: 32 lines (+3/-4)
1 file modified
charm/txpkgupload/reactive/txpkgupload.py (+3/-4)
Reviewer Review Type Date Requested Status
Ines Almeida Approve
Review via email: mp+455549@code.launchpad.net

Commit message

charm: Tell haproxy to send to the SFTP port

Description of the change

The arrangements to use whatever port the client used are only actually necessary for FTP. On production, we're using iptables to redirect incoming traffic on port 22 to port 5022, and not specifying the port causes haproxy to send traffic to port 22 on the backend, which is not what we want to happen.

To post a comment you must log in.
Revision history for this message
Ines Almeida (ines-almeida) wrote :

Makes sense

review: Approve
Revision history for this message
Ines Almeida (ines-almeida) wrote :

Maybe we should add a little more information to the comment about why we want the haproxy using the same port as the request for the FTP case. A quick "This is necessary for passive FTP requests" should suffice

Revision history for this message
Colin Watson (cjwatson) wrote :

I didn't notice that comment before merging this, but I addressed it in https://code.launchpad.net/~cjwatson/txpkgupload/+git/txpkgupload/+merge/455553.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/txpkgupload/reactive/txpkgupload.py b/charm/txpkgupload/reactive/txpkgupload.py
2index 689aa90..ab13487 100644
3--- a/charm/txpkgupload/reactive/txpkgupload.py
4+++ b/charm/txpkgupload/reactive/txpkgupload.py
5@@ -250,9 +250,6 @@ def configure_loadbalancer():
6 ftp_port = config["ftp_port"]
7 sftp_port = config["sftp_port"]
8
9- # Note that we don't send specific ports for the services.servers list.
10- # Not setting a port makes the haproxy use the same port used in the
11- # client's request.
12 services = [
13 {
14 "service_name": "txpkgupload-ftp",
15@@ -263,6 +260,8 @@ def configure_loadbalancer():
16 [
17 f"ftp_{unit_name}",
18 unit_ip,
19+ # Not setting a port makes haproxy use the same port
20+ # used in the client's request.
21 "",
22 server_options.replace("{port}", str(ftp_port)),
23 ]
24@@ -277,7 +276,7 @@ def configure_loadbalancer():
25 [
26 f"sftp_{unit_name}",
27 unit_ip,
28- "",
29+ sftp_port,
30 server_options.replace("{port}", str(sftp_port)),
31 ]
32 ],

Subscribers

People subscribed via source and target branches

to all changes: