... | ... |
@@ -7,6 +7,22 @@ |
7 | 7 |
# the default umask is set in /etc/profile; for setting the umask |
8 | 8 |
# for ssh logins, install and configure the libpam-umask package. |
9 | 9 |
|
10 |
+if test -n "$SHELLINABOX_URL" -a -z "$TMUX"; then |
|
11 |
+ trap "exit 1" ZERR |
|
12 |
+ if test ${SHELLINABOX_URL/https???seb.lautre.net} = $(sed -rn '/^ *location /N;/try_files .* @shellinabox/s|^ *location +([^ ]+).*$|\1/|p' /etc/nginx/sites-available/default); then |
|
13 |
+ token=$(date +%s | sum) |
|
14 |
+ $HOME/scripts/smsapi "shellinabox code: ${token// *1}" |
|
15 |
+ read "user_token?token: " |
|
16 |
+ if test "$user_token" != "${token// *1}"; then |
|
17 |
+ exit 1 |
|
18 |
+ fi |
|
19 |
+ unset token user_token |
|
20 |
+ else |
|
21 |
+ exit 1 |
|
22 |
+ fi |
|
23 |
+ trap - ZERR |
|
24 |
+fi |
|
25 |
+ |
|
10 | 26 |
is_from_localhost () { |
11 | 27 |
for localhost in $(grep localhost /etc/hosts); do |
12 | 28 |
[ "${localhost%% *}" = "$1" ] && return 0 |