== Notes on installing, confuguring and using OpenBSD ==

TO DO LIST

vim
lid suspend
shell environment
ftpd ipv4
ntpd
inetd
fingerd
sshd ipv4
leafnode nntp


!FIND A WAY TO GET RWHO/RUPTIME.... not in OpenBSD packages/ports


==== install vim =

       pkg_add vim

choose one...?



==== install most (pager) =

this allows coloured man pages




==== lid suspend =

as installed OpenBSD will suspend if the laptop lid is closed.

To prevent this edit /etc/sysctl.conf

       machdep.lidaction=0

*** update.... this only works for supressing the suspend AFTER
the system is running. Doesn't prevent it suspending if the lid
is closed DURING boot!

Leave the lid up but add something to turn off the console display
(work in progress)




==== shell environment =

OpenBSD uses korn shell (ksh)

add to .profile

~~~~~~~~~~~~~

# $OpenBSD: dot.profile,v 1.8 2022/08/10 07:40:37 tb Exp $
#
# sh/ksh initialization

ENV=.kshrc
export ENV

EDITOR=vim
export EDITOR

VISUAL=vim
export VISUAL

PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin

export PATH HOME TERM
HISTFILE=~/.shell_history

~~~~~~~~~~~~~~~

then add to .kshrc

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


PAGER=most

alias vi='vim'

alias ls='colorls -G'

set -o emacs


e=`printf "\033"`

end="$e[0m"
red="$e[1;31m"
green="$e[1;32m"
yellow="$e[1;33m"
blue="$e[1;34m"
magenta="$e[1;35m"
darkcyan="$e[36m"
unset e


PS1='${green}\u@\h${end}:${darkcyan}\w${end}\$ '

export PS1

export PAGER


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






===== ftpd =

To make the pre-installed ftpd use only ipv4

edit /etc/rc.conf.local

       ftpd_flags=-4


To start the pre-installed ftpd


       rcctl set ftpd status on
       rcctl start ftpd





===== ntpd ==

enable pre-installed ntpd

       rcctl set ntpd status on
       rcctl start ntpd

to check ntp status don't use ntpq!

use

       ntpctl -s all




===== inetd (to get fingerd& nntp to work) =


copy example inetd.conf from /etc/examples/inetd.conf
to /etc/inetd.conf

edit inetd.conf to allow finger (add -lsm to get right behaviour)
don't uncomment the tcp6 version


finger stream  tcp nowait  _fingerd /usr/libexec/fingerd   fingerd -lsm


comment out the daytime and comsat lines to prevent them listening.


start inetd

       rcctl set inetd status on
       rcctl start inetd





===== sshd only ipv4 =

edit /etc/ssh/sshd_config

AddressFamily inet

restart

       rcctl stop sshd
       rcctl start sshd





====== install leafnode ==

pkg_add leafnode


edit /etc/leafnode/config

       expire = 20

       server = news.eternal-september.org
       username = xxxxx
       password = xxxxx
       initialfetch = 100


add to /etc/inetd.conf

       nntp stream  tcp  nowait  _news   /usr/local/sbin/leafnode

restart inetd

       rcctl restart inetd

make an /etc/crontab file to trigger fetchnews regularly


       30 * * * * _news /usr/local/bin/fetchnews