the interface of the KaosCube
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

352 lines
11 KiB

1 year ago
1 year ago
  1. # DIY - Setting up the KaosCube
  2. 1. [Hardware](#hardware)
  3. * [Components](#components)
  4. * [Installing the OS](#installing-the-os)
  5. 2. [Software](#software)
  6. * [Upgrade the OS](#upgrade-the-os)
  7. * [Setting up the Access Point](#setting-up-the-access-point)
  8. * [Installing firmware of the wifi dongle](#installing-firmware-of-the-wifi-dongle)
  9. * [Create network connection with new wifi dongle](#create-network-connection-with-new-wifi-dongle)
  10. * [Installing the KaosCube Interface](#installing-the-kaoscube-interface)
  11. 3. [Setting up functions of the KCInterface manually](#setting-up-functions-of-the-kcinterface-manually)
  12. * [Setting up the Hidden Service](#setting-up-the-hidden-service)
  13. 4. [Features](#features)
  14. * [Installing 12d1:1f01 Huawei E353/E3131 LTE Usb Modem](#installing-12d1\:1f01-huawei-e353\/e3131-lte-usb-modem)
  15. # Hardware
  16. ## Components
  17. + Orange Pi Zero
  18. + MiniUsb2Usb Cable for power-supply
  19. + An Ethernet !Crossover! Cable for ssh access
  20. + An MicroSD 30 GB for the Installation of the OS
  21. + MicroSD2Usb Reader to plug in the Laptop
  22. + Linux Wifi Dongle
  23. + Wifi Antenna
  24. + A laptop, preferably with Linux installed
  25. ## Installing the OS
  26. Because Ubuntu is half proprietary, and there is a surveillance door for
  27. Amazon on the system, the KAOS Cube runs on ARMbian - Debian based.
  28. You could get a debian buster image from https://www.armbian.com/download/ for the orange pi
  29. 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.
  30. The image provided has it.
  31. And it gives an Access Point already configured.
  32. On the newest Bullseye Security, one of the securest in the internet.
  33. Git clone the repository to get the image if you like, or go on with bullseye instead in the same manner as described.
  34. And, more importantly, as of my writing, the xradio does not work with Bullseye and Bookworm. But that is writing of a year ago.
  35. First untar and extract from downloaded archive from my git server.
  36. with
  37. tar -xzvf kaosimage.tar.gz
  38. Now comes partitioning.
  39. Be careful.
  40. Look up the partitions, with
  41. lsblk
  42. Have a look that the microsd of minimum 30GB is not mounted, and
  43. start copying to the root of the microsd.
  44. Now copy binarywise the image to the device, not a partition if there is one:
  45. sudo dd bs=4M if=kaosimage.img of=/dev/mmlp
  46. If your MicroSD Card has /dev/mmlp1 and /dev/mmlp2, do not copy to them, but copy to the whole device /dev/mmlp.
  47. Thats it! The free system should be installed. Put the MicroSD into your OrangePi.
  48. Now connect the cables. The Orange Pi will boot by supplying it with
  49. power.
  50. Here comes the part, how to connect over ethernet to other computers.
  51. The image provided just gives you a wpa2 encrypted interface, so not secure for first
  52. setup of keys on your client, and on your new own autonomous server.
  53. If you are sure to be in a cage of aluminium, you can also make your first connection. Your first relaxed connection over an Access Point - the Kaoscube.image will generate when put on power.
  54. For Connect your computer with ethernet (crossover, special one) cable to the orange pi zero.
  55. The first boot takes a bit longer, up to 2 minutes.
  56. Make sure, that not only the lights of the ethernet port on the orange pi zero have the lights on.
  57. But there is another small green light on the side of the micro usb power plug. This one has to be on.
  58. Sometimes, especially with the buster image, the startup does not work properly, and you will not see a
  59. connection on your Laptop, because the os did not start at all. Just replug the power if that is the case
  60. (no light on).
  61. On the Armbian System, SSH on ethernet is enabled. We need to give the
  62. Pi an IP Adress now.
  63. # Install a dhcp server, in my case it was Arch and dhcpd
  64. sudo pacman -S dhcpd
  65. Now we have to create a new local network.
  66. The easiest way is to go into your graphical network-manager. Select the
  67. ethernet connection to your Pi and go on settings.
  68. In my case I went to IPv4 settings. Then I selected "Shared to other
  69. computers" Method. After this add a new Address:
  70. Address 10.0.0.1 # The 10.0.0.1 Number is normally used for local
  71. # networks.
  72. Netmask 24 # You can also put in 255.255.255.0, which only
  73. # says to the dhcp to give a certain range of
  74. # adresses starting at 10.0.0.0
  75. Gateway 10.0.0.1 # The Gateway is the adress of your laptop
  76. # itself
  77. Now you can run the command
  78. sudo arp -a
  79. in your bash, after restarting the connection over ethernet to your Pi.
  80. On your Orange Pi, the small green Light close to the mini usb port
  81. should be lighting. If the connection is established, you should see it
  82. blinking. If one or both are not the case, try to reinstall the ARMbian
  83. image, or zero the first part of the partition, maybe it was not booting
  84. You will see an assigned IP Adress on your ethernet interface, on arch
  85. for me it was the standard one enp0s25
  86. The IP was 10.0.0.254, so I could connect through ssh with my Orange
  87. Pi now, and start to set up the system.
  88. ssh root@10.0.0.254
  89. If everything worked, type in 1234 as the password and follow the instructions.
  90. If not, check out
  91. https://docs.armbian.com/User-Guide_Getting-Started/#how-to-prepare-a-sd-card
  92. For example, you can learn there how to verify the hash of your download, to be sure nobody
  93. gave you a virus instead of an OS :)
  94. # Software
  95. ## Upgrade the OS
  96. In the newer versions of armbian, ssh is deactivated by default.
  97. To save time, we could have installed an armbian buster.
  98. Generally, it is important to keep your KaosCube up to date.
  99. That is why, after getting access to the Cube, the first thing would have been
  100. an upgrade to bullseye (which is debian stable at the time of this
  101. writing and has the latest debian-security updates inside)
  102. 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
  103. sudo apt update
  104. sudo apt upgrade
  105. During the upgrade, always choose ok or default :).
  106. When something appears broken, which will be the case if you have a lot of servers,
  107. it will be one of the updates.
  108. That is why, we first check that.
  109. In case there is a break, we can have a rollback to before the update.
  110. Based on the cache of the package manager.
  111. 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.
  112. ## 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.)
  113. On buster, the access point can be set up persistently with the commands:
  114. nmcli con add type wifi ifname wlan0 mode ap con-name kaoscube ssid KaosCube ipv4.method shared
  115. nmcli con modify kaoscube wifi-sec.key-mgmt wpa-psk
  116. nmcli con modify kaoscube wifi-sec.psk "ThePasswordYouLike"
  117. nmcli con up kaoscube
  118. ## Installing firmware of the wifi dongle
  119. First thing to do is updating the apt ressources
  120. sudo apt update
  121. Then install git
  122. sudo apt install git
  123. Install dkms
  124. sudo apt install dkms
  125. Install the newest headers
  126. sudo apt-get install linux-headers-current-sunxi build-essential
  127. When installing build-essential, you will be prompted whether to restart
  128. or not. Enter no automatic restart and then for cron and ssh enter ok.
  129. For the ssh config, I kept the old one.
  130. after the install, restart the system with
  131. sudo reboot
  132. Now download the firmware
  133. git clone https://github.com/kelebek333/rtl8188fu
  134. Now go to the folder rtl8188fu. Add, build and install it with dkms
  135. sudo dkms add ./rtl8188fu
  136. sudo dkms build rtl8188fu/1.0
  137. sudo dkms install rtl8188fu/1.0
  138. sudo cp ./rtl8188fu/firmware/rtl8188fufw.bin /lib/firmware/rtlwifi/
  139. After all commands have run successfully, restart the system
  140. sudo reboot
  141. ## Create network connection with new wifi dongle (not sure if thats already or still on the image)
  142. First look up with ifconfig for the interfaces, and which one is the one of the dongle
  143. sudo ifconfig
  144. there should be one called wlan0 or wlan1, which is the small one already on the orange pi zero.
  145. In addition, there should be one with the name wlx00... something.
  146. This one you should use with the following command:
  147. nmcli device wifi connect 'FRITZ!Box 6430 Cable TL' password "98475637998946115486" ifname wlan0
  148. ## Installing the KaosCube Interface
  149. First add a new user, if you are still root:
  150. adduser kaosuser
  151. Then add the user to sudoers:
  152. usermod -aG sudo kaosuser
  153. Now change to user (still being root) and go to home directory
  154. su kaosuser
  155. cd
  156. Remember cloning the interface from git?
  157. git clone https://code.basabuuka.org/alpcentaur/kc-interface.git
  158. After that, install php (working version is 7.4, but newer ones should
  159. also work)
  160. sudo apt install php
  161. Also the interface needs the following libraries:
  162. sudo apt install tor
  163. Now go in the directory kc-interface and run
  164. bash startserver.sh
  165. You will have the interface running on localhost:666
  166. To get the interface, connect to the ap kaoscube and enter the
  167. IP of its wifi interface with a double point and then 666.
  168. # Setting up functions of the KCInterface manually
  169. ## Setting up the Hidden Service
  170. First install Tor:
  171. sudo apt-get install tor
  172. Edit the torrc file:
  173. sudo nano /etc/tor/torrc
  174. Look for the line ############### This section is just for location-hidden services ###
  175. under this line, enable (uncomment) HiddenServiceDir and HiddenServicePort
  176. in our case,
  177. HiddenServiceDir /var/lib/tor/hidden_service/
  178. HiddenServicePort 80 127.0.0.1:80
  179. HiddenServicePort 22 127.0.0.1:22
  180. After restarting tor with
  181. sudo systemctl restart tor
  182. your hidden service is running, and you can get its address under
  183. /var/lib/tor/hidden_service/ , or whatever name or path you wrote in
  184. the torrc.
  185. # Features
  186. ## Installing 12d1:1f01 Huawei E353/E3131 LTE Usb Modem
  187. First issue
  188. lsusb
  189. to check, if you are trying to install the right LTE usb dongle.
  190. Being connected to the internet with your laptop, and having the shared
  191. internet connection being issued from your laptop, the kaoscube has
  192. internet too.
  193. Then, install usb_modeswitch with the command
  194. sudo apt install usb-modeswitch usb-modeswitch-data
  195. and then switch to modem mode for the usb stick
  196. sudo usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000a11062000000000000100000000000000'
  197. After that, lsusb will show you that the usb modem is now recognized as
  198. a modem.
  199. Now you can issue
  200. ip a
  201. and look for the new generated interface of the modem.
  202. take it's IP address, in my case it was 192.168.8.100/24, and replace
  203. the last bit with a 1 (192.168.8.1).
  204. Put that IP address into the browser of your laptop.