Handle client installs of zeronet

This commit is contained in:
Bob Mottram 2015-08-29 17:48:43 +01:00
parent 7b0b60bd72
commit 2d7007c191
3 changed files with 46 additions and 8 deletions

View File

@ -48,6 +48,7 @@ SSH_KEX="curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256"
SSH_HOST_KEY_ALGORITHMS="ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-ed25519,ssh-rsa"
ZERONET_PORT=15441
TRACKER_PORT=51413
# see https://stribika.github.io/2015/01/04/secure-secure-shell.html
function ssh_remove_small_moduli {
@ -143,7 +144,7 @@ function mesh_babel {
echo ' return' >> $babel_script
echo ' fi' >> $batman_script
echo ' # install avahi' >> $babel_script
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd' >> $babel_script
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd transmission-daemon' >> $babel_script
echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
echo ' sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
echo ' if [ -f /bin/systemctl ]; then' >> $babel_script
@ -228,7 +229,7 @@ function mesh_batman {
echo '' >> $batman_script
echo 'if [[ $1 == "start" ]]; then' >> $batman_script
echo ' # install avahi' >> $batman_script
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd' >> $batman_script
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd transmission-daemon' >> $batman_script
echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
echo ' sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
echo ' sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
@ -339,6 +340,7 @@ function mesh_batman {
echo ' iptables -A INPUT -p udp --dport 5354 -j ACCEPT' >> $batman_script
echo " iptables -A INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $batman_script
echo " iptables -A INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $batman_script
echo " iptables -A INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $batman_script
echo '' >> $batman_script
echo ' if [ -f /bin/systemctl ]; then' >> $batman_script
echo ' systemctl restart avahi-daemon' >> $batman_script
@ -379,6 +381,7 @@ function mesh_batman {
echo ' iptables -D INPUT -p udp --dport 5354 -j ACCEPT' >> $batman_script
echo " iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $batman_script
echo " iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $batman_script
echo " iptables -D INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $batman_script
echo '' >> $batman_script
echo ' if [ -f /bin/systemctl ]; then' >> $batman_script
echo ' systemctl restart network-manager' >> $batman_script

View File

@ -46,6 +46,23 @@ TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
# the freedombone-client script installed
SERVER_INSTALLATION="no"
ZERONET_REPO='https://github.com/bashrc/ZeroNet'
ZERONET_DIR=~/zeronet
ZERONET_URL=http://127.0.0.1:43110
function install_zeronet {
sudo apt-get -y install python python-msgpack python-gevent
sudo apt-get -y install python-pip transmission-daemon
sudo pip install msgpack-python --upgrade
git clone $ZERONET_REPO $ZERONET_DIR
if [ ! -d $ZERONET_DIR ]; then
exit 56823
fi
cd $ZERONET_DIR
git checkout bashrc/bootstrap-file
}
function install_toxcore {
if [ -f /etc/tox-bootstrapd.conf ]; then
return
@ -237,6 +254,7 @@ if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /tmp/meshtype ]; then
install_toxcore
install_toxid
install_zeronet
sudo batman start
if [ ! "$?" = "0" ]; then
exit 2
@ -341,9 +359,10 @@ fi
echo ''
echo 'Choose communication service:'
echo ' 1. VoIP'
echo ' 2. Tox Chat'
echo ' 3. IRC (WARNING: not secure)'
echo ' 1. Web'
echo ' 2. VoIP'
echo ' 3. Tox Chat'
echo ' 4. IRC (WARNING: not secure)'
echo ''
read peer_index
@ -356,6 +375,18 @@ if [ ! $peer_index ]; then
fi
if [[ $peer_index == 1 ]]; then
cd ZERONET_DIR
zeronetavahi
python zeronet.py &
if which xdg-open > /dev/null; then
xdg-open $ZERONET_URL
elif which gnome-open > /dev/null; then
gnome-open $ZERONET_URL
fi
exit 0
fi
if [[ $peer_index == 2 ]]; then
if [ -f $MUMBLE_PATH ]; then
echo ''
echo 'To setup for the first time click "Add New", then set:'
@ -373,7 +404,7 @@ if [[ $peer_index == 1 ]]; then
exit 5
fi
else
if [[ $peer_index == 2 ]]; then
if [[ $peer_index == 3 ]]; then
run_tox
else
if [ -f $IRSSI_PATH ]; then

View File

@ -32,8 +32,12 @@ TRACKER_PORT=51413
BOOTSTRAP_FILE=/opt/zeronet/bootstrap
if [ ! -d /opt/zeronet ]; then
if [ -d ~/zeronet ]; then
BOOTSTRAP_FILE=~/zeronet/bootstrap
else
exit 0
fi
fi
if [ ! -d /etc/avahi ]; then
exit 0
@ -70,6 +74,6 @@ done < "$TEMPFILE"
rm -f $TEMPFILE
cp -f $BOOTSTRAP_FILE.new $BOOTSTRAP_FILE
rm -f $BOOTSTRAP_FILE.new
sudo chown zeronet:zeronet /opt/zeronet/bootstrap
sudo chown zeronet:zeronet $BOOTSTRAP_FILE
exit 0