init commit
This commit is contained in:
parent
f9bf58862d
commit
30d8fd5888
76
README.md
76
README.md
|
@ -1,2 +1,76 @@
|
|||
# Signal-cli
|
||||
# signal-cli
|
||||
This guide is for installing and running signal-cli as a daemon and setting up a system-wide dbus.
|
||||
signal-cli is a commandline interface for the [Signal messenger](https://signal.org/).
|
||||
It supports registering, verifying, sending and receiving messages.
|
||||
signal-cli uses a [patched libsignal-service-java](https://github.com/Turasa/libsignal-service-java),
|
||||
extracted from the [Signal-Android source code](https://github.com/signalapp/Signal-Android/tree/main/libsignal/service).
|
||||
For registering you need a phone number where you can receive SMS or incoming calls.
|
||||
|
||||
## Installation
|
||||
|
||||
System requirements:
|
||||
|
||||
- at least Java Runtime Environment (JRE) 17
|
||||
- wget
|
||||
```sh
|
||||
debian: $ sudo apt install wget openjdk-17-jre
|
||||
```
|
||||
|
||||
### Install system-wide on Linux
|
||||
|
||||
See [latest version](https://github.com/AsamK/signal-cli/releases).
|
||||
|
||||
```sh
|
||||
export VERSION=<latest version, format "x.y.z">
|
||||
wget https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}"-Linux.tar.gz
|
||||
sudo tar xf signal-cli-"${VERSION}"-Linux.tar.gz -C /opt
|
||||
sudo ln -sf /opt/signal-cli-"${VERSION}"/bin/signal-cli /usr/local/bin/
|
||||
```
|
||||
|
||||
## Initial Setup
|
||||
Create user for running the service, --systen creates a system user without home dir and password. :
|
||||
```sh
|
||||
# adduser --system --group signal-cli
|
||||
```
|
||||
Create a folder for signal account configs:
|
||||
```sh
|
||||
# mkdir /var/lib/signal-cli
|
||||
# chown signal-cli: /var/lib/signal-cli
|
||||
```
|
||||
|
||||
## Register Account
|
||||
```sh
|
||||
# su signal-cli -s /bin/bash
|
||||
|
||||
signal-cli$ /usr/local/bin/signal-cli --config /var/lib/signal-cli -u <PHONE NUMBER> register
|
||||
```
|
||||
Registering may require solving a CAPTCHA challenge: [Registration with captcha](https://github.com/AsamK/signal-cli/wiki/Registration-with-captcha)
|
||||
|
||||
Verify the number using the code received via SMS or voice, optionally add `--pin PIN_CODE` if you've added a pin code to your account:
|
||||
```sh
|
||||
signal-cli$ /usr/local/bin/signal-cli --config /var/lib/signal-cli -u <PHONE NUMBER> verify <CODE>
|
||||
```
|
||||
|
||||
## Setup systemd service and dbus
|
||||
To run on the system bus you need to take some additional steps. It’s advisable to run signal-cli as a separate unix user, the following steps assume you created a user named signal-cli. To run a service on the system bus, a config file is needed to allow the signal-cli user to take a name on the system bus. An example config file can be found in data/org.asamk.Signal.conf. This file also configures that any user can talk with the signal-cli daemon. The data/org.asamk.Signal.service and data/signal-cli.service files configure a dbus activated systemd service for signal-cli, so the service is automatically started when the dbus service is requested.
|
||||
|
||||
These steps, executed as root, should work on all distributions using systemd.
|
||||
|
||||
Git clone this repo as you will need files from the data folder.
|
||||
```sh
|
||||
git clone
|
||||
```
|
||||
move the files:
|
||||
```sh
|
||||
# mv data/org.asamk.Signal.conf /etc/dbus-1/system.d/
|
||||
# mv data/org.asamk.Signal.service /usr/share/dbus-1/system-services/
|
||||
# mv data/signal-cli.service /etc/systemd/system/
|
||||
```
|
||||
edit service file to match phone number and enable systemd service:
|
||||
```sh
|
||||
sed -i -e "s|%number%|<PHONE NUMBER>|" /etc/systemd/system/signal-cli.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable signal-cli.service
|
||||
systemctl reload dbus.service
|
||||
systemctl start signal-cli.service
|
||||
```
|
||||
|
|
16
data/org.asamk.Signal.conf
Normal file
16
data/org.asamk.Signal.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?> <!--*-nxml-*-->
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
|
||||
<busconfig>
|
||||
<policy user="signal-cli">
|
||||
<allow own="org.asamk.Signal"/>
|
||||
<allow send_destination="org.asamk.Signal"/>
|
||||
<allow receive_sender="org.asamk.Signal"/>
|
||||
</policy>
|
||||
|
||||
<policy context="default">
|
||||
<allow send_destination="org.asamk.Signal"/>
|
||||
<allow receive_sender="org.asamk.Signal"/>
|
||||
</policy>
|
||||
</busconfig>
|
4
data/org.asamk.Signal.service
Normal file
4
data/org.asamk.Signal.service
Normal file
|
@ -0,0 +1,4 @@
|
|||
[D-BUS Service]
|
||||
Name=org.asamk.Signal
|
||||
Exec=/bin/false
|
||||
SystemdService=dbus-org.asamk.Signal.service
|
18
data/signal-cli.service
Normal file
18
data/signal-cli.service
Normal file
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=Send secure messages to Signal clients
|
||||
Requires=dbus.socket
|
||||
After=dbus.socket
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment="SIGNAL_CLI_OPTS=-Xms2m"
|
||||
ExecStart=signal-cli --config /var/lib/signal-cli --trust-new-identities=always -u %number% daemon --system
|
||||
User=signal-cli
|
||||
BusName=org.asamk.Signal
|
||||
# JVM always exits with 143 in reaction to SIGTERM signal
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
Alias=dbus-org.asamk.Signal.service
|
Loading…
Reference in a new issue