the interface of the KaosCube
Find a file
2025-01-17 12:00:01 +00:00
css php syntax change to need no libs, graffiti changed 2023-01-09 22:10:53 +00:00
images php syntax change to need no libs, graffiti changed 2023-01-09 22:10:53 +00:00
changeKCPW.php php syntax change to need no libs, graffiti changed 2023-01-09 22:10:53 +00:00
changeKCPW.sh first commit 2022-12-20 14:30:30 +01:00
changeKCPWaction.php first commit 2022-12-20 14:30:30 +01:00
connect2Network.php first commit 2022-12-20 14:30:30 +01:00
connections.csv changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
createNode.php changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
devices.csv changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
freedom.php changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
hshostname.txt changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
index.php php syntax change to need no libs, graffiti changed 2023-01-09 22:10:53 +00:00
info.php changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
info.php_old first commit 2022-12-20 14:30:30 +01:00
initTorAndHS.php changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
locale.yaml changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
onion.php updated html from with right php program names 2023-01-13 17:32:28 +00:00
README.md updated the README.md with newest stuff info 2025-01-17 12:00:01 +00:00
Spyc.php first commit 2022-12-20 14:30:30 +01:00
ssids.csv changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
startserver.sh first commit 2022-12-20 14:30:30 +01:00
submittedNewEntry.php first commit 2022-12-20 14:30:30 +01:00
switchFromBridge2Node.php changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
switchFromNode2Bridge.php changed the hs to node to bridge routine 2023-01-13 17:18:05 +00:00
torrc added sed command to replace things in configs 2023-01-09 23:20:24 +00:00
torState.csv first commit 2022-12-20 14:30:30 +01:00
updateInfo.php first commit 2022-12-20 14:30:30 +01:00

DIY - Setting up the KaosCube

  1. General
  2. Hardware
  1. Software
  1. Setting up functions of the KCInterface manually
  1. Features

General

This is a tutorial, how to set up the kaoscube with its kc-interface - work in progress..

An important Disclaimer: The kc-interface is not ready yet. I want to give you examples:

  1. When you connect through it to another wifi, to make a repeater out of it, you cannot use ? in the password. I got aware of this problem today, and its not highest on my list of priorities. Use a password for your wifi, that you want to repeat, out of numbers, letters and some !! instead.
  2. It might not work at all to start a connection by one click, because the interface name changes. Here I can only say to have a look at the code of the interface. It is very, very easy and short.

I will build and I am building all the features over time, such that you can actually create your hidden service from oneclick. Until now, just follow the tutorial here, a bit more down you can find "setting up the hidden service".

The kc-interface is mainly meant to teach you how to write interfaces that last, without having work or breaking updates. And that you can write interfaces with few lines of code, and not with millions like most javascript stuff nowadays.

How many dependencies does the interface need? Aside of its php code, NONE. Ok I use tor - but that would be updated with apt update && apt upgrade. And thats also it.

That said, have fun with building your digital autonomy - and do not hesitate to ask me stuff (after having tried a little) about open source, security and stability of software (contact@cannabinieri.de)

Hardware

Components

  • Orange Pi Zero
  • MiniUsb2Usb Cable for power-supply
  • An Ethernet !Crossover! Cable for ssh access
  • An MicroSD 30 GB for the Installation of the OS
  • MicroSD2Usb Reader to plug in the Laptop
  • Linux Wifi Dongle
  • Wifi Antenna
  • A laptop, preferably with Linux installed

Installing the OS

Because Ubuntu is half proprietary, and there is a surveillance door for Amazon on the system, the KAOS Cube runs on ARMbian - Debian based.

You could get a debian buster image from https://www.armbian.com/download/ for the orange pi zero, as sshd is still running by default on the resulting machine, for connecting. But all that images, if bullseye or buster, wont have a working ap enabling on board antenna driver. I also tried with openwrt, but that one did not even recognize the antenna.

The image provided has these working drivers. And it gives an Access Point already configured. On a regularily updated Debian Bullseye, soon a Debian Bookworm.

Or go on with an Armbian image from your source of trust instead. Be aware that you wont have an access point over the on board antenna. And be aware, that the sshd daemon is not running by default on the newest Armbian images (Bullseye and Bookworm)

And, more importantly, as of my writing (2025), the xradio does not work with Bullseye and Bookworm.

Download the Kaoscube image under https://code.basabuuka.org/alpcentaur/kaoscube_image/kaoscube.img.tar.gz

Then untar the archive with

tar -xzvf kaoscube.img.tar.gz

Now comes partitioning. Be careful.

Now insert a MicroSD card into your UNIX computer.

Look up the partitions, with

lsblk

Have a look that the microsd of minimum 30GB is not mounted, and

the copying then has to go to the root of the microsd.

To copy the image to the MicroSD, use the following command ( assuming /dev/mmlp is your MicroSD)

sudo dd bs=4M if=kaosimage.img of=/dev/mmlp

If your MicroSD Card has /dev/mmlp1 and /dev/mmlp2, do not copy to them, but copy to the whole device /dev/mmlp (the root)

Thats it! The free system should be installed. Put the MicroSD into your OrangePi.

Now connect the micro usb cable, and be careful to have the right Voltage and Ampere as specified on the internet. The Orange Pi will boot by supplying it with power. A green light should start.

After less than a minute of waiting, you should see a new Wifi Accesspoint, called "Kaoscube".

Connect to it with the Password "PanoptikumOiOi666".

Now have a look on your UNIX Laptop which is connected to the Kaoscube.

In the terminal, type in

ip a

In the output, you should see your interfaces. Take the interface, which stands for your internet connection. It should have an IP resembling 10.42.0.x.

The Kaoscube (AP) has the IP 10.42.0.1.

Which means, that you can ssh on the Kaoscube now. Issue

ssh kaosuser@10.42.0.1

Type in the Password "t@uQ;a.e33iamY21!k" without the quotes.

Now you should be on the kaoscube as the kaosuser. The kaosuser is in the sudo group. Which means, the first thing you should do, is to change the root password. You can do that by issuing

sudo passwd root

Type in the Password without the quotes, and then type in the root password you want.

Now you chosen the root password, which means you are officially the new owner of your kaoscube!

The next thing you should do, is to change your directory and open the file

/etc/ssh/sshd_config

with root privilege ( by typing sudo for example )

Study the configuration parameters, and configure everything safe! You should not use Passwords to login, you should use private and public key authentication. But there are really a lot of good tutorials showing you how to do this.

What I have done more or less - giving you extra questions

Understanding means to understand what you do not understand. That is why from now, comes a loose documentation of what I have done years ago. Not everything might be accurate, and theoretically every step can be understood by printing out stuff from the kaoscube.. without even reading through.

Now it goes on with the setup for base armbian systems from your source of trust, but taking the old bullseye release, because it has ssh over ethernet enabled by default.

Connect your computer with ethernet (crossover, special one) cable to the orange pi zero. The first boot takes a bit longer, up to 2 minutes.

Make sure, that not only the lights of the ethernet port on the orange pi zero have the lights on. But there is another small green light on the side of the micro usb power plug. This one has to be on. Sometimes, especially with the buster image, the startup does not work properly, and you will not see a connection on your Laptop, because the os did not start at all. Just replug the power if that is the case (no light on).

On the Armbian System, SSH on ethernet is enabled. We need to give the Pi an IP Adress now.

# Install a dhcp server, in my case I was on an Arch Linux and I used dhcpd
sudo pacman -S dhcpd

Now we have to create a new local network. I did that by going into my graphical network-manager. Select the ethernet connection to your Pi and go on settings.

I went to IPv4 settings. Then I selected "Shared to other computers" Method. After this add a new Address:

Address 10.42.0.1	# The 10.42.0.1 Number is normally used for local 
			# networks.
Netmask 24		# You can also put in 255.255.255.0, which only 
			# says to the dhcp to give a certain range of 
			# adresses starting at 10.42.0.0 until 10.42.0.254
Gateway 10.42.0.1	# The Gateway is the adress of your laptop 
			# itself

Now you can run the command sudo arp -a

in your terminal, after restarting the connection over ethernet to your Pi.

On your Orange Pi, the small green Light close to the mini usb port should be lighting. If the connection is established, you should see it blinking. If one or both are not the case, try to reinstall the ARMbian image, or zero the first part of the partition, maybe it was not booting

You will see an assigned IP Adress on your ethernet interface, on arch for me it was the standard one enp0s25

To get the interfaces with their information on UNIX Systems like most Linux and BSDs you can issue

ip a

The IP was 10.0.0.254, so I could connect through ssh with my Orange Pi now, and start to set up the system.

ssh root@10.0.0.254

If everything worked, type in 1234 as the password and follow the instructions.

If not, check out https://docs.armbian.com/User-Guide_Getting-Started/#how-to-prepare-a-sd-card

For example, you can learn there how to verify the hash of your download, to be sure nobody gave you a virus instead of an OS :)

Software

Upgrade the OS

In the newer versions of armbian, ssh is deactivated by default. To save time, we could have installed an armbian buster. Generally, it is important to keep your KaosCube up to date. That is why, after getting access to the Cube, the first thing would have been an upgrade to bullseye (which is debian stable at the time of this writing and has the latest debian-security updates inside)

With the kaosimage you dont have to do a system upgrade, but the updates are always important. To give you a Trick for updating servers, try to use only

sudo apt update

sudo apt upgrade

During the upgrade, always choose ok or default :).

When something appears broken, which will be the case if you have a lot of servers, it will be one of the updates.

That is why, we first check that. In case there is a break, we can have a rollback to before the update. Based on the cache of the package manager.

