parent
749b82a137
commit
258181055c
19
NOTICE
19
NOTICE
|
@ -21,3 +21,22 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
linux-router
|
||||||
|
Copyright (C) 2018 garywill
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
46
README.md
46
README.md
|
@ -89,25 +89,57 @@ In `torrc`
|
||||||
TransPort 0.0.0.0:9040
|
TransPort 0.0.0.0:9040
|
||||||
DNSPort 0.0.0.0:9053
|
DNSPort 0.0.0.0:9053
|
||||||
```
|
```
|
||||||
### Use with LXC
|
### Use for LXC
|
||||||
Create a bridge
|
Create a bridge
|
||||||
```
|
```
|
||||||
# brctl addbr lxcbr1
|
# brctl addbr lxcbr5
|
||||||
```
|
```
|
||||||
In LXC container `config`
|
In LXC container `config`
|
||||||
```
|
```
|
||||||
lxc.network.type = veth
|
lxc.network.type = veth
|
||||||
lxc.network.flags = up
|
lxc.network.flags = up
|
||||||
lxc.network.link = lxcbr1
|
lxc.network.link = lxcbr5
|
||||||
lxc.network.hwaddr = xx:xx:xx:xx:xx:xx
|
lxc.network.hwaddr = xx:xx:xx:xx:xx:xx
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
# lnxrouter -i lxcbr1
|
# lnxrouter -i lxcbr5
|
||||||
```
|
```
|
||||||
### Use with VirtualBox
|
|
||||||
On VirtualBox's global settings, create a host-only network `vboxnet1` with DHCP disabled.
|
### Use as transparent proxy for LXD
|
||||||
|
Create a bridge
|
||||||
```
|
```
|
||||||
# lnxrouter -i vboxnet1
|
# brctl addbr lxdbr5
|
||||||
|
```
|
||||||
|
Create and add LXD profile
|
||||||
|
```
|
||||||
|
$ lxc profile create profile5
|
||||||
|
$ lxc profile edit profile5
|
||||||
|
|
||||||
|
### profile content ###
|
||||||
|
config: {}
|
||||||
|
description: ""
|
||||||
|
devices:
|
||||||
|
eth0:
|
||||||
|
name: eth0
|
||||||
|
nictype: bridged
|
||||||
|
parent: lxdbr5
|
||||||
|
type: nic
|
||||||
|
name: profile5
|
||||||
|
|
||||||
|
$ lxc profile add <container> profile5
|
||||||
|
```
|
||||||
|
That should make one container have 2 profiles. `profile5` will override `eth0`.
|
||||||
|
```
|
||||||
|
# lnxrouter -i lxdbr5 --tp 9040 --dns-proxy 9053
|
||||||
|
```
|
||||||
|
To remove that new profile from container
|
||||||
|
```
|
||||||
|
$ lxc profile remove <container> profile5
|
||||||
|
```
|
||||||
|
### Use as transparent proxy for VirtualBox
|
||||||
|
On VirtualBox's global settings, create a host-only network `vboxnet5` with DHCP disabled.
|
||||||
|
```
|
||||||
|
# lnxrouter -i vboxnet5 --tp 9040 --dns-proxy 9053
|
||||||
```
|
```
|
||||||
### CLI usage and other features
|
### CLI usage and other features
|
||||||
|
|
||||||
|
|
16
lnxrouter
16
lnxrouter
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION=0.5.1
|
VERSION=0.5.2
|
||||||
PROGNAME="$(basename $0)"
|
PROGNAME="$(basename $0)"
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
@ -944,13 +944,13 @@ if [[ $SHARE_METHOD == 'none' ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d /dev/shm ]]; then
|
if [[ -d /dev/shm ]]; then
|
||||||
TMPDIR=/dev/shm
|
TMPD=/dev/shm
|
||||||
elif [[ -d /run/shm ]]; then
|
elif [[ -d /run/shm ]]; then
|
||||||
TMPDIR=/run/shm
|
TMPD=/run/shm
|
||||||
else
|
else
|
||||||
TMPDIR=/tmp
|
TMPD=/tmp
|
||||||
fi
|
fi
|
||||||
TMPDIR=$TMPDIR/lnxrouter_tmp
|
TMPDIR=$TMPD/lnxrouter_tmp
|
||||||
|
|
||||||
#======
|
#======
|
||||||
|
|
||||||
|
@ -1251,7 +1251,7 @@ wpa_pairwise=TKIP CCMP
|
||||||
rsn_pairwise=CCMP
|
rsn_pairwise=CCMP
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "Warning: Wifi is not protected by password" >&2
|
echo "WARN: Wifi is not protected by password" >&2
|
||||||
fi
|
fi
|
||||||
chmod 600 $CONFDIR/hostapd.conf
|
chmod 600 $CONFDIR/hostapd.conf
|
||||||
fi
|
fi
|
||||||
|
@ -1331,7 +1331,7 @@ elif [[ "$SHARE_METHOD" == "nat" ]]; then
|
||||||
elif [[ "$SHARE_METHOD" == "redsocks" ]]; then
|
elif [[ "$SHARE_METHOD" == "redsocks" ]]; then
|
||||||
if [[ "$dnsmasq_NO_DNS" -eq 0 ]]; then
|
if [[ "$dnsmasq_NO_DNS" -eq 0 ]]; then
|
||||||
echo
|
echo
|
||||||
echo "Warning: You are using transparent proxy but gateway is providing local DNS, this may cause privacy leak !!!"
|
echo "WARN: You are using transparent proxy but gateway is providing local DNS, this may cause privacy leak !!!" >&2
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
start_redsocks
|
start_redsocks
|
||||||
|
@ -1409,7 +1409,7 @@ fi
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
# need loop to keep this script running
|
# need loop to keep this script running
|
||||||
bash -c "while :; do sleep 3 ; done " &
|
bash -c "while :; do sleep 800 ; done " &
|
||||||
KEEP_RUNNING_PID=$!
|
KEEP_RUNNING_PID=$!
|
||||||
echo $KEEP_RUNNING_PID > $CONFDIR/keep_running.pid
|
echo $KEEP_RUNNING_PID > $CONFDIR/keep_running.pid
|
||||||
wait $KEEP_RUNNING_PID
|
wait $KEEP_RUNNING_PID
|
||||||
|
|
Loading…
Reference in New Issue