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.

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