If everything went well on the other side, which will be the case if updates are made fast and rolled back directly if broken, then you can just go on to cleaning and auto cleaning the system and you are fresh to go.

Setting up the Access Point (if you want to, because in the end the provided image has one configured, and one can copy paste that too. but one can extend too.)

On buster, the access point can be set up persistently with the commands:

nmcli con add type wifi ifname wlan0 mode ap con-name kaoscube ssid KaosCube ipv4.method shared
nmcli con modify kaoscube wifi-sec.key-mgmt wpa-psk
nmcli con modify kaoscube wifi-sec.psk "ThePasswordYouLike"
nmcli con up kaoscube

Installing firmware of the wifi dongle

First thing to do is updating the apt ressources

sudo apt update

Then install git

sudo apt install git

Install dkms

sudo apt install dkms

Install the newest headers

sudo apt-get install linux-headers-current-sunxi build-essential

When installing build-essential, you will be prompted whether to restart or not. Enter no automatic restart and then for cron and ssh enter ok. For the ssh config, I kept the old one. after the install, restart the system with

sudo reboot

Now download the firmware

git clone https://github.com/kelebek333/rtl8188fu

Now go to the folder rtl8188fu. Add, build and install it with dkms

sudo dkms add ./rtl8188fu
sudo dkms build rtl8188fu/1.0
sudo dkms install rtl8188fu/1.0
sudo cp ./rtl8188fu/firmware/rtl8188fufw.bin /lib/firmware/rtlwifi/

After all commands have run successfully, restart the system

sudo reboot

Within the Kaoscube image, I changed this a bit. Instead of using the kelebek333 lib, I used another one, which has a script. also it seemed, that he keeps it more updated, but I have to check this anothertime.

In any case, upgrading the firmware inside the kernel would be

git pull 
sudo dkms add ./rtl8188fu
sudo dkms build rtl8188fu/1.0
sudo dkms install rtl8188fu/1.0
sudo cp ./rtl8188fu/firmware/rtl8188fufw.bin /lib/firmware/rtlwifi/

whereas on the kaoscube, where I used one with the small script, its enough to do

git pull
sudo sh install-driver.sh

When I installed, the maintainers notes where the following:

Note: Updates to this driver SHOULD be performed before distro
      upgrades such as Ubuntu 23.10 to 24.04.
Note: Updates can be performed as often as you like. It is
      recommended to update at least every 2 months.
Note: Work on this driver, like the Linux kernel, is continuous.

Enjoy!

Create network connection with new wifi dongle (not sure if thats already or still on the image)

First look up with ifconfig for the interfaces, and which one is the one of the dongle

sudo ifconfig

there should be one called wlan0 or wlan1, which is the small one already on the orange pi zero.

In addition, there should be one with the name wlx00... something.

This one you should use with the following command:

nmcli device wifi connect 'FRITZ!Box 6430 Cable TL' password "whateverpassword-your-internet-connection-has" ifname <whatever-interface-your-wifidongle-got,check-with-ipa-command>

Installing the KaosCube Interface

First add a new user, if you are still root:

adduser kaosuser

Then add the user to sudoers:

usermod -aG sudo kaosuser

Now change to user (still being root) and go to home directory

su kaosuser
cd

Clone the interface from git

git clone https://code.basabuuka.org/alpcentaur/kc-interface.git

After that, install php (working version is 7.4, but newer ones should also work)

sudo apt install php

Also the interface needs the following libraries:

sudo apt install tor

Now go in the directory kc-interface and run

bash startserver.sh

You will have the interface running on localhost:666

To get the interface, connect to the ap kaoscube and enter the IP of its wifi interface with a double point and then 666.

Setting up functions of the KCInterface manually

Setting up the Hidden Service

First install Tor:

sudo apt-get install tor

Edit the torrc file:

sudo nano /etc/tor/torrc

Look for the line ############### This section is just for location-hidden services ###

under this line, enable (uncomment) HiddenServiceDir and HiddenServicePort

in our case,

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
HiddenServicePort 22 127.0.0.1:22

After restarting tor with

sudo systemctl restart tor

your hidden service is running, and you can get its address under /var/lib/tor/hidden_service/ , or whatever name or path you wrote in the torrc.

Features

Installing 12d1:1f01 Huawei E353/E3131 LTE Usb Modem

First issue

lsusb

to check, if you are trying to install the right LTE usb dongle.

Being connected to the internet with your laptop, and having the shared internet connection being issued from your laptop, the kaoscube has internet too.

Then, install usb_modeswitch with the command

sudo apt install usb-modeswitch usb-modeswitch-data

and then switch to modem mode for the usb stick

sudo usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000a11062000000000000100000000000000'

After that, lsusb will show you that the usb modem is now recognized as a modem.

Now you can issue

ip a

and look for the new generated interface of the modem.

take it's IP address, in my case it was 192.168.8.100/24, and replace the last bit with a 1 (192.168.8.1). Put that IP address into the browser of your laptop.