| #!/bin/sh |
| |
| # This script is used to store local configuartion data to ease batch building |
| |
| # Please customize this script to fit your local requirements |
| |
| random_characters() { |
| sort --random-sort < replaceable-characters | { |
| IFS= |
| while read -r line; do printf %s "$line"; done |
| } |
| } |
| |
| set -e |
| |
| if [ $# != 1 ]; then |
| printf 'Usage: %s <client-name>\n' "$0" 1>&2 |
| exit 255 |
| fi |
| |
| export CC=gcc |
| export CFLAGS="-Wall -Os -fno-common -fomit-frame-pointer" |
| export LDFLAGS=-s |
| # Uncomment following line to enable obfuscation for some strings |
| #export STRING_TRANSLITERATION="\"`random_characters`\"`random_characters`\"" |
| # Edit the following line to fill the server address, port number, public key, |
| # as well as the privileged SSHOUT user name |
| sh build.sh <server-address> <server-port> <server-public-key> <privileged-user-name> "$1" |
| # Example: |
| #sh build.sh 127.0.0.1 22 AAAAB3NzaC1yc2EAAAADAQABAAABAQDSCKGsb7l1PmJafA8rs5sluuSmiQQYRYDrHMhZh5alrCEurzcvz9gfuqr42wUifQInM74tz6H4xoZBGq3qlJjoqFRHQc85X6Og2KdY+Xz+NYdkoHTmC6+5v4qDrNZ6dl0p7oABuMvFPCiYl+jd5sfA6Di/sF7t9/02RdJonrmqQd5qdccHUgkSeQ5aCTKgoZGNm6FAxrbyN/q+YSdCK2aDmjR9IedxjT8ipSrrWmQltLZfJ3GNN1TXy/GXSw1sOVEIq5JoDDiJwZZ13l7c0uPSFDHzqR7Q7ThpdbckRG3LDJWMJgc8SF1ptzYkmRK1MAuHYNtrHSw/fAvW5un/UF4f operator |
| echo |
| echo "set -e" |
| printf 'echo "' |
| xz --best < "client.$1" | base64 -w 80 |
| # You may customize executable file name and service name here |
| echo '" | base64 -d | xz -d > /usr/local/bin/sfc' |
| echo "chmod 755 /usr/local/bin/sfc" |
| printf 'echo "' |
| gzip --best < sfc.service | base64 -w 80 |
| echo '" | base64 -d | gzip -d > /etc/systemd/system/sfc.service' |
| echo "systemctl enable --now sfc" |