os:openbsd:x230t
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| os:openbsd:x230t [2021/12/29 21:03] – ↷ Page moved from openbsd:x230t to os:openbsd:x230t warnaud | os:openbsd:x230t [2021/12/29 21:03] (current) – ↷ Links adapted because of a move operation warnaud | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Introduction ====== | ||
| + | :!: outdated, new installations [[os: | ||
| + | Tired of Systemd and some other layers in Linux, I will try to install OpenBSD my x230 Tablet, encrypting partitions with a key stored on a SD card. (hello NSA)\\ | ||
| + | I will use an openBSD59 (snapshot of 27th of March 2016).\\ | ||
| + | The x230 is modified, I added a mSATA drive (sd1).\\ | ||
| + | I removed totally Windows as I don't use it. | ||
| + | ====== Downloads ====== | ||
| + | [[http:// | ||
| + | ====== disk Layout ====== | ||
| + | I will use the following schema: | ||
| + | * mSATA (sd1) 256GB for / | ||
| + | * SATA (sd0) 500GB for swap/ | ||
| + | |||
| + | ^ Disk ^ Partition | ||
| + | |1 | 1 | RAID | 230GB | / | | ||
| + | |1 | 2 | none | 26GB | fake trim | | ||
| + | |0 | 1 | swap | 16GB | OpenBSD swap | | ||
| + | |0 | 2 | RAID | 480GB | /var, /tmp and /home | | ||
| + | |||
| + | ====== Installation ====== | ||
| + | Boot from the iso/usb key\\ | ||
| + | Select the shell (by type ' | ||
| + | (I)nstall, (U)pgrade, (A)utoinstall, | ||
| + | |||
| + | ===== Disk partitionning ===== | ||
| + | We will create the above partitions using fdisk/ | ||
| + | \\ | ||
| + | <code bash> | ||
| + | the output is | ||
| + | < | ||
| + | Let's create the device | ||
| + | <code bash>cd /dev | ||
| + | sh ./MAKEDEV sd1 | ||
| + | </ | ||
| + | An run again: | ||
| + | <code bash> | ||
| + | the output is largely nicer: | ||
| + | < | ||
| + | Let's partition sd0 and sd1 | ||
| + | <code bash> | ||
| + | > a | ||
| + | partition: [a] | ||
| + | offset: [64] | ||
| + | size: [500103386] 95% | ||
| + | FS type: [4.2BSD] RAID | ||
| + | > w | ||
| + | > q | ||
| + | </ | ||
| + | Done for sd1 (I leave 5% free for TRIM as I got no clear details whether or not I need it or not if it is working or not and well 95% of 256GB should be enough for / :-) )\\ | ||
| + | Let's partition sd0 | ||
| + | <code bash> | ||
| + | > a | ||
| + | partition: [a] | ||
| + | offset: [0] | ||
| + | size: [976773168] 16g | ||
| + | FS type: [4.2BSD] swap | ||
| + | > a | ||
| + | partition: [b] | ||
| + | offset: [33559785] | ||
| + | size: [943213383] | ||
| + | FS type: [swap] RAID | ||
| + | > w | ||
| + | > q | ||
| + | </ | ||
| + | Here we do 2 partitions, swap (already encrypted) and a RAID one that will contained /var /tmp and /home) | ||
| + | |||
| + | ===== SDcard/ | ||
| + | Plug in your SD card/ USB stick, here it is named sd3 | ||
| + | <code bash>cd /dev | ||
| + | sh ./MAKEDEV sd3 | ||
| + | </ | ||
| + | Don't forget to create the MBR | ||
| + | <code bash> fdisk -iy sd3 </ | ||
| + | We just need around 1MB for the key so I will just create two very small partitions (d and e). | ||
| + | <code bash> | ||
| + | > a | ||
| + | partition: [a]d | ||
| + | offset: [64] | ||
| + | size: [124735488] 2m | ||
| + | FS type: [4.2BSD] RAID | ||
| + | > a | ||
| + | partition: [a]e | ||
| + | offset: [16065] | ||
| + | size: [124735488] 2m | ||
| + | FS type: [4.2BSD] RAID | ||
| + | > w | ||
| + | > q | ||
| + | </ | ||
| + | |||
| + | ===== Let's encrypt ===== | ||
| + | So for now we have sd1(m-sata)/ | ||
| + | Next step is an all-in-one step: we will encrypt sd1a and sd0b as softraid0 and save the key on the SD card. | ||
| + | <code bash> | ||
| + | bioctl -C force -c C -l /dev/sd0b -k /dev/sd3e softraid0 | ||
| + | </ | ||
| + | Note: http:// | ||
| + | Maybe it would be good to put on top: | ||
| + | <code bash> | ||
| + | bioctl -c C -l /dev/sd1a -r 98765 softraid0 | ||
| + | bioctl -c C -l /dev/sd0b -r 98765 softraid0 | ||
| + | </ | ||
| + | Output will be something like: | ||
| + | < | ||
| + | sd4: 231988MB, | ||
| + | and | ||
| + | < | ||
| + | sd5: 460553MB, | ||
| + | We create the devices: | ||
| + | <code bash>cd /dev | ||
| + | sh ./MAKEDEV sd4 | ||
| + | sh ./MAKEDEV sd5 | ||
| + | </ | ||
| + | Good practice, erase first MegaByte: | ||
| + | <code bash>dd if=/ | ||
| + | dd if=/ | ||
| + | |||
| + | So now we have sd4 and sd5 which we will use during the installation. | ||
| + | ===== Install ===== | ||
| + | Let's go back to the installation | ||
| + | <code bash>/ | ||
| + | Select layout, timezone, passwords, user(s)…\\ | ||
| + | When at the partitioning point, select the 2 new device (sd4 and sd5 in my case).\\ | ||
| + | < | ||
| + | Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [whole]W | ||
| + | [… auto partitions schema …] | ||
| + | Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] c | ||
| + | > a | ||
| + | partition: [a]a | ||
| + | offset: [64] | ||
| + | size: [475106246] | ||
| + | FS type: [4.2BSD] | ||
| + | mount point: [none] / | ||
| + | > w | ||
| + | > q | ||
| + | </ | ||
| + | We do the same for sd5 (/var /tmp and /home) | ||
| + | <code bash> | ||
| + | Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [whole]W | ||
| + | > a | ||
| + | partition: [a]a | ||
| + | offset: [64] | ||
| + | size: [943208216] 20g | ||
| + | FS type: [4.2BSD] | ||
| + | mount point: [none] /var | ||
| + | > a | ||
| + | partition: [b] | ||
| + | offset: [41945696] | ||
| + | size: [901262584] 10g | ||
| + | FS type: [swap] 4.2BSD | ||
| + | mount point: [none] /tmp | ||
| + | > a | ||
| + | partition: [d] | ||
| + | offset: [62910528] | ||
| + | size: [880297752] | ||
| + | FS type: [4.2BSD] | ||
| + | mount point: [none] /home | ||
| + | > w | ||
| + | > q | ||
| + | </ | ||
| + | And voilà. | ||
| + | <code bash> | ||
| + | Install the sets\\ | ||
| + | Installation should finish with a success, but **__DO NOT REBOOT YET__** | ||
| + | ===== Final touch ===== | ||
| + | We will tweak quickly the fstab to add the swap partition as well as some parameters: | ||
| + | <code bash> | ||
| + | sed ' | ||
| + | echo '/ | ||
| + | mv /mnt/a / | ||
| + | </ | ||
| + | Done, everything is ready! ready to reboot | ||
| + | <code bash> | ||
| + | ====== Backup of the Keys ====== | ||
| + | <code bash>dd if=/ | ||
| + | dd if=/ | ||
| + | </ | ||
| + | |||
| + | ====== Switching to -current ====== | ||
| + | Optional, but thrilling! | ||
| + | <code bash> | ||
| + | cd / | ||
| + | mv /bsd.rd /bsd.rd.sav | ||
| + | wget http:// | ||
| + | </ | ||
| + | Reboot | ||
| + | <code bash> | ||
| + | reboot | ||
| + | </ | ||
| + | At boot prompt type: | ||
| + | < | ||
| + | boot> boot bsd.rd | ||
| + | </ | ||
| + | Then use the " | ||
| + | When upgrade is done, type again " | ||
| + | Once reboot use sysmerge to merge/check modifications | ||
| + | <code bash> | ||
| + | sysmerge | ||
| + | </ | ||
| + | And voilà ! you are in -current | ||
| + | |||
| + | ====== Laptop tweaks ====== | ||
| + | ===== apm ===== | ||
| + | In order to keep some battery: | ||
| + | <code bash>vi / | ||
| + | add | ||
| + | < | ||
| + | apmd_flags=" | ||
| + | apmd_enable=" | ||
| + | </ | ||
| + | |||
| + | ===== desktop reactivity ===== | ||
| + | In / | ||
| + | < | ||
| + | multicast_host=YES | ||
| + | ntpd_flags=" | ||
| + | hotplugd_flags="" | ||
| + | </ | ||
| + | In / | ||
| + | < | ||
| + | : | ||
| + | : | ||
| + | |||
| + | </ | ||
| + | by (at least) | ||
| + | < | ||
| + | : | ||
| + | : | ||
| + | </ | ||
| + | Reference: http:// | ||
| + | ====== Xorg ====== | ||
| + | xorg.conf to put in /etc/X11 | ||
| + | <code perl> | ||
| + | Section " | ||
| + | Identifier | ||
| + | Screen | ||
| + | InputDevice | ||
| + | InputDevice | ||
| + | | ||
| + | Option " | ||
| + | | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | ModulePath | ||
| + | FontPath | ||
| + | FontPath | ||
| + | FontPath | ||
| + | FontPath | ||
| + | FontPath | ||
| + | FontPath | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Load " | ||
| + | Load " | ||
| + | Load " | ||
| + | Load " | ||
| + | Load " | ||
| + | Load " | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Identifier | ||
| + | Driver | ||
| + | Option " | ||
| + | Option " | ||
| + | # Option " | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Identifier " | ||
| + | Driver " | ||
| + | Option " | ||
| + | Option " | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Identifier | ||
| + | Driver | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Identifier | ||
| + | VendorName | ||
| + | ModelName | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | ### Available Driver options are:- | ||
| + | ### Values: <i>: integer, <f>: float, < | ||
| + | ### < | ||
| + | ### < | ||
| + | ### [arg]: arg optional | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | Identifier | ||
| + | Driver | ||
| + | BusID | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Identifier " | ||
| + | Device | ||
| + | Monitor | ||
| + | SubSection " | ||
| + | Viewport | ||
| + | Depth | ||
| + | EndSubSection | ||
| + | SubSection " | ||
| + | Viewport | ||
| + | Depth | ||
| + | EndSubSection | ||
| + | EndSection | ||
| + | </ | ||
| + | ===== Touchpad ===== | ||
| + | See xorg.conf above but basically: | ||
| + | <code perl> | ||
| + | Section " | ||
| + | Identifier " | ||
| + | Driver " | ||
| + | Option " | ||
| + | Option " | ||
| + | EndSection | ||
| + | |||
| + | Section " | ||
| + | Identifier | ||
| + | Driver | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | Option | ||
| + | EndSection | ||
| + | </ | ||
| + | In your ~/.xsession | ||
| + | <code bash> | ||
| + | #!/bin/sh | ||
| + | |||
| + | # deactivate touchpad | ||
| + | synclient TouchpadOff=1 | ||
| + | </ | ||
| + | |||
| + | ===== Scrolling ===== | ||
| + | Still in ~/.xsession | ||
| + | <code bash> | ||
| + | # activate scroll wheel button | ||
| + | xinput set-prop "/ | ||
| + | xinput set-prop "/ | ||
| + | xinput set-prop "/ | ||
| + | xinput set-prop "/ | ||
| + | xinput set-prop "/ | ||
| + | |||
| + | # increase pointer speed | ||
| + | xinput set-prop "/ | ||
| + | </ | ||
| + | ====== Locales ====== | ||
| + | Still in ~/.xsession | ||
| + | <code bash> | ||
| + | # set locale | ||
| + | export LC_CTYPE=" | ||
| + | export LC_MESSAGES=" | ||
| + | </ | ||
| + | ====== Network ====== | ||
| + | ifconfig is your friend!\\ | ||
| + | Simple example: | ||
| + | <code bash> | ||
| + | then if all is ok: | ||
| + | <code bash> | ||
| + | You can scan networks (wifi) | ||
| + | <code bash> | ||
| + | |||
| + | ===== Failover network ===== | ||
| + | ===== local DNS ===== | ||
| + | |||
| + | ====== Security ====== | ||
| + | ===== PF ===== | ||
| + | Basic rules in your / | ||
| + | < | ||
| + | # | ||
| + | # | ||
| + | # See pf.conf(5) and / | ||
| + | |||
| + | set skip on lo | ||
| + | |||
| + | block return | ||
| + | pass # establish keep-state | ||
| + | |||
| + | # By default, do not permit remote connections to X11 | ||
| + | block return in on ! lo0 proto tcp to port 6000:6010 | ||
| + | |||
| + | set block-policy drop | ||
| + | match in all scrub (no-df random-id max-mss 1440) | ||
| + | antispoof quick for (egress) | ||
| + | block in quick on egress from { no-route urpf-failed } to any | ||
| + | block in all | ||
| + | pass out quick inet keep state | ||
| + | </ | ||
| + | References: http:// | ||
| + | ====== Additional Packages ====== | ||
| + | Time to play with pkg_add to put some useful tools: | ||
| + | <code bash> | ||
| + | pkg_add -Uu | ||
| + | pkg_add -iv firefox | ||
| + | pkg_add -iv ImageMagick irssi vim zsh rxvt-unicode fvwm2 xscreensaver rdesktop iftop rsync wget curl figlet dfc git subversion ranger emelfm2 | ||
| + | </ | ||
| + | ====== Ports ====== | ||
| + | You can install ports using a snapshot made for you! | ||
| + | <code bash> | ||
| + | cd /usr | ||
| + | wget http:// | ||
| + | tar xvzf ports.tar.gz | ||
| + | </ | ||
| + | ====== Finding packages ====== | ||
| + | Two ways: | ||
| + | <code bash> | ||
| + | pkg_info yourpackage | ||
| + | </ | ||
| + | or | ||
| + | <code bash> | ||
| + | cd /usr/ports | ||
| + | make search key=what_you_search | ||
| + | </ | ||
| + | |||
| + | Reference: http:// | ||
| + | |||
| + | ====== Thing went wrong when ====== | ||
| + | ===== bootblocks are not installed ===== | ||
| + | <code bash> | ||
| + | → installboot: | ||
| + | Failed to install bootblocks | ||
| + | You will not be able to boot OpenBSD from sd4 | ||
| + | </ | ||
| + | I had this issue when sd0 didn't had a MBR nor sd3 … dd saved the days :) | ||
| + | |||
| + | ====== References ====== | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
