Dlock.bitraf.no

Fra Bitraf
Revisjon per 19. aug. 2021 kl. 22:20 av Tingo (diskusjon | bidrag) (Server info: dokumenter hvor vm'en kjører)
Hopp til navigering Hopp til søk

dlock.bitraf.no er en virtuell server som brukes av låsstyringssystemet til Bitraf. Maskinen kjører dlock[1] programvare, i rolle som dlock gateway. Konfigurasjonen av maskinen er gjort ved hjelp av ansible[2]. En dlock gateway kommuniserer med låsstyringer koblet til systemet, og sender melding om at dører / låser skal åpnes når den mottar melding om det. I Bitrafs tilfelle kommer slike meldinger fra p2k16.

Server info

  • name: dlock
  • vcpus: 2
  • memory: 4 GB
  • type: hvm

den virtuelle maskinen kjører på serveren bite (bite er "host").

Låsstyring

En låsstyring består av en Raspberry Pi med et kretskort oppå (en "hat" om du vil) samt en strømforsyning som passer til det elektriske sluttstykket som skal styres (vanligvis 12 eller 24 V dc). Det elektriske sluttstykket er koblet til hat'en, og Pi'en får strøm via hat'en. Pi'en kjører Linux (Raspbian lite) samt programvare ("dlock firmware") for å motta meldinger fra dlock gateway og styre det elektriske sluttstykket som er koblet til. Pi'en er koblet til lokalnettet (vanligvis via kablet nettverk). Kommunikasjonen mellom gateway og låsstyring er kryptert.

Se også

Historikk

2021-08-05 
unfortunately, I had connected the machine to the wrong bridge when I configured it
tingo@bite:~$ virsh --connect qemu:///system domiflist dlock
 Interface   Type     Source   Model    MAC
-----------------------------------------------------------
 vnet15      bridge   br0      virtio   52:54:00:02:0d:99

fix that by editing the vm

virsh --connect qemu:///system edit dlock

and change br0 to br1, the nrestart the vm and check

tingo@bite:~$ virsh --connect qemu:///system domiflist dlock
 Interface   Type     Source   Model    MAC
-----------------------------------------------------------
 vnet15      bridge   br1      virtio   52:54:00:02:0d:99

better now. Tingo (diskusjon) 19. aug. 2021 kl. 22:53 (CEST)

2021-08-05 
install the virtual machine, start the installation
tingo@bite:~$ sudo virt-install --connect qemu:///system --name dlock --memory 4096 --vcpus 2 --hvm --location /var/lib/iso/debian-10.10.0-amd64-netinst.iso --disk /var/lib/libvirt/images/dlock.qcow,size=20,format=qcow2,bus=virtio --network bridge=br0,model=virtio --os-type=linux --os-variant=debian10

Starting install...
Retrieving file info...                                                                       |   73 B  00:00:00     
Retrieving file vmlinuz...                                                                    | 5.0 MB  00:00:00     
Retrieving file initrd.gz...                                                                  |  19 MB  00:00:00     
Allocating 'dlock.qcow'                                                                       |  20 GB  00:00:01     
X11 connection rejected because of wrong authentication.
Unable to init server: Could not connect: Connection refused

(virt-viewer:28204): Gtk-WARNING **: 14:59:13.771: cannot open display: localhost:11.0
Domain installation still in progress. You can reconnect to 
the console to complete the installation process.

then from another session (started with `ssh -Y machine`start virt-viewer

tingo@bite:~$ virt-viewer --connect qemu:///system dlock

(virt-viewer:28257): GSpice-WARNING **: 14:59:30.196: PulseAudio context failed Connection refused

(virt-viewer:28257): GSpice-WARNING **: 14:59:30.196: pa_context_connect() failed: Connection refused

then you get a windows on your machine, which runs the Debian installer, and you answer the normal way. Tingo (diskusjon) 19. aug. 2021 kl. 22:43 (CEST)

Choices made in the installer: unselected Debian desktop environment, print server, selected SSH server, "standard system utilities" was selected, I didn't change it. Tingo (diskusjon) 19. aug. 2021 kl. 22:47 (CEST)

2021-08-05 
preparations - create a volume and upload a Debian netinstall image to it
tingo@bite:~$ sudo virsh vol-create-as iso debian-10.10.0-amd64-netinst.iso `stat -Lc%s debian-10.10.0-amd64-netinst.iso`
Vol debian-10.10.0-amd64-netinst.iso created

tingo@bite:~$ sudo virsh vol-upload debian-10.10.0-amd64-netinst.iso ./debian-10.10.0-amd64-netinst.iso --pool iso

verify that the new image is available

tingo@bite:~$ sudo virsh vol-list iso
 Name                               Path
-----------------------------------------------------------------------------------
 debian-10.10.0-amd64-netinst.iso   /var/lib/iso/debian-10.10.0-amd64-netinst.iso
 debian-9.1.0-amd64-netinst.iso     /var/lib/iso/debian-9.1.0-amd64-netinst.iso

Tingo (diskusjon) 19. aug. 2021 kl. 22:38 (CEST)

Referanser