2024-06-03
Route Network Interface To Specific Application

It is not advised to do so with dual WiFi connections, which is a pain in the ass in daily usage (only one of them will be used at a time).

Ethernet and WiFi dual connections seem fine with firejail but failed with dante.


Use firejail

1
2
sudo firejail --net=wlan0 --ip=dhcp --noprofile <program cmd>


Use dante and proxychains-ng

1
2
sudo apt install dante-server proxychains-ng

Now edit the dante config file at /etc/dante.conf:

1
2
3
4
5
6
7
8
9
10
11
12
13
internal: eth0 port = 1080
external: wlan0
socksmethod: username
user.privileged: root
user.unprivileged: nobody
user.libwrap: nobody
client pass {
from: 0/0 to: 0/0
}
socks pass {
from: 0/0 to: 0/0
}

Run the daemon by:

1
2
danted

Find the [ProxyList] section and add the following line in /etc/proxychains.conf:

1
2
socks5 127.0.0.1 1080 root <root_password>

Run the program with proxychains-ng:

1
2
proxychains <program cmd>

You can test your configuration like:

1
2
curl -x socks5://root:root@127.0.0.1:1080 https://www.baidu.com

If you run danted like systemctl start danted, you can configure a separate user for authentication. You have to change /etc/danted.conf and /etc/proxychains.conf accordingly.

1
2
3
sudo useradd -r -s /bin/false your_dante_user
sudo passwd your_dante_user

Read More

2022-12-05
Raspberry Pi Tweaks

openai says i should edit /etc/wpa_supplicant/wpa_supplicant.conf like this to connect to 5G wifi:

1
2
3
4
5
6
network={
ssid="<SSID>"
psk="<password>"
frequency=5180
}

also set frequency of wifi card like this:

1
2
3
sudo ifdown wlan0 && sudo ifup wlan0
sudo iw dev wlan0 set freq 5180

unplug ethernet, then we are golden.

1
2
traceroute baidu.com

how to check avaliable wifi ssids without network-manager:

1
2
sudo iwlist wlan0 scan | grep ESSID

default login (maybe not):

1
2
3
username: pi
password: raspberry

in order to start sshd, touch ssh under boot partition

recover dhcpcd service:

1
2
3
sudo systemctl enable dhcpcd.service
sudo systemctl restart dhcpcd.service

config the password with proot -S <path_to_rootfs> -b <boot_partition>:/boot -q qemu-arm /usr/bin/bash and passwd

you’ve installed raspap on this device. you use the default credentials. this shit will not connect to our wifi automatically, thus block your way of running docker containers on it with only macbook.

seriously? do you really need docker on macos? or just on raspberry pi?

change apt sources:

1
2
3
4
5
sudo sed -i 's|raspbian.raspberrypi.org|mirrors.ustc.edu.cn/raspbian|g' /etc/apt/sources.list
sudo sed -i 's|mirrordirector.raspbian.org|mirrors.ustc.edu.cn/raspbian|g' /etc/apt/sources.list
sudo sed -i 's|archive.raspbian.org|mirrors.ustc.edu.cn/raspbian|g' /etc/apt/sources.list
sudo sed -i 's|archive.raspberrypi.org/debian|mirrors.ustc.edu.cn/archive.raspberrypi.org/debian|g' /etc/apt/sources.list.d/raspi.list

using nmcli to scan and connect wifi

1
2
3
sudo nmcli dev wifi rescan
sudo nmcli dev wifi connect <SSID> password <PASSWORD>

sharing network:

1
2
ssh -R 1080 pi@10.42.0.33

edit /etc/network/interfaces:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.42.0.33
netmask 255.255.255.0
gateway 10.42.0.1
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wpa-ssid "<SSID>"
wpa-psk "<PASSWORD>"

install packages:

1
2
3
sudo apt-get -o Acquire::http::proxy="socks5h://127.0.0.1:1080/"  -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update --allow-releaseinfo-change
sudo apt-get -o Acquire::http::proxy="socks5h://127.0.0.1:1080/" -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false upgrade -y

Read More