Skip to content
Snippets Groups Projects
Commit c6cc9c6d authored by Philip Maas's avatar Philip Maas
Browse files

Update README.md

parent 57ef7564
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,84 @@
This project realizes a signal community bot known from other social plattforms like Twitch, Discord & Mumble. It is based on the simple request to automatically remind a groupchat of upcoming birthdays and events.
# Installation
Install required packages: `pip3 install -r requirements.txt`
## Installation preparation
This section describes how to install signal-cli on a Raspberry Pi 4. Note that earlier hardware versions are not supported due to the built-in processor generation.
* Installation JRE: `$ sudo apt-get install default-jre`
* Installation Gradle: `$ sudo apt-get install gradle`
* When installing Rust on a Raspberry Pi, it is recommended to install *rustup - The Rust Language installer* by [snapcraft](https://snapcraft.io/install/rustup/raspbian)
* Installation of the Snap Store: `$ sudo apt install snapd`
* Restart the Pi: `$ sudo reboot`
* Installation of core snap: `$ sudo snap install core`
* Installation of rustup: `$ sudo snap install rustup --classic`
* Installation of the protocol buffer compiler: `$ sudo apt install protobuf-compiler`
## Compilation of the signal-cli libraries
The *signal-cli* equires the libraries [Libsignal-client](https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal) and [Libzkgroup](https://github.com/signalapp/zkgroup/releases). They will be downloaded from GitHub and then compiled.
* Installation of the Libsignal-client library
* Switch to the java directory: `$ cd java`
* Comment out the compilation of the Android Lib with `#`
* `$ sed -i "s/, ':android'//" settings.gradle`
* `$ ./build_jni.sh desktop`\
The compiled library is then located in the directory *libsignal-client* under *target/release/libsignal_jni.so*.
* Installation of the Libzkgroup library
* `$ make libzkgroup`
You can optionally compile with four processor cores using the `-j4` parameter.
## Compilation and installation of the signal-cli
This section corresponds to the [signal-cli instructions](https://github.com/AsamK/signal-cli#building) for compiling.
* Download the Git-Repository: `$ git clone https://github.com/AsamK/signal-cli.git`
* compile with Gradle: `$ ./gradlew build`
* Create a shell wrapper in the directory *build/install/signal-cli/bin*: `$ ./gradlew installDist`
* Create the tar file in the *build/distributions* directory: `$ ./gradlew distTar`
The libraries compiled in the previous section must now be replaced in the compiled signal-cli tar.
* Switch to directory *signal-cli/build/distributions*
* unzip tar: `$ sudo ln -sf /opt/signal-cli-"${VERSION}"/bin/signal-cli /usr/local/bin/`
* delete libsignal-client from the jar in the `/opt/signal-cli-*/lib` folder: `$ zip -d signal-client-java-*.jar libsignal_jni.so`
* delete the library libzkgroup from the jar: `$ zip -d zkgroup-java-*.jar libzkgroup.so`
* Specify the path to the compiled libraries in `/opt/signal-cli-*/bin/signal-cli`:
* `JAVA_LIBRARY_PATH="-Djava.library.path=/your/java/library/path"`
* `exec "$JAVACMD" "$JAVA_LIBRARY_PATH" "$@"`
## Installing the required Python libraries
Automatically install all required packages: `pip3 install -r requirements.txt`
# Create an Account
A phone number is required to create an account. It is possible to receive the opening code via SMS or voice call. In these instructions, a landline number is used for the account and thus the activation by voice call. Please note that the country code must be entered for the telephone number, which is +49 for Germany.
* Register the phone number. `USERNAME` must be replaced by the phone number.
* via SMS Verification: `signal-cli -u USERNAME register`
* via Voice verification: `signal-cli -u USERNAME register --voice`
* If the registration fails with the error message *Captcha invalid or required for verification*, a CAPTCHA must be solved:
* Visit the [Signal CAPTCHA Website](https://signalcaptchas.org/registration/generate.html)
* solve the CAPTCHA
* The token can be read out via the console of the web developer tools. In most common browsers, they can be called up via pressing F12. It should be noted that the website has no other content and is therefore completely empty.
The token is the entire content after the redirect address: `signalcaptcha://`
* Now the registration command from the first point is restarted with the additional parameter `--captcha TOKEN`.
* The code received by SMS or call is passed instead of `CODE`: `signal-cli -u USERNAME verify CODE`
# Set up the Deamon
When setting up the Deamon service, an article of the [c't 14/2021](https://www.heise.de/select/ct/2021/14/2110907424679785321) serves as a basis, which in turn builds on the signal-cli's [system-bus guide](https://github.com/AsamK/signal-cli/wiki/DBus-service#system-bus). The signal-cli is set up as a Systemd service, so that it is automatically started at system startup. In addition, the service is automatically restarted in the event of an error.
As described in c't and the signal-cli wiki, a separate user is set up for signal-cli. This is a common practice in order to simplify access rights. In addition, all users of the system have access to the running signal-cli session via the D-Bus.
The user *signal-cli* for the Deamon is created via the command \
`sudo adduser --system --home /var/lib/signal-cli signal-cli` \
The default config and service files are copied as root from the signal-cli directory with the following commands \
* `sudo cp data/org.asamk.Signal.conf /etc/dbus-1/system.d/`
* `sudo cp data/org.asamk.Signal.service /usr/share/dbus-1/system-services/`
The service file is stored under `/etc/system/system/signal-cli.service`. To save the file there, root privileges are also required. With the entry `\ExecStart=/usr/local/bin/signal-cli --config /var/lib/signal-cli -u USERNAME daemon --system `the command for the program call is specified. `USERNAME` has to be replaced again.
The created account data is stored in the home directory of the signal-cli user. The command `sudo cp -r ~/.local/share/signal-cli* /var/lib/signal-cli` copies all files from the personal directory.
Finally `sudo chown -R signal-cli /var/lib/signal-cli` is used to set that all files in the created home directory belong to the user with the same name.
The service is activated with the command `sudo sytemctl --now enable signal-cli` and started with `sudo systemctl start signal-cli`.
With the command `sudo systemctl status signal-cli.service` you can check if the setup was successful and if the service is active.
# Features
The signalbot listens to commands that start with a dot.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment