grimoire

personal wiki
git clone git://git.pyratebeard.net/grimoire.git
Log | Files | Refs

openbsd.md (3488B)


      1 # openbsd
      2 
      3 * [pf firewall](/networking/pf)
      4 
      5 ## setting up new system
      6 ### pre install
      7 * [softraid encryption][] with keydisk
      8 * select `(S)hell` from install menu
      9 ```
     10 cd /dev && sh MAKEDEV sd0
     11 dd if=/dev/urandom of=/dev/rsd0c bs=1m
     12 fdisk -iy sd0 #mbr
     13 disklabel -E sd0
     14 	Label editor (enter '?' for help at any prompt)
     15 	sd0> a a
     16 	offset: [64]
     17 	size: [976773104] *
     18 	FS type: [4.2BSD] RAID
     19 	sd0*> w
     20 	sd0> q
     21 	No label changes.
     22 sh MAKEDEV sd2 #keydisk
     23 dd if=/dev/urandom of=/dev/rsd0c bs=1m
     24 fdisk -iy sd2 #mbr
     25 disklabel -E sd2
     26 	Label editor (enter '?' for help at any prompt)
     27 	sd2> a a
     28 	offset: [64] 31205376 #total - 2048
     29 	size: [2048] 1024
     30 	FS type: [4.2BSD] RAID
     31 	sd2*> w
     32 	sd2> a b
     33 	offset: [64] 31206400 #total - 1024
     34 	size: [1024] *
     35 	fs type: [swap] RAID
     36 	sd2*> w
     37 	sd2> a i
     38 	offset: [64]
     39 	size: [31205312] *
     40 	fs type: [swap] msdos
     41 	sd2*> w
     42 	sd2> q
     43 	No label changes.
     44 bioctl -c C -k sd2a -l sd0a softraid0
     45 sh MAKEDEV sd3 #softraid
     46 dd if=/dev/zero of=/dev/rsd3c bs=1m count=1
     47 exit
     48 ```
     49 * continue with [installation][], selecting softraid disk (`sd3`) for install
     50 
     51 ### post install
     52 ```
     53 echo "permit nopass <username> > /etc/doas.conf
     54 ```
     55 
     56 ```
     57 doas pkg_add -u
     58 doas pkg_add \
     59 	git \
     60 	vim \
     61 	herbstluftwm \
     62 	rxvt-unicode \
     63 	stow \
     64 	zsh \
     65 	unclutter \
     66 	xbindkeys \
     67 	keychain \
     68 	dmenu \
     69 	gnupg \
     70 	irssi \
     71 	qutebrowser \
     72 	sacc \
     73 	xcape \
     74 	mpv \
     75 	wget \
     76 	mosh \
     77 	clipmenu
     78 doas ln -s /usr/local/bin/zsh /usr/bin/zsh
     79 git clone git://git.pyratebeard.net/dotfiles.git dot
     80 cd dot
     81 stow *
     82 mkdir ~/.fonts
     83 cd ~/.fonts
     84 wget https://pyratebeard.net/trigon-font/trigon8x15r.bdf
     85 # cp .xinitrc to .xsession
     86 doas chsh pyratebeard
     87 # urxvt LANG
     88 mkdir lib src/warez tmp var
     89 ```
     90 
     91 #### changes to dotfiles
     92 * herbstluftwm needs to use bash not sh
     93 * gpg-agent pinentry path
     94 * ls(1) has no color option
     95 
     96 #### wifi
     97 * on arch
     98 ```
     99 lftp "http://firmware.openbsd.org/firmware/7.2/"
    100 cd ok, cwd=/firmware/7.2
    101 lftp firmware.openbsd.org:/firmware/7.2> mget *
    102 69709649 bytes transferred in 124 seconds (549.2 KiB/s)
    103 Total 26 files transferred
    104 lftp firmware.openbsd.org:/firmware/7.2> quit
    105 quit
    106 cd ../
    107 tar czf ./firmware.tgz openbsd_firmware
    108 scp firmware.tgz laptop:
    109 ```
    110 
    111 * in openbsd
    112 ```
    113 tar xzf firmware.tgz
    114 doas fw_update -p openbsd_firmware/
    115 doas vi /etc/hostname.iwm0
    116 	join "<ssid>" wpakey "<password>"
    117 	#join "<ssid>" wpakey "<password>"
    118 	#join "<ssid>" wpakey "<password>"
    119 	inet autoconf
    120 doas sh /etc/netstart iwm0
    121 ```
    122 
    123 #### gui
    124 
    125 ## firewall
    126 ```
    127 vi /etc/pf.conf
    128 ```
    129 
    130 ## packages
    131 * `pkg_info` show all packages installed by `pkg_add`
    132 * use `pkg_info -Q <package_name>` or `pkglocate <package_name>` (requires installing `pkglocatedb`) for searching
    133 * mirror in `/etc/installurl`
    134 * update system with `syspatch`
    135 * update all pkgs outside of base (i.e. ports) with `pkg_add -u`
    136 * system upgrade with `sysupgrade`
    137 
    138 ## daemons
    139 ```
    140 rcctl ls all
    141 rcctl start sshd
    142 ```
    143 
    144 ## devices
    145 * list attached devices
    146 ```
    147 sysctl hw.diskcount
    148 sysctl hw.disknames
    149 ```
    150 * read/write disklabels
    151 ```
    152 disklabel <device>
    153 ```
    154 * creating msdos partition
    155 ```
    156 disklabel -E <disk>
    157 	Label editor (enter '?' for help at any prompt)
    158 	sd2> a b			
    159 	offset: [1088]
    160 	size: [7830464] *
    161 	FS type: [4.2BSD] msdos
    162 	sd2*> w
    163 	sd2> q
    164 	No label changes.
    165 newfs_msdos /dev/rsd2b
    166 ```
    167 
    168 ## misc
    169 * hostname - /etc/myname
    170 * changing terminal font
    171 	* on arch
    172 	```
    173 	pacman -S cabel-install ghc
    174 	git clone "https://github.com/polachok/bdf2wscons"
    175 	cd bdf2wscons
    176 	cabel install
    177 	bdf2wscons trigon8x15.bdf > 
    178 	```
    179 	
    180 [softraid encryption]: https://www.openbsd.org/faq/faq14.html#softraidFDE