.. _components: =================== Libervia Components =================== Libervia can act as an XMPP server component, which can be seen as a generic plugin for XMPP servers. This page explains which components are available and how to use them. Running a component =================== Components are linked to a Libervia profile in the same way as normal clients. To run a component, you'll need to know its *entry point*, which is the name of the import name of plugin managing it. The entry point to use will be specified in the component installation documentation. You'll also have to declare the component on your XMPP server, this is a server dependent step and you'll have to check your server documentation for details. You'll have to specify a **shared secret** (can also be named simply *password*) that must be set both on the XMPP server and as the XMPP password of the Libervia profile. Here is a list of relevant documentation for most common servers: ejabberd https://docs.ejabberd.im/admin/configuration/listen-options/ MongooseIm https://esl.github.io/MongooseDocs/latest/configuration/listen/#xmpp-components-listenservice OpenFire use the web-based admin panel Prosody https://prosody.im/doc/components Tigase https://docs.tigase.net/tigase-server/stable-snapshot/Administration_Guide/webhelp/externalComponentConfiguration.html On Libervia, setup is done with Libervia CLI's :ref:`profile create ` command. You'll usually want to have the component to start automatically when the backend is started, for this you must unset the profile password (not to be confused with the XMPP password which is the one also set on the server configuration) with ``-p ""`` and set auto-connection with ``-A``. You'll specify the XMPP password (also named *shared secret* in `XEP-0144`_ terminology) with ``-x `` and the JID to use with ``-j .``. The component entry point is specified with ``-C ``. .. _XEP-0144: https://xmpp.org/extensions/xep-0114.html example ------- Louise wants to run an ActivityPub gateway on her server ``example.org`` with the JID ``ap.example.org``. The shared secret is ``xmpp_rocks`` and she wants the component to start automatically with the backend, thus she doesn't set a profile password. The entry-point for ActivityPub component is ``ap-gateway``, and she wants to use the same name for the profile. To do this, she enters the following command:: $ li profile create ap-gateway -j ap.example.org -p "" -x xmpp_rocks -C ap-gateway -A The component will then be started next time Libervia Backend is launched. If Louise wants to connect it immediately, she can use:: $ li profile connect -cp ap-gateway Available Components ==================== Below is a list of currently available components in Libervia, and instructions on what they do and how to use them. File Sharing ------------ **entry_point:** ``file-sharing`` File Sharing component manage the hosting of user files. Users can upload file there using either `Jingle File Transfer`_ or `HTTP File Upload`_. There is no limit to the size of files which can be uploaded, but administrators can set a quota to limit the space that can be used. Files can be retrieved using `File Information Sharing`_, and deleted using `Ad-Hoc Commands`_. Files can be shared with a public HTTP link, or made available only to a specified list of entities (JIDs). Permissions can be set through Ad-Hoc Commands. .. _Jingle File Transfer: https://xmpp.org/extensions/ .. _HTTP File Upload: https://xmpp.org/extensions/xep-0363.html .. _File Information Sharing: https://xmpp.org/extensions/xep-0329.html .. _Ad-Hoc Commands: https://xmpp.org/extensions/xep-0050.html Configuration ~~~~~~~~~~~~~ All options are to be set in ``[component file-sharing]`` section. ``http_upload_port`` port to use for HTTP File Upload **default**: 8888 ``http_upload_connection_type`` either ``http`` or ``https``. **default**: ``https`` Note that HTTP Upload should always be ``https`` to end-user, the ``http`` option is to be used only if you use a HTTP server as a proxy, and this server is already set for TLS. ``http_upload_public_facing_url`` must be set to the URL that end-user will see. Notably useful if the component is behind a proxy. **default**: ``https://:` stanzas, i.e. the ones used for instant messaging). Of course it also convert in a similar way in the other direction (XMPP → ActivityPub). A received AP items will be converted to an XMPP pubsub item if any of the following condition is fulfilled: - it is addressed to the special `*public* collection`_ - it is addressed to a local *followers* collection A received AP item will be convert to an XMPP message if all the following condition are fulfilled: - it is **not** addressed to the special *public* collection - it is **not** addressed to a any local *followers* collection. In other words, if an AP items is addressed directly to one or more local users, is not public and is not addressed to a *followers* collection, it will be converted to an XMPP message, otherwise it will be converted to an XMPP pubsub item. The behaviour is symmetric, thus if you send an XMPP message it will be converted to an AP item which will be only addressed to your recipient. If you write using XMPP pubsub, the suitable followers collections of the target AP actor will be automatically added, and the item will have the special *public* collection added. .. note:: ActivyPub doesn't do any kind of `end-to-end encryption`_, it is **not** the same level of privacy as XMPP. Messages will be at minimum readable by the administrators of the AP gateway and of the ActivyPub server of the destinee. Be sure to understand that before sending messages. If you need more privacy, you need to use either XMPP only (without the ActivityPub gateway) with clients implementing correctly end-to-end encryption, or an other software. Depending of the level of pricacy required, you may want to use authentication by a separated channel, a client which has been audited, encryption by default, etc. This is beyond the scope of this AP gateway documentation. In short, don't use ActivityPub if you need a high level of privacy. This is a current protocol limitation, and there is nothing that this gateway can do about this until ActivityPub and its implementations evolve. .. _XEP-0277 (Microblogging over XMPP): https://xmpp.org/extensions/xep-0277.html .. _*public* collection: https://www.w3.org/TR/activitypub/#public-addressing .. _end-to-end encryption: https://en.wikipedia.org/wiki/End-to-end_encryption Using the Component (for developers) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Publication of AP items can be tested using the following method (with can be accessed through the ``APSend`` bridge method, client is then replaced by the ``profile`` name, as last argument): .. automethod:: sat.plugins.plugin_comp_ap_gateway.APGateway.publishMessage The method can be used either with CLI's :ref:`debug bridge method ` or with any D-Bus tool like ``qdbus`` or ``d-feet`` (only if you use the D-Bus bridge). example ~~~~~~~ On its ``example.net`` Mastodon instance, Pierre has published a message with the id ``https://example.net/@pierre/106986412193109832``. To send a reply to this message, Louise can use the following command:: $ li debug bridge method -c APSend '"{\"node\": \"https://example.net/@pierre/106986412193109832\", \"content\": \"A lille hello from XMPP\"}","pierre\\40example.net@ap.example.org", "louise"' Note the double escaping, one for the shell argument, and the other to specify JSON object.