Signal-cli on OpenBSD 6.8
If anyone wants to receive or send Signal Messenger messages from the terminal, here is a short guide for installing Signal-cli:
- Install required packages
doas pkg_add jdk gmake gcc
Choose jdk-11 (2)
/usr/local/jdk-11/man add to:
/etc/man.conf
- Install OpenBSD libmatthew fork
doas git clone https://gitlab.com/h3artbl33d/libmatthew.git /usr/local/libmatthew
As root:
export PATH=/usr/local/jdk-11/bin:/usr/local/jdk-11/jre/bin:$PATH
export JAVA_HOME=/usr/local/jdk-11
cd /usr/local/libmatthew
In the Makefile change jdk-1.8.0 to jdk-11 (lines 15, 23)
Also change line 13, -source 1.5 to -source 1.6
gmake
gmake install
cd
rm -Rf /usr/local/libmatthew
- Install Signal-cli
cd /usr/local
As root:
ftp https://github.com/AsamK/signal-cli/releases/download/v0.7.4/signal-cli-0.7.4.tar.gz
tar -xzf signal-cli-0.7.4.tar.gz
mv signal-cli-0.7.4 signal-cli
ln -s /usr/local/signal-cli/bin/signal-cli /usr/local/bin/signal-cli
- Link device
Wherever your portstree is located, cd to the libqrencode folder
cd /usr/ports/graphics/libqrencode
doas make install clean
NOT as root:
export JAVA_HOME=/usr/local/jdk-11
signal-cli link -n "DEVICE_NAME"
(-n "DEVICE_NAME" is optional, default name is CLI)
The output with tsdevice:/?uuid=... will be needed for creating a qrcode.
(There will be also two warnings with unsupported TLS program header and libzkgroup)
Do not close it during the linking process. If it's successful, it'll close automatically saying: Associated with: +1234567890
In a different terminal window create an image file with qrencode using the tsdevice:/?uuid=... output:
qrencode -o FILENAME.png 'tsdevice:/?uuid=...'
Open the generated image and read the qrcode by phone for linking with Signal (Signal/Settings/Linked Devices).
If the scan was successful, "Associated with:..." should appear in the first terminal. You can also register a number (see Addendum below).
- Receive messages
After having linked signal-cli, you can fetch your contacts and check new messages:
signal-cli -u +1234567890 receive
+1234567890 should be the number you’ve linked (including the country code) but actually using -u is not required anymore.
In the output there will be two warnings (new messages appear in a line called 'Body').
Data will be stored in: ~/.local/share/signal-cli/data
Output looks like:
Envelope from: +1234567890 (device: 1)
Timestamp: 9876543219876 (2021-00-00T00:00:00.000Z)
Sender: +1234567890 (device: 1)
Received a sync message
Received complete sync contacts
- application/octet-stream (Pointer)
Id: YZ Key length: 64
Filename: -
Size: 1036 bytes
Voice note: no
Dimensions: 0x0
.
.
.
Received a sync message
I had an issue with NotFoundException:
Failed to send message: org.whispersystems.signalservice.api.push.exceptions.NotFoundException: Not found
https://github.com/AsamK/signal-cli/issues/247
In my case there was a digit missing. Double check that the recipient's number is correct if this error message appeares.
(there can be other issues too).
- Send messages + other features
Sending a message:
signal-cli -u +1234567890 send -m "YOUR_MESSAGE" +9876543210
+9876543210 is supposed to be the recipient's number with + and country code. As mentioned using -u +1234567890 is actually not required anymore.
List devices:
signal-cli -u +1234567890 listDevices
List contacts:
signal-cli -u +1234567890 listContacts
Check if a number is registered (it will deliver a true or false):
signal-cli -u +1234567890 getUserStatus +10987654321
- Start daemon
dbus-launch signal-cli -u +1234567890 daemon did not work for me (java.net.UnknownHostException:textsecure-service.whispersystems.org).
When using signal-cli: export JAVA_HOME=/usr/local/jdk-11 is required to be set.
If the java/dbus issue is fixed, signal-cli can be used by installing a terminal UI like siggo.
- From the wiki - Register a number:
Important: The USERNAME is your phone number in international format and must include the country calling code. Hence it should start with a "+" sign. (See Wikipedia for a list of all country codes.)
Register a number (with SMS verification)
signal-cli -u USERNAME register
You can register Signal using a land line number. In this case you can skip SMS verification process and jump directly to the voice call verification by adding the --voice switch at the end of above register command. 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.
signal-cli -u USERNAME verify CODE