Skip to content

Commit 26dc082

Browse files
authored
Merge pull request #3113 from dwd/sasl-2-clean
OF-2535: Add support for XEP-0388: Extensible SASL Profile (SASL2)
2 parents 7c41585 + 54b3539 commit 26dc082

19 files changed

Lines changed: 3086 additions & 188 deletions

File tree

.github/actions/conversationstest-action/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ runs:
3232
sudo udevadm trigger --name-match=kvm
3333
3434
- name: Cache Conversations APK
35-
uses: actions/cache@v5
35+
uses: actions/cache@v6
3636
with:
3737
path: conversations.apk
3838
key: conversations-apk-4217303 # Update this number at the same time as the version in run-tests.sh

.github/workflows/continuous-integration-workflow.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ jobs:
344344
- name: demoboot
345345
maestro-tags: demoboot
346346
config-file: '' # Use default demoboot config
347-
#- name: sasl2
348-
# maestro-tags: sasl2
349-
# config-file: build/ci/conversations/configs/sasl2.xml
347+
- name: sasl2
348+
maestro-tags: sasl2
349+
config-file: build/ci/conversations/configs/sasl2.xml
350350

351351
steps:
352352
- name: Checkout local actions and test flows # Do this _before_ untarring the distribution, as the checkout will empty the directory prior to the checkout!
@@ -371,12 +371,19 @@ jobs:
371371
with:
372372
logLevel: debug
373373
- name: Run Conversations tests (${{ matrix.name }})
374+
id: runConversationsTests
374375
uses: ./.github/actions/conversationstest-action
375376
with:
376377
includeTags: ${{ matrix.maestro-tags }}
377378
- name: Stop CI server
378379
if: ${{ always() && steps.startCIServer.conclusion == 'success' }}
379380
uses: ./.github/actions/stopserver-action
381+
- name: Upload Openfire logs on test failure
382+
if: ${{ failure() && steps.runConversationsTests.conclusion == 'failure' }}
383+
uses: actions/upload-artifact@v7
384+
with:
385+
name: Conversations Test (${{ matrix.name }}) Openfire logs
386+
path: distribution/target/distribution-base/logs/openfire.log
380387

381388

382389
should-do-database-tests:

build/ci/conversations/configs/sasl2.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@
7575
</user3>
7676
</users>
7777
</autosetup>
78-
<properties>
79-
<!-- TODO: Add SASL2-enabling system properties here. -->
80-
<!-- These are likely defined in the SASL2 plugin or as xmpp.auth.* core properties. -->
81-
</properties>
78+
<!-- Enable SASL2 (xmpp.auth.sasl2). TLS is required too, but is satisfied by the CI server's self-signed certificate. -->
79+
<xmpp>
80+
<auth>
81+
<sasl2>true</sasl2>
82+
</auth>
83+
</xmpp>
8284
</jive>

build/ci/conversations/flows/sasl2.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,20 @@ onFlowStart:
4747
- assertVisible: "Let app always run in background?"
4848
- tapOn: "Allow"
4949

50+
# Using SASL2
5051
- runScript:
5152
file: scripts/checkForLogs.js
5253
env:
5354
PATTERN: .*SASL 2.0 authorization identifier was jane@example.org
55+
56+
# Using Channel Binding
57+
- runScript:
58+
file: scripts/checkForLogs.js
59+
env:
60+
PATTERN: 'jane@example\.org.*Authenticating with SASL_2\/[A-Z0-9-]+-PLUS'
61+
62+
# Authentication successful
63+
- runScript:
64+
file: scripts/checkForLogs.js
65+
env:
66+
PATTERN: 'jane@example\.org.*logged in \(using SASL_2\)'

documentation/openfire.doap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@
417417
<xmpp:version>1.0.0</xmpp:version>
418418
</xmpp:SupportedXep>
419419
</implements>
420+
<implements>
421+
<xmpp:SupportedXep>
422+
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0388.html"/>
423+
</xmpp:SupportedXep>
424+
</implements>
420425
<implements>
421426
<xmpp:SupportedXep>
422427
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0410.html"/>

