Python implementation of the Session open group server

Overview

example workflow

API Documentation

CLI Reference

Want to build from source? See BUILDING.md.
Want to deploy using Docker? See DOCKER.md.

Installation Instructions

Video Guide

Note: .debs for the Session Open Group server are currently only available for Ubuntu 20.04.
For other operating systems, you can either build from source or use Docker.

Step 1: Pull in the Session open group server executable:

sudo curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg
echo "deb https://deb.oxen.io $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/oxen.list
sudo apt update
sudo apt install session-open-group-server

Step 2: Add a room

Add a room of your choice with the following command:

session-open-group-server --add-room {room_id} {room_name}

room_id must be lowercase and consist of only letters, numbers and underscores.

For example:

session-open-group-server --add-room fish FishingAustralia

Step 3: Print your server's URL

Print the URL users can use to join rooms on your open group server by running:

session-open-group-server --print-url

This will output a result similar to:

http://[host_name_or_ip]/[room_id]?public_key=2054fa3271f27ec9e55492c85d022f9582cb4aa2f457e4b885147fb913b9c131

You will need to replace [host_name_or_ip] with the IP address of your VPS or the domain mapping to your IP address, and [room_id] with the ID of one of the rooms you created earlier.

For example:

http://116.203.217.101/fish?public_key=2054fa3271f27ec9e55492c85d022f9582cb4aa2f457e4b885147fb913b9c131

This URL can then be used to join the group inside the Session app.

Step 4: Make yourself a moderator

Make yourself a moderator using the following command:

session-open-group-server --add-moderator {your_session_id} {room_id}

For example:

session-open-group-server --add-moderator 05d871fc80ca007eed9b2f4df72853e2a2d5465a92fcb1889fb5c84aa2833b3b40 fish

Step 5: Add an image for your new room (Optional)

  • Add your room on Session desktop using the URL printed earlier
  • Use Session desktop to upload a picture for your room

Or

  • Upload a JPG to your VPS
  • Put it in /var/lib/session-open-group-server/files
  • Rename it to {room_id} (no file extension)

Customization

The default options the Session open group server runs with should be fine in most cases, but if you like you can run on a custom port or host, specify the path to the X25519 key pair you want to use, etc. To do this, simply add the right arguments to the ExecStart line in your systemd service file (normally located under /etc/systemd/system) and restart your service using:

