Skip to content
Snippets Groups Projects
Select Git revision
  • e06f5c8f52487cd5d1ac20874a62439daf25fd95
  • main default protected
2 results

sms-gateway

  • Clone with SSH
  • Clone with HTTPS
  • 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

    1. Install Rust using rustup

    2. 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

    3. 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:

    1. Edit the build_and_deploy.sh-script to fit your target architecture and machine
    2. Ensure you have ssh-access to the root account of the target machine
    3. Run the script

    Compiling for same architecture:

    1. Run cargo build --release
    2. Copy the resulting binaries from the target/release directory

    Installation

    1. Install dependencies: sudo apt install smstools nginx
    2. 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 user smsd) file into /var/spool/sms/outgoing/.
    3. Place the sms-gateway binaries into /srv/sms-gateway/
    4. 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
    5. Execute it again and it should be running now
    6. Setup nginx reverse proxy and restart nginx
    7. Install the systemd service for sms-gateway (see example directory)
    8. Ensure sms-gateway runs under permissions that may write to /var/spool/sms/outgoing