Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. XMPP Server - Prosody

XMPP Server - Prosody

Scheduled Pinned Locked Moved App Packaging & Development
60 Posts 6 Posters 4.6k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      D Offline
      djxx
      wrote on last edited by
      #1

      This ties into the following wishlist items:

      • https://forum.cloudron.io/topic/7755/openfire-xmpp-server
      • https://forum.cloudron.io/topic/2486/ejabberd-robust-scalable-and-extensible-realtime-server-using-xmpp-mqtt-and-sip
      • https://forum.cloudron.io/topic/4188/snikket-server-your-own-messaging-server-in-a-box

      These are the three "main" XMPP servers out there (with Snikket being a simplified deploment of Prosody). I think most of the people making these requests don't actually care which server is used - as long as it has the common modules, like roster, OMEMO encryption, file upload, etc.

      I have chosen to package Prosody over the others because:

      • OpenFire - I know nothing about it
      • ejabberd - It's what is running on my server and the configuration for it is a pain
      • Snikket - it's TOO simple, not giving us options to configure things

      While Prosody does have its own docker image, I started from a different one because it has a sensible set of defaults baked in, is easy to extend, and is making use of environment variables for a lot of the configuration. Since Cloudron can inject environment variables with addons, I thought it would be easy to map Cloudron's environment variables to the ones expected by this container.

      Here's where I'm at:

      • I've made a repostory
      • I've built a docker image
      • I've tried to install it

      Addons being used:

      • tls - The app needs the certs to secure information on a number of ports other than HTTP
      • ldap - I want to do SSO
      • storage - The app needs to store data for message history, uploads, etc.

      Upon install I'm getting an error related to me trying to create the cert structure described here: https://github.com/SaraSmiseth/prosody/tree/dev#ssl-certificates

      mkdir: cannot create directory '/usr/local/etc/prosody/certs/upload.xmpp.domain.tld': Read-only file system
      

      My plan for managing the SSL certs was to have the entrypoint script create the directory structure required by the app within the /app/data folder, copy the certs as provided by the tls addon, and symlink that directory to the expected directory /usr/local/var/lib/prosody. From what I've read, there are a few hard-coded things in prosody that may be difficult to change - which is why I'm trying to find a way to put the certs where it expects to find them.

      So now I need some help figuring out the best way to deal with this read-only file system issue. Help would be greatly appreciated! 🙂

      Other Notes:
      There's a health check module for prosody that can also serve up a status through HTTP. I am planning to use this for the required healthcheck endpoint, and since an HTTP endpoint is generally not used for this application I also want to put it behind auth. The only purpose this HTTP endpoint serves is for the mandatory health check for the Manifest.

      1 Reply Last reply
      4
      • D Offline
        D Offline
        djxx
        wrote on last edited by
        #2

        I made a few attempts to get around the permission issues - but they're pretty hacky. I'd appreciate some advice on the best way to approach this. I've pushed up the latest code and docker images of my attempts.

        1 Reply Last reply
        1
        • robiR Offline
          robiR Offline
          robi
          wrote on last edited by robi
          #3

          Until @staff takes a look, have you taken a look at the other apps in the cloudron git already packaged and how they handle things?

          Conscious tech

          D 1 Reply Last reply
          1
          • robiR robi

            Until @staff takes a look, have you taken a look at the other apps in the cloudron git already packaged and how they handle things?

            D Offline
            D Offline
            djxx
            wrote on last edited by
            #4

            @robi I did look at a few, but didn't see anything that jumped out at me as useful. I'm hoping someone can point me to a specific application that has done similar things so I can copy from there :).

            1 Reply Last reply
            1
            • D Offline
              D Offline
              djxx
              wrote on last edited by
              #5

              After a lot of banging my head, not to music - but against the wall, I've made progress. I was writing files into /app/data in the Dockerfile directly, which the docs has a small footnote saying this is a bad idea. Another "great" thing is that the location prosody searches for files is hard-coded at compile time, so I had to adjust that to get it to look in the right place.

              The latest code is up now. The xmpp server starts, but it's not connecting properly. I think there are some cert issues that I'll need to spend more time debugging. At this point, I think it requires more Prosody expertise than Cloudron expertise.

              1 Reply Last reply
              3
              • D Offline
                D Offline
                djxx
                wrote on last edited by djxx
                #6

                Ok! I've taken this as far as I can go without some support from @staff . The app launches and mostly gets its certs right. Until the certs are fully correct I can't get it to actually run, start the healthcheck endpoint, or debug the rest.

                XMPP typically expects to use the primary domain, e.g. mydomain.com . It uses SRV records to point to the specific sub-domain (if there is one) that should be used for XMPP. The reason for this is so XMPP ID's look the same as e-mails, like me@mydomain.com. This is also very convenient for XMPP that has LDAP enabled since people will type in their same username and password they do elsewhere. If you tell XMPP its domain is xmpp.mydomain.com, then user IDs look like: me@xmpp.mydomain.com, which isn't the same as e-mail addresses, and people often forget.

                This is where the limitations come in. XMPP expects lots of sub-domains, like: upload, conference, proxy, and pubsub.mydomain.com. It also expects certs for each of these, and the primary domain.

                The tls add-on only fetches a cert for the application's sub-domain. IF you are lucky enough to use a registrar that gives you API access, then you COULD use the wildcard certificate option which will cover all the sub-domains. However, this still doesn't give you the cert for mydomain.com which is required for the standard username me@mydomain.com .

                There are a few adjustments needed to solve these problems.
                1 - The application manifest should let an application define multiple domains. If the domain registrar API is being used it should set them all up at once.
                2 - The application manifest should allow getting individual certs for multiple subdomains in the event a registrar API is unavailable for a wildcard cert. The user can configure the domains, but still let Cloudron get the individual certs. The tls addon should pass all of these certs through.
                3 - The application manifest should allow other record types to be configured - like SRV records - so the registrar API can be used for a seamless install.
                4 - The tls addon should allow an application to request the primary mydomain.com cert for cases like this.

                robiR girishG 2 Replies Last reply
                3
                • D djxx

                  Ok! I've taken this as far as I can go without some support from @staff . The app launches and mostly gets its certs right. Until the certs are fully correct I can't get it to actually run, start the healthcheck endpoint, or debug the rest.

                  XMPP typically expects to use the primary domain, e.g. mydomain.com . It uses SRV records to point to the specific sub-domain (if there is one) that should be used for XMPP. The reason for this is so XMPP ID's look the same as e-mails, like me@mydomain.com. This is also very convenient for XMPP that has LDAP enabled since people will type in their same username and password they do elsewhere. If you tell XMPP its domain is xmpp.mydomain.com, then user IDs look like: me@xmpp.mydomain.com, which isn't the same as e-mail addresses, and people often forget.

                  This is where the limitations come in. XMPP expects lots of sub-domains, like: upload, conference, proxy, and pubsub.mydomain.com. It also expects certs for each of these, and the primary domain.

                  The tls add-on only fetches a cert for the application's sub-domain. IF you are lucky enough to use a registrar that gives you API access, then you COULD use the wildcard certificate option which will cover all the sub-domains. However, this still doesn't give you the cert for mydomain.com which is required for the standard username me@mydomain.com .

                  There are a few adjustments needed to solve these problems.
                  1 - The application manifest should let an application define multiple domains. If the domain registrar API is being used it should set them all up at once.
                  2 - The application manifest should allow getting individual certs for multiple subdomains in the event a registrar API is unavailable for a wildcard cert. The user can configure the domains, but still let Cloudron get the individual certs. The tls addon should pass all of these certs through.
                  3 - The application manifest should allow other record types to be configured - like SRV records - so the registrar API can be used for a seamless install.
                  4 - The tls addon should allow an application to request the primary mydomain.com cert for cases like this.

                  robiR Offline
                  robiR Offline
                  robi
                  wrote on last edited by
                  #7

                  @djxx Excellent work and points raised!

                  @girish will need to chime in here for the points, however we may have an app or two that does use multi-sub-domain deploys, like cryptpad which can provide an example of how that is handled certs wise.

                  Conscious tech

                  1 Reply Last reply
                  1
                  • D djxx

                    Ok! I've taken this as far as I can go without some support from @staff . The app launches and mostly gets its certs right. Until the certs are fully correct I can't get it to actually run, start the healthcheck endpoint, or debug the rest.

                    XMPP typically expects to use the primary domain, e.g. mydomain.com . It uses SRV records to point to the specific sub-domain (if there is one) that should be used for XMPP. The reason for this is so XMPP ID's look the same as e-mails, like me@mydomain.com. This is also very convenient for XMPP that has LDAP enabled since people will type in their same username and password they do elsewhere. If you tell XMPP its domain is xmpp.mydomain.com, then user IDs look like: me@xmpp.mydomain.com, which isn't the same as e-mail addresses, and people often forget.

                    This is where the limitations come in. XMPP expects lots of sub-domains, like: upload, conference, proxy, and pubsub.mydomain.com. It also expects certs for each of these, and the primary domain.

                    The tls add-on only fetches a cert for the application's sub-domain. IF you are lucky enough to use a registrar that gives you API access, then you COULD use the wildcard certificate option which will cover all the sub-domains. However, this still doesn't give you the cert for mydomain.com which is required for the standard username me@mydomain.com .

                    There are a few adjustments needed to solve these problems.
                    1 - The application manifest should let an application define multiple domains. If the domain registrar API is being used it should set them all up at once.
                    2 - The application manifest should allow getting individual certs for multiple subdomains in the event a registrar API is unavailable for a wildcard cert. The user can configure the domains, but still let Cloudron get the individual certs. The tls addon should pass all of these certs through.
                    3 - The application manifest should allow other record types to be configured - like SRV records - so the registrar API can be used for a seamless install.
                    4 - The tls addon should allow an application to request the primary mydomain.com cert for cases like this.

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #8

                    @djxx Great write up! I have some questions:

                    • How should the sub-domains be configured? For example - upload, conference, proxy ... Are these a) http or tcp b) If http, are these separate http services from the parent xmpp service itself?
                    • About the bare domain mydomain.com . So XMPP just needs the cert for this, but doesn't actually require any configuration as such? Meaning, no TCP or HTTP related configuration is required to what mydomain.com points to?
                    D 1 Reply Last reply
                    2
                    • girishG girish

                      @djxx Great write up! I have some questions:

                      • How should the sub-domains be configured? For example - upload, conference, proxy ... Are these a) http or tcp b) If http, are these separate http services from the parent xmpp service itself?
                      • About the bare domain mydomain.com . So XMPP just needs the cert for this, but doesn't actually require any configuration as such? Meaning, no TCP or HTTP related configuration is required to what mydomain.com points to?
                      D Offline
                      D Offline
                      djxx
                      wrote on last edited by
                      #9

                      @girish - As far as I know, all ports except 5280 don't serve HTTP - they're just TCP traffic. The 5280 port is just for some modules, one of which is a "status" module I planned to use for the required healthcheck endpoint. I did my best to put the data in the manifest file, but honestly I got the port information from here: https://github.com/SaraSmiseth/prosody#ports

                      As for the bare domain, yes - it just needs the cert. It won't actually communicate through this domain; It relies on SRV DNS records to point XMPP clients to the sub-domain that is actually serving XMPP: https://github.com/SaraSmiseth/prosody#dns

                      It's possible some of these ports and domains could be consolidated - but there will for sure be more than one domain, port, and cert needed to set XMPP up properly.

                      girishG 1 Reply Last reply
                      3
                      • D djxx

                        @girish - As far as I know, all ports except 5280 don't serve HTTP - they're just TCP traffic. The 5280 port is just for some modules, one of which is a "status" module I planned to use for the required healthcheck endpoint. I did my best to put the data in the manifest file, but honestly I got the port information from here: https://github.com/SaraSmiseth/prosody#ports

                        As for the bare domain, yes - it just needs the cert. It won't actually communicate through this domain; It relies on SRV DNS records to point XMPP clients to the sub-domain that is actually serving XMPP: https://github.com/SaraSmiseth/prosody#dns

                        It's possible some of these ports and domains could be consolidated - but there will for sure be more than one domain, port, and cert needed to set XMPP up properly.

                        girishG Offline
                        girishG Offline
                        girish
                        Staff
                        wrote on last edited by
                        #10

                        @djxx Ah ok, then this requires the platform feature to set up DNS when using TCP ports. Currently, we support this via aliases only when using HTTP.

                        But this shouldn't be a blocker because one can anyway put these DNS entries manually (for now, till we have all the requirements charted out).

                        Also, for your initial problem of not having the certs of the bare domain - just add the bare domain as an alias . You can do this by setting "multiDomain": true in the manifest. Once you do that the tls addon should provide with the cert as well.

                        D 1 Reply Last reply
                        2
                        • girishG girish

                          @djxx Ah ok, then this requires the platform feature to set up DNS when using TCP ports. Currently, we support this via aliases only when using HTTP.

                          But this shouldn't be a blocker because one can anyway put these DNS entries manually (for now, till we have all the requirements charted out).

                          Also, for your initial problem of not having the certs of the bare domain - just add the bare domain as an alias . You can do this by setting "multiDomain": true in the manifest. Once you do that the tls addon should provide with the cert as well.

                          D Offline
                          D Offline
                          djxx
                          wrote on last edited by
                          #11

                          @girish Thanks. Does enabling multiDomain result in the cert requested from Lets Encrypt using alternate names, or does it put multiple certs into /etc/certs ? Also, is there a way to specify the multiple domains in the manifest - or does it need to be done manually after the application is set up? This could make installation difficult if we need to partially start the application, then add some domain entries, and then do another action to complete the application's setup.

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            djxx
                            wrote on last edited by
                            #12

                            I went ahead and tried it, and I do see two certs now:

                            • tls_cert.pem
                            • xmpp.mydomain.com.cert

                            But both of these have CN and alternate name set to: *.mydomain.com and are the exact same cert.

                            girishG 1 Reply Last reply
                            0
                            • girishG Offline
                              girishG Offline
                              girish
                              Staff
                              wrote on last edited by
                              #13

                              https://docs.trueelena.org/self_hosting/modern_xmpp_server/index.html has some XMPP setup . I haven't read through that in close detail.

                              1 Reply Last reply
                              0
                              • D djxx

                                I went ahead and tried it, and I do see two certs now:

                                • tls_cert.pem
                                • xmpp.mydomain.com.cert

                                But both of these have CN and alternate name set to: *.mydomain.com and are the exact same cert.

                                girishG Offline
                                girishG Offline
                                girish
                                Staff
                                wrote on last edited by
                                #14

                                @djxx said in XMPP Server - Prosody:

                                But both of these have CN and alternate name set to: *.mydomain.com and are the exact same cert.

                                Will investigate when I find some time

                                D 1 Reply Last reply
                                0
                                • girishG girish

                                  @djxx said in XMPP Server - Prosody:

                                  But both of these have CN and alternate name set to: *.mydomain.com and are the exact same cert.

                                  Will investigate when I find some time

                                  D Offline
                                  D Offline
                                  djxx
                                  wrote on last edited by
                                  #15

                                  @girish Any update on this? I'd like to be able to keep tinkering on this before I forget all the prosody and cloudron stuff I crammed in my head 🙂

                                  girishG L 2 Replies Last reply
                                  3
                                  • D djxx

                                    @girish Any update on this? I'd like to be able to keep tinkering on this before I forget all the prosody and cloudron stuff I crammed in my head 🙂

                                    girishG Offline
                                    girishG Offline
                                    girish
                                    Staff
                                    wrote on last edited by
                                    #16

                                    @djxx can only look into this after Christmas

                                    1 Reply Last reply
                                    0
                                    • L Offline
                                      L Offline
                                      LoudLemur
                                      wrote on last edited by
                                      #17

                                      @djxx - thank you for doing this difficult work and helping Cloudron support XMPP.

                                      I hope that we are able to make Prosody an officially supported application soon. Maybe your write up of the packaging experience will help others who might want to try supporting ejabberd.

                                      Most people say ejabberd is tricky for configuration. I think that supporting it on Cloudron is one way to accomplish all that effort and make it available with one click.

                                      Well done!

                                      1 Reply Last reply
                                      1
                                      • L Offline
                                        L Offline
                                        LoudLemur
                                        wrote on last edited by
                                        #18

                                        Peertube has a chat plugin. One of the options is for XMPP Prosody:

                                        brave_5ZCZM3L4Xn.png

                                        1 Reply Last reply
                                        1
                                        • D Offline
                                          D Offline
                                          djxx
                                          wrote on last edited by
                                          #19

                                          Hello - any update on this? A standalone app is still needed; even though some apps like Jitsi use XMPP internally (like Jitsi) it doesn't mean it's useful for general external usage.

                                          robiR girishG 2 Replies Last reply
                                          0
                                          • D djxx

                                            Hello - any update on this? A standalone app is still needed; even though some apps like Jitsi use XMPP internally (like Jitsi) it doesn't mean it's useful for general external usage.

                                            robiR Offline
                                            robiR Offline
                                            robi
                                            wrote on last edited by
                                            #20

                                            @djxx check the VoceChat custom app install in the meantime.

                                            Conscious tech

                                            jdaviescoatesJ 1 Reply Last reply
                                            1
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes


                                              • Login

                                              • Don't have an account? Register

                                              • Login or register to search.
                                              • First post
                                                Last post
                                              0
                                              • Categories
                                              • Recent
                                              • Tags
                                              • Popular
                                              • Bookmarks
                                              • Search