systemctl restart session-open-group-server.service
Comments
  • Allow rejection of postings written in a particular alphabet.

    Allow rejection of postings written in a particular alphabet.

    The user configures in sogs.ini a list of alphabets to reject by default:

    alphabet_filters = [ arabic, cyrillic, persian ]

    An empty list means no filtering is desired.

    If there are rooms in which these alphabets should be allowed, a list of room ids per alphabet may be specified for whitelisting.

    alphabet_whitelist_arabic = [ 8 ] alphabet_whitelist_cyrillic = [ 5, 13 ] alphabet_whitelist_persian = [ 18 ]

    A list of valid room ids can be obtained with the following SQL:

    $ sudo sqlite3 /var/lib/session-open-group-server/sogs.db 'SELECT * FROM rooms;'

    The implementation can easily be extended to more alphabets.

    This pull-request supersedes #128.

    opened by ianmacd 3
  • Proof of concept: Reject postings containing text written in Farsi.

    Proof of concept: Reject postings containing text written in Farsi.

    In its current state, the filter is of limited use:

    • The filter allows only a single group to be whitelisted from filtering. This makes it unusable if Farsi is an allowed language in more than one group on the server.

    • No error other than the failure to send is reported to the client.

    The purpose of this PR is to spark discussion and pave the way for the implementation of a multi-lingual, per group language filter.

    -- Codepoint reference: https://github.com/mirhmousavi/Regex.Persian.Language

    opened by ianmacd 3
  • Help: How to use this program to send a message to a group

    Help: How to use this program to send a message to a group

    I want to use this program to create a group and push messages from other channels to the group at the same time. My code is here: https://github.com/liqsliu/session-pysogs/blob/7efa148dae9f9643a6da04e7e36989a6b0112ca5/sogs/mule.py#L99 At present, I can't see the messages I send with it in the Android client, but I can see it in the web browser.

    IMG_20220205_201535_104~2

    opened by liqsliu 3
  • Add support for IN clauses to db.query()

    Add support for IN clauses to db.query()

    Expanding IN clauses in bindings with SQLAlchemy requires a little more work (and the existing IN clauses were broken).

    This expose the needed mechanics in the query() interface, used such as:

        db.query(
            "SELECT * FROM blah WHERE id IN :ids",
            ids=[1,2,3],
            bind_expanding=['ids']
        )
    
    opened by jagerman 3
  • Messages posted prior to enabling id blinding are downloaded with real Session id after enabling id blinding.

    Messages posted prior to enabling id blinding are downloaded with real Session id after enabling id blinding.

    After enabling id blinding on sog.caliban.org, I observe that messages posted prior to blinding are still downloaded by Session with the original unblinded id.

    This allows the association of blinded ids with their unblinded counterparts for any given display name.

    Should id blinding not be retroactively applied to all messages downloaded from the server?

    opened by ianmacd 2
  • Reactions

    Reactions

    Adds support for server-side reactions handling for open groups.

    Reactions are now returned as an extra field when messages are retrieved, such as this:

            "reactions": {
              "๐Ÿ‘": {
                "index": 1,
                "total": 150,
                "reactors": [
                  "058328640343b91c03d393b8dc6ce15c8f93b191ff78054b6ae2c8030e2680b4d6",
                  "05d782a81448199aea940f496cc70dc644c269e5979e472536ea03a067bf46d54a",
                  "05233432db6edcd320a06b550d4dcf1a06cc486c58f8017a565f6f7dc0fc8b9512",
                  "05ca519a397a1aa8a7a1515ff433dd2784cbcbb31c358b1a6e97fb758ceab44dca"
                ],
                "you": true
              },
              "๐Ÿ‘Ž": {
                "index": 0,
                "total": 27,
                "reactors": [
                  "05ca519a397a1aa8a7a1515ff433dd2784cbcbb31c358b1a6e97fb758ceab44dca",
                  "055297c3dc032bef33a21dcb1b76265c8319e53ed0867accd3c274c25ae33c1731",
                  "05986c4e7fec0ac1a3a544d84367b2e995f85a6356be8d082724781a9ff699ac7a",
                  "0537f1727302b70be32fc371523097bcdbc3e681f947a68ef5e3ea1365a689666a"
                ]
              },
              "๐Ÿ†": {
                "index": 2,
                "total": 1,
                "reactors": [
                  "051234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
                ],
                "you": true
              },
    

    When polling for new messages (using the /since endpoint) you also get updates for any posts that have had new reactions added or removed from the post (but not otherwise changed); these look vaguely similar to messages that you'd normally get back from /since, except they are missing most of the info other than id, seqno, and the reactions:

    { "id" 1234, "seqno": 56768, "reactions": { /* as above */ } }
    

    so that, when polling, you get notified (in bulk) of reaction changes in one go per message.

    Since this might break existing clients, I've feature-guarded this by adding a new URL parameter t=r to the /since endpoint, so that you'd fetch: /room/ROOMID/messages/since/56768?t=r to tell SOGS that you want to opt-in to the new reactions rows.

    Reactions update the room's sequence number, so clients should update their current seqno value when they get such a reaction row (so that they will only get the reactions again if there are changes to reactions).

    The reactors shows the first N session IDs that reacted; by default this is 4, but can be anywhere from 0 to 20 by adding a reactors=N query string parameter. (As a special case, 0 omits the "reactors" key entirely).

    Adding/removing a reaction is done via endpoints: Submitting reactions is done via:

    PUT /room/ROOM/reaction/MSGID/๐Ÿ‘ (body is an empty json dict {}) DELETE /room/ROOM/reaction/MSGID/๐Ÿ‘

    (I want to say that the ๐Ÿ‘ should be URL-encoded utf-8 bytes (e.g. %f0%9f%91%8d for the encoded ๐Ÿ‘) when making a direct HTTP request (e.g. over lokinet), but from my testing uwsgi and sogs seem perfectly happy with a raw UTF-8 value there as well. Onion requests should be perfectly fine with raw utf8. I haven't yet tested whether it survives cleanly through an nginx proxy in the direct HTTP case yet).

    Moderator endpoints are:

    DELETE /room/ROOMID/reactions/MSGID/๐Ÿ†

    to delete all of a single reaction from a message, and:

    DELETE /room/ROOMID/reactions/MSGID

    to delete all reactions of any type from a message.

    There is also an endpoint to get all reactors (not limited to the first N) of a message, including the timestamp when they reacted (this is probably not immediately useful for Session, but would be quite useful for, say, a bot that wants to check for all reactions on startup):

    GET /room/ROOMID/reactors/MSGID/๐Ÿ†

    which returns lists of pairs of session ID + timestamp, sorted by timestamp, of when reactions were added. For example:

    [
        ["05ca519a397a1aa8a7a1515ff433dd2784cbcbb31c358b1a6e97fb758ceab44dca", 1656631467.6396575],
        ["055297c3dc032bef33a21dcb1b76265c8319e53ed0867accd3c274c25ae33c1731", 1656631480.2537503]
    ]
    
    opened by jagerman 2
  • Cannot install python3-oxenmq

    Cannot install python3-oxenmq

    i'm getting this error when attempting to install the oxen proxy package:

    Package python3-oxenmq is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'python3-oxenmq' has no installation candidate
    

    any workarounds? running ubuntu 22.04

    opened by alexanderepolite 2
  • Is there any possible way to have automated messages in my open group?

    Is there any possible way to have automated messages in my open group?

    I run a status page and would love to have some sort of way to tie it into the open group, maybe like a webhook of some sort? So it can send a message to the group when one of my services goes down, for example.

    Not sure if this is possible, but I guess asking won't hurt!

    • Cross
    opened by dillfrescott 2
  • Add oxenmq as a uwsgi mule

    Add oxenmq as a uwsgi mule

    This adds an oxenmq as a mule that listens on :22028 by default (using curve encryption with the same x25519 key as the server). This oxenmq now handles db cleanup as well (instead of scheduling it through a regular front-end worker).

    You can kick the mule by sending it signals through the signal.send_signal function so that it can be triggered when things happen from model; a couple stubs are included here for message creation and message deletion.

    (NB: requires pyoxenmq built against the last oxenmq (1.2.9), such as the updated python3-oxenmq 1.0.0-3 package, or installed with pip3 with an updated liboxenmq-dev installed).

    opened by jagerman 2
  • Ubuntu 20.04 installation is broken

    Ubuntu 20.04 installation is broken

    Steps: * Follow the steps to install for Ubuntu

    Error happens at step: * sudo apt install sogs-standalone

    Output:

    sudo apt install sogs-standalone
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     sogs-standalone : Depends: python3-sogs (= 0.3.0-2) but it is not going to be installed
    Unable to correct problems, you have held broken packages.
    
    

    I am able to verify the repo is added correctly:

    Hit:1 https://packages.grafana.com/oss/deb stable InRelease
    Hit:2 https://deb.oxen.io focal InRelease
    Hit:3 http://iad-ad-2.clouds.ports.ubuntu.com/ubuntu-ports focal InRelease
    Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
    Hit:5 http://iad-ad-2.clouds.ports.ubuntu.com/ubuntu-ports focal-updates InRelease
    Hit:6 http://iad-ad-2.clouds.ports.ubuntu.com/ubuntu-ports focal-backports InRelease
    
    opened by nathanradavies 1
  • Add python3-nacl >= 1.4.0 to deb for focal

    Add python3-nacl >= 1.4.0 to deb for focal

    We have an updated python3-nacl packaged in our repo, but the deb is just depending on python3-nacl, not >= 1.4.0, and so you can upgrade sogs by itself and not have the updated nacl module installed.

    opened by jagerman 1
  • Admin privileges no longer work after enabling group id blinding.

    Admin privileges no longer work after enabling group id blinding.

    I enabled id blinding for sog.caliban.org on 2023-01-01 at 00.00 UTC. The server runs PySOGS 0.3.6.

    Immediately, I noticed that I had lost hidden global admin privileges in all of my groups. The extra menu options no longer appeared for me.

    These were restored by executing the following:

    $ sudo sogs --add-moderators <my_unblinded_session_id> --rooms=+ --hidden --admin

    Other group-level admins are reporting that privileged features are still displayed in Session's menus, but no longer effective.

    opened by ianmacd 0
  • Profanity list: not effective against fancy text

    Profanity list: not effective against fancy text

    Hello,

    profanity list phrases are currently not effective against fancy text https://textfancy.com/ and one have to add for example: purple ๐‘ƒ๐‘ˆ๐‘…๐‘ƒ๐ฟ๐ธ

    Can You please disable fancy text in Session or convert it to normal/regular text (or do it on SOGS or on profanity filtering level) so the regular text block really everything and fancy one is not a problem for admin ?

    https://github.com/nitanmarcel/fancy_text https://github.com/Secret-chest/fancify-text#readme

    opened by slrslr 0
  • Profanity list: If string is too long, sogs fails to start properly

    Profanity list: If string is too long, sogs fails to start properly

    I suspect that the profanity filtering does not support longer phrases like: privacy?public_key=118df8c6c471ac0468c7c77e1cdc12f24a139ee8a07c6e3bf4e7855640dad821 or aaaaaaaaaaadaaaaaaa118df8c6c471ac0468c7c77e1cdc12f24a139ee8a07c6e3bf4e7855640dad821

    When i add it and ran "sudo systemctl restart sogs"

    Job for sogs-proxied.service failed. See "systemctl status sogs-proxied.service" and "journalctl -xe" for details.

    $ sogs --version PySOGS 0.3.5

    I am on Linux Debian 11, .deb package

    Can you reproduce it and fix it please?

    opened by slrslr 0
  • Getting error when viewing the group URL (qrencode+Python3.10 compatibility problem)

    Getting error when viewing the group URL (qrencode+Python3.10 compatibility problem)

    After creating a group and viewing the group from the web page, the QR code is a broken image. When I view the QR code URL I get the error: Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

    and logs show the errors below: Dec 9 06:52:12 test uwsgi[44550]: #033[32m2022-12-09 06:52:12,979#033[0m #033[35mtest#033[0m #033[34msogs.web[44550]#033[0m #033[1;30mERROR#033[0m #033[31mException on /r/test/invite.png [GET]#033[0m Dec 9 06:52:12 test uwsgi[44550]: Traceback (most recent call last): Dec 9 06:52:12 test uwsgi[44550]: File "/usr/lib/python3/dist-packages/flask/app.py", line 2070, in wsgi_app Dec 9 06:52:12 test uwsgi[44550]: response = self.full_dispatch_request() Dec 9 06:52:12 test uwsgi[44550]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1515, in full_dispatch_request Dec 9 06:52:12 test uwsgi[44550]: rv = self.handle_user_exception(e) Dec 9 06:52:12 test uwsgi[44550]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1513, in full_dispatch_request Dec 9 06:52:12 test uwsgi[44550]: rv = self.dispatch_request() Dec 9 06:52:12 test uwsgi[44550]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1499, in dispatch_request Dec 9 06:52:12 test uwsgi[44550]: return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) Dec 9 06:52:12 test uwsgi[44550]: File "/usr/lib/python3/dist-packages/sogs/routes/views.py", line 64, in serve_invite_qr Dec 9 06:52:12 test uwsgi[44550]: img = qrencode.encode(room.url) Dec 9 06:52:12 test uwsgi[44550]: File "/usr/lib/python3/dist-packages/qrencode/init.py", line 47, in encode Dec 9 06:52:12 test uwsgi[44550]: version, size, data = _encode(data, version, level, hint, True) Dec 9 06:52:12 test uwsgi[44550]: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

    OS is a fresh Ubunto 20.04 Python version: 3.10.6

    Followed install steps here for sogs-standalone: https://docs.oxen.io/products-built-on-oxen/session/guides/open-group-setup

    Any ideas? thx

    bug good first issue 
    opened by digitalblur 2
  • SOGS-proxied: oxen/v4/lsrpc failed (2: No such file or directory),

    SOGS-proxied: oxen/v4/lsrpc failed (2: No such file or directory),

    Hello, in sogs-proxied 0.3.5 on Debian 11 (apt package) with nginx "tail /var/log/nginx/error.log" shows many:

    22:31:57 [error] redacted: *545 open() "/var/www/html/oxen/v4/lsrpc" failed (2: No such file or directory), client: redacted, server: 127.0.0.1, request: "POST /oxen/v4/lsrpc HTTP/1.1", host: "redacted" 22:31:58 [error] redacted: *548 open() "/var/www/html/oxen/v4/lsrpc" failed (2: No such file or directory), client: redacted, server: 127.0.0.1, request: "POST /oxen/v4/lsrpc HTTP/1.1", host: "redacted" 22:31:58 [error] redacted: *549 open() "/var/www/html/oxen/v4/lsrpc" failed (2: No such file or directory), client: redacted, server: 127.0.0.1, request: "POST /oxen/v4/lsrpc HTTP/1.1", host: "redacted"

    I am unable to find any directory/file like that: find / -name lsrpc;find / -name oxen|grep v4

    My nginx.conf is here.

    Which command to run, what to modify to prevent this please?

    opened by slrslr 1
Owner
Oxen
Oxen
Test - Python project for Collection Server and API Server

QProjectPython Collection Server ์™€ API Server ๋ฅผ ์œ„ํ•œ Python ํ”„๋กœ์ ํŠธ ์ž…๋‹ˆ๋‹ค. [FastAPI์ฐธ๊ณ ]

null 1 Jan 3, 2022
This is a Client-Server-System which can share the screen from the server to client and in the other direction.

Screenshare-Streaming-Python This is a Client-Server-System which can share the screen from the server to client and in the other direction. You have

VFX / Videoeffects Creator 1 Nov 19, 2021
This is a Client-Server-System which can send audio from a microphone from the server to client and in the other direction.

Audio-Streaming-Python This is a Client-Server-System which can send audio from a microphone from the server to client and in the other direction. You

VFX / Videoeffects Creator 0 Jan 5, 2023
Huawei firewall automatically updates Chinese ip to target IP group.

Huawei firewall automatically updates Chinese ip to target IP group.

Lundaa 0 Jan 11, 2022
An ftp syncing python package that I use to sync pokemon saves between my hacked 3ds running ftpd and my server

Sync file pairs over ftp and apply patches to them. Useful for using ftpd to transfer ROM save files to and from your DS if you also play on an emulator. Setup a cron job to check for your DS's ftp server periodically to setup automatic syncing. Untested on windows. It may just work out of the box, unsure though.

null 17 Jan 4, 2023
A SOCKS proxy server implemented with the powerful python cooperative concurrency framework asyncio.

asyncio-socks-server A SOCKS proxy server implemented with the powerful python cooperative concurrency framework asyncio. Features Supports both TCP a

Amaindex 164 Dec 30, 2022
Extended refactoring capabilities for Python LSP Server using Rope.

pylsp-rope Extended refactoring capabilities for Python LSP Server using Rope. This is a plugin for Python LSP Server, so you also need to have it ins

null 36 Dec 24, 2022
A simple DHCP server and client simulation with python

About The Project This is a simple DHCP server and client simulation. I implemented it for computer network course spring 2021 The client can request

shakiba 3 Feb 8, 2022
Very simple FTP client, sync folder to FTP server, use python, opensource

ftp-sync-python Opensource, A way to safe your data, avoid lost data by Virus, Randsomware Some functions: Upload a folder automatically to FTP server

null 4 Sep 13, 2022
Simple threaded Python Rickroll server. Listens on port 23 by default.

Terminal Rickroll Simple threaded Python Rickroll server. Listens on port 23 by default. Rickroll video made using Video-To-Ascii and the standard ric

AG 10 Sep 13, 2022
๐ŸŽฅ PYnema is a simple UDP server written in python, allows you to watch downloaded videos.

?? PYnema is a simple UDP server written in python, allows you to watch downloaded videos.

Jan Kupczyk 1 Jan 16, 2022
A Calendar subscribe server for python

cn-holiday-ics-server A calendar subscribe server ็›ดๆŽฅไฝฟ็”จๆˆ‘ๆญๅปบ็š„ๆœๅŠก ่ฎข้˜…่Š‚ๅ‡ๆ—ฅ๏ผšhttps://cdxy.fun:9999/holiday ่ฎข้˜…่ฐƒไผ‘ไธŠ็ญ๏ผšhttps://cdxy.fun:9999/workday ่Š‚ๅ‡ๆ—ฅๅ’Œ่ฐƒไผ‘ไธŠ็ญๅœจไธ€่ตท็š„็‰ˆๆœฌ๏ผšh

CD 11 Nov 12, 2022
TsuserverMoS - A Python-based server for Attorney Online,

tsuserverMoS A Python-based server for Attorney Online, forked from RealKaiser/tsuserverCC Requires Python 3.7+ and PyYAML. Changes/additions from tsu

null 1 Dec 30, 2021
Serves some data over HTTP, once. Based on the built-in Python module http.server

serve-me-once Serves some data over HTTP, once. Based on the built-in Python module http.server.

Peder Bergebakken Sundt 2 Jan 6, 2022
A simple multi-threaded time server and client in python.

time-server-client A simple multi-threaded time server and client in Python. This uses the latest match/case command found in Python 3.10 so requires

Zeeshan Mulk 1 Jan 29, 2022
BlueHawk is an HTTP/1.1 compliant web server developed in python

This project is done as a part of Computer Networks course. It aims at the implementation of the HTTP/1.1 Protocol based on RFC 2616 and includes the basic HTTP methods of GET, POST, PUT, DELETE and HEAD.

null 2 Nov 11, 2022
Passive TCP/IP Fingerprinting Tool. Run this on your server and find out what Operating Systems your clients are *really* using.

Passive TCP/IP Fingerprinting This is a passive TCP/IP fingerprinting tool. Run this on your server and find out what operating systems your clients a

Nikolai Tschacher 158 Dec 20, 2022
No-dependency, single file NNTP server library for developing modern, rfc3977-compliant (bridge) NNTP servers.

nntpserver.py No-dependency, single file NNTP server library for developing modern, rfc3977-compliant (bridge) NNTP servers for python >=3.7. Develope

Manos Pitsidianakis 44 Nov 14, 2022
mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

Fox-IT 1.3k Jan 5, 2023