Changes between Version 8 and Version 9 of doc/TorBOX/Dev/ChangeRoot


Ignore:
Timestamp:
Jul 5, 2012, 3:58:25 PM (7 years ago)
Author:
proper
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • doc/TorBOX/Dev/ChangeRoot

    v8 v9  
    1717# Terminates chroot.
    1818#
     19# -tg-dns
     20# Sets up dns.
     21#
    1922# -tg-unmount
    2023# Unmounts the vm image.
     
    2326# -tw-chroot
    2427# -tw-unchroot
     28# NOT needed: -tw-dns
    2529# -tw-unmount
    2630"
     
    191195
    192196
     197# Note: Most code shared with TorBOX_Gateway script.
     198config_dns_tg() {
     199#trap not implemented yet.
     200#trap "cleanup" ERR INT TERM
     201echo "
     202######################################################
     203config_dns_tg
     204######################################################
     205"
     206
     207# Delete /etc/resolv.conf to work around some strange bug
     208# "Operation not supported While reading flags on" while
     209# trying to set -i on /etc/resolv.conf.
     210# Override trap function, if /etc/resolv.conf does not
     211# exist or is write protected (+i).
     212rm $CHROOT_FOLDER/etc/resolv.conf || true
     213
     214# Remove write protection from resolv.conf.
     215# Override trap function, if /etc/resolv.conf does not exist.
     216chattr -i $CHROOT_FOLDER/etc/resolv.conf || true
     217
     218# Delete file to keep care of potential leaks.
     219# Override trap function, if /etc/resolv.conf does not exist.
     220rm $CHROOT_FOLDER/etc/resolv.conf || true
     221
     222# Set nameserver to localhost.
     223# iptables redirects any of TorBOX-Gateways DNS requests to DNS_PORT_TG
     224# Do not override trap function, this step is essential.
     225echo "nameserver 127.0.0.1" > $CHROOT_FOLDER/etc/resolv.conf
     226
     227# Add write protection to resolv.conf to prevent DNS leaks by getting
     228# edited by DHCP.
     229# Do not override trap function, this step is essential.
     230chattr +i $CHROOT_FOLDER/etc/resolv.conf
     231}
     232
     233
    193234
    194235################################################################
     
    217258
    218259
     260
    219261################################################################
    220262# -tg-unchroot                                                 #
     
    225267   CHROOT_FOLDER=/home/"$USERNAME"/TorBOX_binary/"$VMNAME"_image
    226268   do_unchroot
     269   exit 0
     270fi
     271
     272
     273
     274################################################################
     275# -tg-dns                                                      #
     276################################################################
     277if [[ "$1" = "-tg-dns" ]]; then
     278   root_check
     279   VMNAME="TorBOX-Gateway"
     280   CHROOT_FOLDER=/home/"$USERNAME"/TorBOX_binary/"$VMNAME"_image
     281   config_dns_tg
    227282   exit 0
    228283fi