Don't overwrite client ssh config #68

This commit is contained in:
Bob Mottram 2017-03-07 18:27:53 +00:00
parent f0fb62eaeb
commit 283782bf72
1 changed files with 23 additions and 14 deletions

View File

@ -162,25 +162,34 @@ function configure_ssh_client {
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
fi
echo 'Host *.onion' > ~/.ssh/config
echo ' ServerAliveInterval 60' >> ~/.ssh/config
echo ' ServerAliveCountMax 3' >> ~/.ssh/config
if [ ! -f ~/.ssh/config ]; then
touch ~/.ssh/config
fi
proxycmd="connect -R remote -5 -S 127.0.0.1:9050 %h %p"
if [ -f /usr/bin/pacman ]; then
proxycmd="/usr/bin/nc -X 5 -x 127.0.0.1:9050 %h %p"
fi
if ! grep -q "# ${PROJECT_NAME} settings" ~/.ssh/config; then
if ! grep -q "Host *.onion" ~/.ssh/config; then
echo "# ${PROJECT_NAME} settings start" >> ~/.ssh/config
echo 'Host *.onion' >> ~/.ssh/config
echo ' ServerAliveInterval 60' >> ~/.ssh/config
echo ' ServerAliveCountMax 3' >> ~/.ssh/config
if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then
echo " ProxyCommand sh -c 'monkeysphere ssh-proxycommand --no-connect %h %p ; $proxycmd'" >> ~/.ssh/config
else
echo " ProxyCommand $proxycmd" >> ~/.ssh/config
fi
echo 'Host *' >> ~/.ssh/config
echo ' ServerAliveInterval 60' >> ~/.ssh/config
echo ' ServerAliveCountMax 3' >> ~/.ssh/config
if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then
echo ' ProxyCommand monkeysphere ssh-proxycommand %h %p' >> ~/.ssh/config
if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then
echo " ProxyCommand sh -c 'monkeysphere ssh-proxycommand --no-connect %h %p ; $proxycmd'" >> ~/.ssh/config
else
echo " ProxyCommand $proxycmd" >> ~/.ssh/config
fi
echo 'Host *' >> ~/.ssh/config
echo ' ServerAliveInterval 60' >> ~/.ssh/config
echo ' ServerAliveCountMax 3' >> ~/.ssh/config
if [[ $ENABLE_MONKEYSPHERE == $'yes' || $ENABLE_MONKEYSPHERE == $'y' ]]; then
echo ' ProxyCommand monkeysphere ssh-proxycommand %h %p' >> ~/.ssh/config
fi
echo "# ${PROJECT_NAME} settings end" >> ~/.ssh/config
fi
fi
echo ''