sms-gateway
A http frontend for smstools
Features
- Configurable validation of minimum/maximum message length
- Validation of validity of GSM-7 characterset
- Highly configurable rate limiting for multiple arbitrary time spans (e.g. one global limit per month, another per-receiver limit per minute)
- Configurable automatic data retention of stored numbers/timestamps
- No database (in memory)
- Written in Rust (typesafe, memorysafe, fast)
Usage
Send a message via post request (IP and Port need to match your configuration):
curl -i -d '{"number": "+4915785315089", "text": "Hello from an SMS"}' -H 'Content-Type: application/json' -X POST http://127.0.0.1:4242
Building
Depending on which OS you are building for there are different ways to follow
Install Build-Dependencies
-
Install Rust using rustup
-
Add Arm Target for Raspberry Pi: A. 32 Bit Raspbian:
rustup target add armv7-unknown-linux-gnueabihf
B. 64 Bit Raspbian:rustup target add aarch64-unknown-linux-gnu
C. Skip this step if you are targeting a machine with the same architecture -
Install the Linker: A. 32 Bit Raspbian:
sudo apt install gcc-arm-linux-gnueabihf
B. 64 Bit Raspbian:sudo apt install gcc-aarch64-linux-gnu
C. Skip this step if you are targeting a machine with the same architecture
Compiling
Crosscompiling for Raspbian:
- Edit the
build_and_deploy.sh
-script to fit your target architecture and machine - Ensure you have ssh-access to the root account of the target machine
- Run the script
Compiling for same architecture:
- Run
cargo build --release
- Copy the resulting binaries from the
target/release
directory
Installation
- Install dependencies:
sudo apt install smstools nginx
- Configure smstools (
/etc/smsd.conf
) so it works for manual SMS sending. You may send SMS manually by placing the rightly formated (and moveable by usersmsd
) file into/var/spool/sms/outgoing/
. - Place the sms-gateway binaries into
/srv/sms-gateway/
- Just execute the
sms-gateway
binary for the first time and it will create a default configuration at/etc/sms-gateway/config.toml
for you - Execute it again and it should be running now
- Setup nginx reverse proxy and restart nginx
- Install the systemd service for sms-gateway (see example directory)
- Ensure
sms-gateway
runs under permissions that may write to/var/spool/sms/outgoing