Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
Merged #3261 into master.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#event-7582729588
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Thank you for doing that. Agreed!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994291673
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
@agranig commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Alright. So, I will keep the docs for this commit as-is with the NULL, so it's 
consistent with the documentation of the other params in this module. In 
parallel, I've prepared another PR on top of this one, which changes the docs 
of all module parameters at once, changing the wording from NULL to `Default 
value is that option is not set ([description of implication this has, e.g. 
random id or no auth or whatever])`. Agreed?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994281090
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

That's a bad one with "NULL" in quotes like it's a settable value. Let's focus 
now on make this new option better, and then we'll work on improving the 
existing docs to something non-developers may understand :-)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994252349
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
@agranig commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

It's a bit of a rabbit hole. 
https://www.kamailio.org/docs/modules/devel/modules/dispatcher.html#dispatcher.p.db_url
 is one of the most famous ones I guess. Any good example how to properly 
document a non-set behavior, so it's consistent?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994249789
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
@agranig commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Is there actually good practice on how to document a param which has no default 
value (aka is NULL)? I'm finding quite some old modules having it documented 
like this, see 
https://www.kamailio.org/docs/modules/devel/modules/auth_db.html#auth_db.p.load_credentials
 for example.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994245839
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Fully agree, my intention was to change the others separately.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994245271
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Henning Westerholt
@henningw commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Yes, lets not mix this PR with other enhancements.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994242490
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
@agranig commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

I'd propose to do this in a second step to not mix commits. So I'm going to 
amend the current one, and in a second pull request change the wording of all 
mod params regarding NULL

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994237590
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
@agranig pushed 1 commit.

bf5cf64f1daf8f0c8062e32d116c5da357fe516d  mqtt: Add tls_alpn module option

-- 
View it on GitHub:
https://github.com/kamailio/kamailio/pull/3261/files/43981e28e4fa48f6f6f69af1594f671742d1e4cf..bf5cf64f1daf8f0c8062e32d116c5da357fe516d
You are receiving this because you are subscribed to this thread.

Message ID: 
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Yes, I think we have to change the others. NULL is in the code, not in the 
configuration. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994233694
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Andreas Granig
@agranig commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

Ok. The wording is taken from other params in this module (see 
https://www.kamailio.org/docs/modules/devel/modules/mqtt.html#mqtt.p.id). So we 
could say "The default is that his modparam is not set, which means that no TLS 
ALPN is used"?



-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994231540
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -324,6 +324,27 @@ modparam("mqtt", "ca_path", "/etc/ssl/certs")

 ...
 modparam("mqtt", "tls_method", "tlsv1.3")
+...
+   
+   
+   
+   
+   tls_alpn (str)
+   
+Used to set the TLS ALPN option for cases where one TLS port is used 
to share multiple services. Prominent
+example is AWS IoT, where you have to set the 
tls_alpn to "mqtt" to be able to connect
+via MQTT.
+   
+   
+   
+   Default value is NULL, where no ALPN is set on the TLS 
connection.

You can't set NULL in a mod-param. I would say that "Default value is empty 
string, which means that no TLS ALPN is used.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#pullrequestreview-1140170312
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -224,6 +224,17 @@ int mqtt_run_dispatcher(mqtt_dispatcher_cfg_t* cfg)
LM_ERR("mosquitto_tls_set() failed: %d %s\n",errno, 
strerror(errno));
return -1;
}
+if (cfg->tls_alpn != NULL) {
+#if LIBMOSQUITTO_VERSION_NUMBER >= 1006000
+res = mosquitto_string_option(_mosquitto, MOSQ_OPT_TLS_ALPN, 
cfg->tls_alpn);
+if (res != MOSQ_ERR_SUCCESS) {
+LM_ERR("mosquitto_string_option() failedi setting tls alpn: %d 
%s\n",errno, strerror(errno));

TLS upper case

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#discussion_r994226551
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] mqtt: Add tls_alpn module option (PR #3261)

2022-10-13 Thread Olle E. Johansson
@oej commented on this pull request.



> @@ -224,6 +224,17 @@ int mqtt_run_dispatcher(mqtt_dispatcher_cfg_t* cfg)
LM_ERR("mosquitto_tls_set() failed: %d %s\n",errno, 
strerror(errno));
return -1;
}
+if (cfg->tls_alpn != NULL) {
+#if LIBMOSQUITTO_VERSION_NUMBER >= 1006000
+res = mosquitto_string_option(_mosquitto, MOSQ_OPT_TLS_ALPN, 
cfg->tls_alpn);
+if (res != MOSQ_ERR_SUCCESS) {
+LM_ERR("mosquitto_string_option() failedi setting tls alpn: %d 
%s\n",errno, strerror(errno));

"failedi" ?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3261#pullrequestreview-1140169130
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev