Skip to content

Commit

Permalink
Fix no_tls_hosts related docs & tests (#3404)
Browse files Browse the repository at this point in the history
- Add tests for `no_tls_hosts` config entry
- Improve docs for `no_tls_hosts` so that it's less surprising
  • Loading branch information
Young-Lord committed Sep 17, 2024
1 parent 72c902d commit 1dc98f4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#### Changed

- removed dependency on ldap plugins #3399
- doc(tls.md): add note for no_tls_hosts for outbound
- test(tls): add tests for no_tls_hosts for inbound & outbound


### [3.0.4] - 2024-08-21
Expand Down
2 changes: 2 additions & 0 deletions config/tls.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@
; key=tls_key.pem
; cert=tls_cert.pem
; dhparam=dhparams.pem
; no_tls_hosts[]=127.0.0.1
; no_tls_hosts[]=192.168.1.1

; and other options from [main] section above
8 changes: 8 additions & 0 deletions docs/plugins/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ If needed, add this section to the `config/tls.ini` file and list any IP ranges
172.16.0.0/16
```

Note: `[no_tls_hosts]` section applies to inbound only. For outbound mail, this feature is implemented as an array like `force_tls_hosts`:

```ini
[outbound]
no_tls_hosts[]=192.168.1.3
no_tls_hosts[]=172.16.0.0/16
```

The [Node.js TLS](http://nodejs.org/api/tls.html) page has additional information about the following options.

### no_starttls_ports
Expand Down
6 changes: 4 additions & 2 deletions test/config/tls.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ no_starttls_ports[]=2525

; no_tls_hosts - disable TLS for servers with broken TLS.
[no_tls_hosts]
; 127.0.0.1
; 192.168.1.1
192.168.1.1
172.16.0.0/16
; 172.16.0.0/16

[outbound]
Expand All @@ -41,3 +41,5 @@ requestCert=false
honorCipherOrder=false
force_tls_hosts[]=first.example.com
force_tls_hosts[]=second.example.net
no_tls_hosts[]=127.0.0.2
no_tls_hosts[]=192.168.31.1/24
2 changes: 1 addition & 1 deletion test/outbound/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('outbound', () => {
requestCert: false,
honorCipherOrder: false,
redis: { disable_for_failed_hosts: false },
no_tls_hosts: [],
no_tls_hosts: ['127.0.0.2', '192.168.31.1/24'],
force_tls_hosts: ['first.example.com', 'second.example.net']
})
})
Expand Down
6 changes: 5 additions & 1 deletion test/tls_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ describe('tls_socket', () => {
no_starttls_ports: [2525],
},
redis: { disable_for_failed_hosts: false },
no_tls_hosts: {},
no_tls_hosts: {
'192.168.1.1': undefined,
'172.16.0.0/16': undefined,
},
mutual_auth_hosts: {},
mutual_auth_hosts_exclude: {},
outbound: {
Expand All @@ -165,6 +168,7 @@ describe('tls_socket', () => {
requestCert: false,
honorCipherOrder: false,
force_tls_hosts: ['first.example.com', 'second.example.net'],
no_tls_hosts: ['127.0.0.2', '192.168.31.1/24'],
}
})
})
Expand Down

0 comments on commit 1dc98f4

Please sign in to comment.