fix postmarket devices link
[sxmo-sms-ssh] / README.md
1 # sxmo - send sms to activate ssh remote port forwarding
2
3 First, let me start with a use case: I want to send sms from my phone to sim card
4 at remote location which will then bring up mobile network data and establish
5 remote ssh port forwarding to external host using new mobile connection so I can
6 log in back into network which lost it's connectivity with internet.
7
8 I spent way too much time trying to solve this, mostly because I didn't try
9 [sxmo](https://sxmo.org) which is exactly what I needed for this job.
10
11 ## device
12
13 For device, I was fortunate than I had pinephone, one of 
14 [devices supported by postmarketos](https://wiki.postmarketos.org/wiki/Devices)
15
16 # postmarketos usb network setup
17
18 After plugging it in with usb cable, I configure usb network (which
19 changes device on every reboot of pinephone) with [pm-net.sh script](pm-net.sh)
20
21 Default password is **147147** which you will also need if you want to unlock device.
22
23 # find out sim card number
24
25 If you don't know phone number of this card, now you can
26 send test sms message to your number:
27 ```
28 /usr/bin/sxmo_modemsendsms.sh +385912345678 "test sms"
29 ```
30
31 # install modified hooks from this repository
32
33 It's simplest to just checkout this repository into home directory on device.
34
35 # sms hook
36
37 This hook is implemented in [.config/sxmo/hooks/sxmo_hook_sms.sh](.config/sxmo/hooks/sxmo_hook_sms.sh)
38
39 ## create sms-ssh-number
40
41 This file will be used to verify numbers which are allowed to start ssh tunnel
42
43 ```
44 # ssh into device
45 ssh user@172.16.42.1
46 echo "+385912345678 optional comment" >> sms-ssh-number
47 ```
48
49 When sms with number in **sms-ssh-number** is received, it will start ssh tunnel using
50 [srce02-up.sh](srce02-up.sh)
51
52 ## see log of sms messages
53
54 This hook will also save all sms messages in file on device (which you can than backup)
55
56 ```
57 tail -f ~/.local/state/sms.txt
58 ```
59
60 # see all device logs
61
62 There is also more elaborate [logread.sh](logread.sh) script tails all
63 logs on device together for monitoring.
64
65 # battery
66
67 Battery monitoring is implemented in
68 [.config/sxmo/hooks/sxmo_hook_statusbar.sh](.config/sxmo/hooks/sxmo_hook_statusbar.sh)
69
70 to see graphs for voltage and current of battery run following from xterm:
71
72 ```
73 ssh user@172.16.42.1 ./battery.gnuplot
74 ```
75
76 or
77
78 ```
79 xterm -e 'ssh user@172.16.42.1 ./battery.gnuplot ; read'
80 ```
81
82 To see last 10 minutes of battery usage:
83
84 ```
85 pine64-pinephone:~$ tail ~/.local/state/battery.log
86 ```
87