Browse Source

Enable ssh via onion

Bob Mottram 9 years ago
parent
commit
93fd202696
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      src/freedombone

+ 22
- 0
src/freedombone View File

@@ -3521,6 +3521,27 @@ function install_tor {
3521 3521
     apt-get -y install tor
3522 3522
 }
3523 3523
 
3524
+function enable_ssh_via_onion {
3525
+    if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
3526
+        return
3527
+    fi
3528
+    apt-get -y install tor connect-proxy
3529
+    if ! grep -q 'Host *.onion' /home/$MY_USERNAME/.ssh/config; then
3530
+        if [ ! -f /home/$MY_USERNAME/.ssh ]; then
3531
+            mkdir /home/$MY_USERNAME/.ssh
3532
+        fi
3533
+        echo 'Host *.onion' >> /home/$MY_USERNAME/.ssh/config
3534
+        echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /home/$MY_USERNAME/.ssh/config
3535
+    fi
3536
+    if ! grep -q 'Host *.onion' /root/.ssh/config; then
3537
+        if [ ! -f /root/.ssh ]; then
3538
+            mkdir /root/.ssh
3539
+        fi
3540
+        echo 'Host *.onion' >> /root/.ssh/config
3541
+        echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /root/.ssh/config
3542
+    fi
3543
+}
3544
+
3524 3545
 function install_editor {
3525 3546
     if grep -Fxq "install_editor" $COMPLETION_FILE; then
3526 3547
         return
@@ -9860,6 +9881,7 @@ enable_backports
9860 9881
 configure_dns
9861 9882
 initial_setup
9862 9883
 install_tor
9884
+enable_ssh_via_onion
9863 9885
 check_date
9864 9886
 install_dynamicdns
9865 9887
 randomize_cron