ソースを参照

Allow ssh to an onion address

Bob Mottram 9 年 前
コミット
ee1e13602e
共有1 個のファイルを変更した16 個の追加0 個の削除を含む
  1. 16
    0
      src/freedombone

+ 16
- 0
src/freedombone ファイルの表示

@@ -3465,6 +3465,7 @@ function initial_setup {
3465 3465
     apt-get -y install ca-certificates emacs24 cpulimit
3466 3466
     apt-get -y install cryptsetup libgfshare-bin obnam sshpass wget
3467 3467
     apt-get -y install avahi-daemon avahi-utils avahi-discover
3468
+    apt-get -y install connect-proxy
3468 3469
 
3469 3470
     if [ ! -d $INSTALL_DIR ]; then
3470 3471
         mkdir -p $INSTALL_DIR
@@ -3473,6 +3474,20 @@ function initial_setup {
3473 3474
     echo 'initial_setup' >> $COMPLETION_FILE
3474 3475
 }
3475 3476
 
3477
+function allow_ssh_to_onion_address {
3478
+    if [ ! -d /home/$MY_USERNAME/.ssh ]; then
3479
+        mkdir /home/$MY_USERNAME/.ssh
3480
+    fi
3481
+    if [ ! -d /etc/tor ]; then
3482
+        echo $'Tor not found when updating ssh'
3483
+        exit 528257
3484
+    fi
3485
+    if ! grep -q "onion" /home/$MY_USERNAME/.ssh/config; then
3486
+        echo 'Host *.onion' >> /home/$MY_USERNAME/.ssh/config
3487
+        echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /home/$MY_USERNAME/.ssh/config
3488
+    fi
3489
+}
3490
+
3476 3491
 function install_tor {
3477 3492
     if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
3478 3493
         return
@@ -9795,6 +9810,7 @@ configure_internet_protocol
9795 9810
 create_git_project
9796 9811
 configure_ssh
9797 9812
 configure_ssh_onion
9813
+allow_ssh_to_onion_address
9798 9814
 remove_instructions_from_motd
9799 9815
 check_hwrng
9800 9816
 search_for_attached_usb_drive