Update docs/tech_docs/OpenWrt.md
This commit is contained in:
@@ -104,11 +104,7 @@ After updating the configuration files:
|
|||||||
/etc/init.d/firewall restart
|
/etc/init.d/firewall restart
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Installing Packages via CLI and Reboot
|
||||||
### Installing Packages via CLI
|
|
||||||
|
|
||||||
1. **Update the Package List**: Before installing any new packages, it's a good practice to update the list of packages to ensure you are installing the latest versions available. You can do this by running:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
opkg update
|
opkg update
|
||||||
```
|
```
|
||||||
@@ -118,7 +114,7 @@ opkg install qemu-ga
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poweroff
|
reboot
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -129,59 +125,22 @@ pct create 100 /var/lib/vz/template/cache/openwrt-rootfs.tar.xz --unprivileged 1
|
|||||||
```
|
```
|
||||||
Kali Linux Container (ID: 200):
|
Kali Linux Container (ID: 200):
|
||||||
```bash
|
```bash
|
||||||
pct create 200 /var/lib/vz/template/cache/kali-default-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype debian --hostname kali-0 --tag tools --storage local-lvm --cores 2 --memory 1024 --swap 512 --rootfs local-lvm:1,size=8G --net0 name=eth0,bridge=vmbr1,firewall=1
|
pct create 200 /var/lib/vz/template/cache/kali-default-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype debian --hostname kali-0 --password changeme --tag tools --storage local-lvm --cores 2 --memory 1024 --swap 512 --rootfs local-lvm:1,size=8G --net0 name=eth0,bridge=vmbr0,firewall=1
|
||||||
```
|
```
|
||||||
Alpine Container (ID: 300):
|
Alpine Container (ID: 300):
|
||||||
```bash
|
```bash
|
||||||
pct create 300 /var/lib/vz/template/cache/alpine-default-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype alpine --hostname alpine-0 --tag docker --storage local-lvm --cores 2 --memory 1024 --swap 256 --rootfs local-lvm:1,size=8G --net0 name=eth0,bridge=vmbr1,firewall=1
|
pct create 300 /var/lib/vz/template/cache/alpine-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype alpine --hostname alpine-0 --password changeme --tag docker --storage local-lvm --cores 2 --memory 1024 --swap 256 --rootfs local-lvm:1,size=8G --net0 name=eth0,bridge=vmbr0,firewall=1
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pct enter 300
|
pct enter 300
|
||||||
```
|
```
|
||||||
|
or
|
||||||
```bash
|
|
||||||
passwd
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pct console 300
|
pct console 300
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
|
||||||
sed -i '/^#.*community/s/^#//' /etc/apk/repositories
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apk update && apk upgrade
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
reboot
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
setup-interfaces
|
|
||||||
```
|
|
||||||
Choose the appropriate network interface and configure it with DHCP or a static IP as required. Then:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
service networking restart
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apk add bash curl wget vim htop qemu-guest-agent
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
passwd
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apk update && apk upgrade
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat /etc/apk/repositories
|
cat /etc/apk/repositories
|
||||||
```
|
```
|
||||||
@@ -190,18 +149,12 @@ cat /etc/apk/repositories
|
|||||||
sed -i '/^#.*community/s/^#//' /etc/apk/repositories
|
sed -i '/^#.*community/s/^#//' /etc/apk/repositories
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
vim /etc/apk/repositories
|
apk update && apk upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
Uncomment the line for the community repository, then save and exit.
|
|
||||||
|
|
||||||
3. Install the required packages:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
apk add qemu-guest-agent htop docker curl wget iperf3 sudo
|
apk add qemu-guest-agent newt curl openssh mc sudo
|
||||||
```
|
```
|
||||||
|
|
||||||
# Build Tools
|
# Build Tools
|
||||||
@@ -209,72 +162,74 @@ apk add qemu-guest-agent htop docker curl wget iperf3 sudo
|
|||||||
apk add build-base gcc abuild binutils binutils-doc gcc-doc
|
apk add build-base gcc abuild binutils binutils-doc gcc-doc
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Create a system user and add them to the docker group and sudoers:
|
## Network setup
|
||||||
```
|
|
||||||
adduser -s /bin/ash medusa
|
|
||||||
addgroup medusa docker
|
|
||||||
visudo
|
|
||||||
```
|
|
||||||
Add the following line to the sudoers file:
|
|
||||||
```
|
|
||||||
medusa ALL=(ALL) ALL
|
|
||||||
```
|
|
||||||
Save and exit.
|
|
||||||
|
|
||||||
5. Start and enable the Docker service:
|
```bash
|
||||||
```
|
setup-interfaces
|
||||||
rc-update add docker default
|
```
|
||||||
service docker start
|
|
||||||
```
|
```bash
|
||||||
|
service networking restart
|
||||||
|
```
|
||||||
|
|
||||||
6. Install and configure SSH:
|
6. Install and configure SSH:
|
||||||
```
|
|
||||||
apk add openssh
|
|
||||||
rc-update add sshd
|
|
||||||
service sshd start
|
|
||||||
vim /etc/ssh/sshd_config
|
|
||||||
```
|
|
||||||
Uncomment and modify the following lines:
|
|
||||||
```
|
|
||||||
PermitRootLogin no
|
|
||||||
PasswordAuthentication yes
|
|
||||||
```
|
|
||||||
Save and exit.
|
|
||||||
|
|
||||||
7. Restart the SSH service:
|
|
||||||
```
|
|
||||||
service sshd restart
|
|
||||||
```
|
|
||||||
|
|
||||||
8. Log in as the newly created user:
|
|
||||||
```
|
|
||||||
su - medusa
|
|
||||||
```
|
|
||||||
|
|
||||||
9. Test Docker functionality:
|
|
||||||
```
|
|
||||||
docker run hello-world
|
|
||||||
```
|
|
||||||
|
|
||||||
10. Test sudo privileges:
|
|
||||||
```
|
|
||||||
sudo apk update
|
|
||||||
```
|
|
||||||
|
|
||||||
11. Connect to the system via SSH:
|
|
||||||
```
|
|
||||||
ssh medusa@<server-ip>
|
|
||||||
```
|
|
||||||
---
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ip ad
|
apk add openssh
|
||||||
setup-interfaces
|
|
||||||
ping 1.1.1.1
|
|
||||||
traceroute 1.1.1.1
|
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
rc-update add sshd
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
service sshd start
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
vi /etc/ssh/sshd_config
|
||||||
|
```
|
||||||
|
Uncomment and modify the following lines:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PermitRootLogin no
|
||||||
|
PasswordAuthentication yes
|
||||||
|
```
|
||||||
|
Save and exit
|
||||||
|
|
||||||
|
```bash
|
||||||
|
service sshd restart
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Create a system user and add them to the docker group and sudoers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adduser -s /bin/ash medusa
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
addgroup medusa docker
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
visudo
|
||||||
|
```
|
||||||
|
|
||||||
|
Add the following line to the sudoers file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
medusa ALL=(ALL) ALL
|
||||||
|
```
|
||||||
|
|
||||||
|
Save and exit.
|
||||||
|
|
||||||
|
5. Start and enable the Docker service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rc-update add docker default
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
service docker start
|
service docker start
|
||||||
rc-update add cgroups
|
```
|
||||||
history
|
|
||||||
|
```bash
|
||||||
|
docker run hello-world
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user