documentation/protocol-support.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ <h2>List of other XEPs Supported</h2>
397397
<tr><td><a href="https://www.xmpp.org/extensions/xep-0289.html">XEP-0289</a>: Federated MUC for Constrained Environments</td></tr>
398398
<tr><td><a href="https://www.xmpp.org/extensions/xep-0321.html">XEP-0321</a>: Remote Roster Management [<a href="#fn15">15</a>]</td></tr>
399399
<tr><td><a href="https://www.xmpp.org/extensions/xep-0359.html">XEP-0359</a>: Unique and Stable Stanza IDs</td></tr>
400+
<tr><td><a href="https://www.xmpp.org/extensions/xep-0388.html">XEP-0388</a>: XEP-0388: Extensible SASL Profile (SASL2)</td></tr>
400401
<tr><td><a href="https://www.xmpp.org/extensions/xep-0398.html">XEP-0398</a>: User Avatar to vCard-Based Avatars Conversion</td></tr>
401402
<tr><td><a href="https://www.xmpp.org/extensions/xep-0433.html">XEP-0433</a>: Extended Channel Search</td></tr>
402403
<tr><td><a href="https://www.xmpp.org/extensions/xep-0440.html">XEP-0440</a>: SASL Channel-Binding Type Capability</td></tr>

i18n/src/main/resources/openfire_i18n.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,8 @@ system_property.xmpp.auth.anonymous=Set to true to allow anonymous login, otherw
13151315
system_property.xmpp.auth.external.client.skip-cert-revalidation=Set to true to avoid validation of the client-provided PKIX certificate (for mutual authentication) other than the validation that happens when the TLS session is established.
13161316
system_property.xmpp.auth.external.server.require-authzid=Require the peer to provide an authorization identity through SASL (typically in the Initial Response) when authenticating an inbound S2S connection that uses the EXTERNAL SASL mechanism. This is not required by the XMPP protocol specification, but it was required by Openfire versions prior to release 4.8.0. This configuration option is added to allow for backwards compatibility.
13171317
system_property.xmpp.auth.external.server.skip-sending-authzid=Send an authorization identity in the Initial Response when attempting to authenticate using the SASL EXTERNAL mechanism with a remote XMPP domain. Sending the authzid in this manner is not required by the XMPP protocol specification, but is recommended in XEP-0178 for compatibility with older server implementations.
1318+
system_property.xmpp.auth.sasl2=Enables support for SASL2 authentication (XEP-0388)
1319+
system_property.xmpp.auth.sasl2.require-tls=Require TLS in order to authenticate with SASL2
13181320
system_property.xmpp.auth.ssl.default-trustmanager-impl=The class to use as the default TLS TrustManager (which checks certificates from peers).
13191321
system_property.xmpp.client.csi.enabled=Controls if Client State Indication (XEP-0352) functionality is supported by Openfire.
13201322
system_property.xmpp.client.csi.delay.enabled=Determines if 'unimportant' stanzas are delayed for a client that is inactive.

xmppserver/src/main/java/org/jivesoftware/openfire/SessionPacketRouter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void route(Element wrappedElement)
5959
throws UnknownStanzaException {
6060
String tag = wrappedElement.getName();
6161
if ("auth".equals(tag) || "response".equals(tag)) {
62-
SASLAuthentication.handle(session, wrappedElement);
62+
SASLAuthentication.handle(session, wrappedElement, false);
6363
}
6464
else if ("iq".equals(tag)) {
6565
route(getIQ(wrappedElement));

xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpSession.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ public List<Element> getAvailableStreamFeatures() {
227227

228228
// If authentication has not happened yet, include available authentication mechanisms.
229229
if (getAuthToken() == null) {
230-
final Element sasl = SASLAuthentication.getSASLMechanismsElement(this);
231-
if (sasl != null) {
232-
elements.add(sasl);
230+
final List<Element> mechanisms = SASLAuthentication.getSASLMechanisms(this);
231+
for (Element mechanism : mechanisms) {
232+
elements.add(mechanism);
233233
}
234234
}
235235

0 commit comments

Comments
 (0)