| 1 |
# go-sendxmpp |
| 2 |
|
| 3 |
## about |
| 4 |
|
| 5 |
A tool to send messages to an XMPP contact or MUC inspired by [sendxmpp](https://sendxmpp.hostname.sk/). |
| 6 |
You can find other sendxmpp alternatives in the [XSF wiki](https://wiki.xmpp.org/web/User:MDosch/Sendxmpp_incarnations). |
| 7 |
|
| 8 |
## support |
| 9 |
|
| 10 |
You might join the [chat](https://join.jabber.network/#[email protected]?join) if you have problems, |
| 11 |
want to contribute or just want to talk about the project. You might also talk about any of the other |
| 12 |
sendxmpp incarnations. :) |
| 13 |
|
| 14 |
[](https://join.jabber.network/#[email protected]?join) |
| 15 |
|
| 16 |
## installation |
| 17 |
|
| 18 |
### repositories including go-sendxmpp |
| 19 |
|
| 20 |
[](https://repology.org/project/go:sendxmpp/versions) |
| 21 |
|
| 22 |
### manual installation |
| 23 |
|
| 24 |
#### requirements |
| 25 |
|
| 26 |
* [go](https://golang.org/) |
| 27 |
|
| 28 |
#### instructions |
| 29 |
|
| 30 |
Latest release: |
| 31 |
|
| 32 |
```plain |
| 33 |
$ go install salsa.debian.org/mdosch/go-sendxmpp@latest |
| 34 |
``` |
| 35 |
|
| 36 |
Current development version: |
| 37 |
|
| 38 |
```plain |
| 39 |
$ go install salsa.debian.org/mdosch/go-sendxmpp@master |
| 40 |
``` |
| 41 |
|
| 42 |
You will find the binary in `$GOPATH/bin` or, if set, `$GOBIN`. |
| 43 |
|
| 44 |
### binaries |
| 45 |
|
| 46 |
There are some (automatically built and untested) binaries linked to the |
| 47 |
[release](https://salsa.debian.org/mdosch/go-sendxmpp/-/releases). |
| 48 |
|
| 49 |
## usage |
| 50 |
|
| 51 |
You can either pipe a programs output to `go-sendxmpp`, write in your terminal (put \^D in a new |
| 52 |
line to finish) or send the input from a file (`-m` or `--message`). |
| 53 |
|
| 54 |
The account data is expected at `~/.config/go-sendxmpp/config` if no other configuration file location |
| 55 |
is specified with `-f` or `--file`. The configuration file is expected to be in the following format: |
| 56 |
|
| 57 |
```plain |
| 58 |
username: <your_jid> |
| 59 |
password: <your_jabber_password> |
| 60 |
``` |
| 61 |
|
| 62 |
If this is not sufficient to connect you might also specify `jserver` and `port`. It is also possible to |
| 63 |
use a password manager. In this case the `password` setting should be replaced by the `eval_password` |
| 64 |
setting: |
| 65 |
|
| 66 |
``` |
| 67 |
eval_password: <command_to_unlock_your_password> |
| 68 |
``` |
| 69 |
|
| 70 |
You can also configure the alias/nickname for MUCs via the `alias` setting: |
| 71 |
|
| 72 |
``` |
| 73 |
alias: <my_alias> |
| 74 |
``` |
| 75 |
|
| 76 |
If no configuration file is present or if the values should be overridden it is possible to define |
| 77 |
the account details via command line options: |
| 78 |
|
| 79 |
```plain |
| 80 |
Usage: go-sendxmpp [-cdilntv] [-a value] [--allow-plain] [--anonymous] [--fast-invalidate] [--fast-off] [-f value] [--headline] [--help] [-h value] [-j value] [--legacy-pgp] [-m value] [--muc-password value] [--no-sasl-upgrade] [--oob-file value] [--ox] [--ox-delete-nodes] [--ox-genprivkey-rsa] [--ox-genprivkey-x25519] [--ox-import-privkey value] [--ox-passphrase value] [--ox-receive-private-key value] [--ox-transfer-private-key] [-p value] [--raw] [-r value] [--retry-connect value] [--retry-connect-max value] [--scram-mech-pinning value] [--ssdp-off] [-s value] [--suppress-root-warning] [--timeout value] [--tls-version value] [-u value] [--version] [recipients…] |
| 81 |
-a, --alias=value Set alias/nicknamefor chatrooms. |
| 82 |
--allow-plain Allow PLAIN authentication. |
| 83 |
--anonymous Use anonymous authentication. |
| 84 |
-c, --chatroom Send message to a chatroom. |
| 85 |
-d, --debug Show XMPP stanzas. |
| 86 |
--fast-invalidate |
| 87 |
Invalidate XEP-0484: Fast Authentication Streamlining Tokens. |
| 88 |
--fast-off Disable XEP-0484: Fast Authentication Streamlining Tokens. |
| 89 |
-f, --file=value Set configuration file. (Default: |
| 90 |
~/.config/go-sendxmpp/sendxmpprc) |
| 91 |
--headline Send message as type headline. |
| 92 |
--help Show help. |
| 93 |
-h, --http-upload=value |
| 94 |
Send a file via http-upload. Can be invoked several times to upload multiple files. |
| 95 |
-i, --interactive Interactive mode (for use with e.g. 'tail -f'). |
| 96 |
-j, --jserver=value |
| 97 |
XMPP server address. |
| 98 |
--legacy-pgp Use "Legacy PGP" encryption using the Ox key infrastructure |
| 99 |
(deprecated and not encouraged). |
| 100 |
-l, --listen Listen for messages and print them to stdout. |
| 101 |
-m, --message=value |
| 102 |
Set file including the message. |
| 103 |
--muc-password=value |
| 104 |
Password for password protected MUCs. |
| 105 |
--no-sasl-upgrade |
| 106 |
Disable XEP-0480: SASL Upgrade Tasks. |
| 107 |
-n, --no-tls-verify |
| 108 |
Skip verification of TLS certificates (not recommended). |
| 109 |
--oob-file=value |
| 110 |
URL to send a file as out of band data. |
| 111 |
--ox Use "OpenPGP for XMPP" encryption (experimental). |
| 112 |
--ox-delete-nodes |
| 113 |
Delete existing OpenPGP nodes on the server. |
| 114 |
--ox-genprivkey-rsa |
| 115 |
Generate a private OpenPGP key (RSA 4096 bit) for the given |
| 116 |
JID and publish the corresponding public key. |
| 117 |
--ox-genprivkey-x25519 |
| 118 |
Generate a private OpenPGP key (x25519) for the given JID |
| 119 |
and publish the corresponding public key. |
| 120 |
--ox-import-privkey=value |
| 121 |
Import an existing private OpenPGP key. |
| 122 |
--ox-passphrase=value |
| 123 |
Passphrase for locking and unlocking the private OpenPGP |
| 124 |
key. |
| 125 |
--ox-receive-private-key=value |
| 126 |
Import your encrypted private Ox key from the server. |
| 127 |
Requires the transfer code. |
| 128 |
--ox-transfer-private-key |
| 129 |
Upload your encrypted private Ox key to the server for key |
| 130 |
transfer. |
| 131 |
-p, --password=value |
| 132 |
Password for XMPP account. |
| 133 |
--raw Send raw XML. |
| 134 |
-r, --recipients=value |
| 135 |
Read recipients from file. |
| 136 |
--retry-connect=value |
| 137 |
Time to retry to connect after failed connection in seconds. |
| 138 |
(0 = disabled) |
| 139 |
--retry-connect-max=value |
| 140 |
Number of maximum retries to perform for '--retry-connect'. |
| 141 |
(0 = unlimited) |
| 142 |
--scram-mech-pinning=value |
| 143 |
Enforce the use of a certain SCRAM authentication mechanism. |
| 144 |
--ssdp-off Disable XEP-0474: SASL SCRAM Downgrade Protection. |
| 145 |
-s, --subject=value |
| 146 |
Set message subject. |
| 147 |
--suppress-root-warning |
| 148 |
Suppress warning when run as root. |
| 149 |
--timeout=value |
| 150 |
Connection timeout in seconds. [10] |
| 151 |
-t, --tls Use direct TLS. |
| 152 |
--tls-version=value |
| 153 |
Minimal TLS version. 10 (TLSv1.0), 11 (TLSv1.1), 12 |
| 154 |
(TLSv1.2) or 13 (TLSv1.3). [12] |
| 155 |
-u, --username=value |
| 156 |
Username for XMPP account. |
| 157 |
-v, --verbose Show debug information. |
| 158 |
--version Show version information. |
| 159 |
``` |
| 160 |
|
| 161 |
For further information check the manpages [go-sendxmpp(1)](https://manpages.debian.org/unstable/go-sendxmpp/go-sendxmpp.1.en.html) and [go-sendxmpp(5)](https://manpages.debian.org/unstable/go-sendxmpp/go-sendxmpp.5.en.html). |
| 162 |
|
| 163 |
### examples |
| 164 |
|
| 165 |
Send a message to two recipients using a configuration file. |
| 166 |
|
| 167 |
```bash |
| 168 |
cat message.txt|go-sendxmpp -f ./sendxmpp [email protected] [email protected] |
| 169 |
``` |
| 170 |
|
| 171 |
Send a message to two recipients directly defining account credentials. |
| 172 |
|
| 173 |
```bash |
| 174 |
cat message.txt|go-sendxmpp -u [email protected] -p swordfish [email protected] [email protected] |
| 175 |
``` |
| 176 |
|
| 177 |
Send a message to two groupchats (`-c`) using a configuration file. |
| 178 |
|
| 179 |
```bash |
| 180 |
cat message.txt|go-sendxmpp -cf ./sendxmpp [email protected] [email protected] |
| 181 |
``` |
| 182 |
|
| 183 |
Send file changes to two groupchats (`-c`) using a configuration file. |
| 184 |
|
| 185 |
```bash |
| 186 |
tail -f example.log|go-sendxmpp -cif ./sendxmpp [email protected] [email protected] |
| 187 |
``` |
| 188 |
Send a notification if a long running process finishes. |
| 189 |
|
| 190 |
```bash |
| 191 |
waitpid $(pidof -s rsync) && echo "Rsync finished."|go-sendxmpp [email protected] |
| 192 |
``` |
| 193 |
|
| 194 |
### shell completion |
| 195 |
|
| 196 |
There are no shell completions yet (contributions welcome) but for zsh it is possible to automatically create completions from `--help` and for fish it is possible to create completions from the man page. |
| 197 |
Those might work *good enough*. |
| 198 |
|
| 199 |
#### zsh |
| 200 |
|
| 201 |
Just place the following in your `~/.zshrc`: |
| 202 |
|
| 203 |
``` bash |
| 204 |
compdef _gnu_generic go-sendxmpp |
| 205 |
``` |
| 206 |
|
| 207 |
#### fish |
| 208 |
|
| 209 |
Fish can generate them from the man page with following command: |
| 210 |
|
| 211 |
``` bash |
| 212 |
fish_update_completions |
| 213 |
``` |