# DIY - Setting up the KaosCube 1. [Hardware](#hardware) * [Components](#components) * [Installing the OS](#installing-the-os) 2. [Software](#software) * [Upgrade the OS](#upgrade-the-os) * [Setting up the Access Point](#setting-up-the-access-point) * [Installing firmware of the wifi dongle](#installing-firmware-of-the-wifi-dongle) * [Create network connection with new wifi dongle](#create-network-connection-with-new-wifi-dongle) * [Installing the KaosCube Interface](#installing-the-kaoscube-interface) 3. [Setting up functions of the KCInterface manually](#setting-up-functions-of-the-kcinterface-manually) * [Setting up the Hidden Service](#setting-up-the-hidden-service) 4. [Features](#features) * [Installing 12d1:1f01 Huawei E353/E3131 LTE Usb Modem](#installing-12d1\:1f01-huawei-e353\/e3131-lte-usb-modem) # 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. The image provided has it. And it gives an Access Point already configured. On the newest Bullseye Security, one of the securest in the internet. Git clone the repository to get the image if you like, or go on with bullseye instead in the same manner as described. And, more importantly, as of my writing, the xradio does not work with Bullseye and Bookworm. But that is writing of a year ago. First untar and extract from downloaded archive from my git server. with tar -xzvf kaosimage.tar.gz Now comes partitioning. Be careful. Look up the partitions, with lsblk Have a look that the microsd of minimum 30GB is not mounted, and start copying to the root of the microsd. Now copy binarywise the image to the device, not a partition if there is one: 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. Thats it! The free system should be installed. Put the MicroSD into your OrangePi. Now connect the micro usb cable. The Orange Pi will boot by supplying it with power. Here comes the part, how to connect over ethernet to other computers. The image provided just gives you a wpa2 encrypted interface and Access Point. But as all the images have the same default password, it is not secure for first setup of keys. Keys that will be placed on your client and on your new own autonomous server. If you are sure to be in a cage of aluminium or other, you can also make your first connection over the Wifi of the Kaoscube. Your first relaxed connection over an Access Point - an Access Point the Kaoscube.image will generate when put on power. The SSID, the Password or the Access Point and the first user + its password will be published soon. Until then write me a private message or mail. Now it goes on with the setup for base armbian systems from your source of trust, but the taking the old bullseye release, because it has ssh over ethernet enabled by default. For 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 it was Arch and dhcpd sudo pacman -S dhcpd Now we have to create a new local network. The easiest way is to go into your graphical network-manager. Select the ethernet connection to your Pi and go on settings. In my case I went to IPv4 settings. Then I selected "Shared to other computers" Method. After this add a new Address: Address 10.0.0.1 # The 10.0.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.0.0.0 Gateway 10.0.0.1 # The Gateway is the adress of your laptop # itself Now you can run the command sudo arp -a in your bash, 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 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 ## 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 "98475637998946115486" ifname wlan0 ## 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 Remember cloning 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.