User Tools

Site Tools


user:nbrimme1:portfolio:openbsd

Other Project:

A project for COURSENAME by YOUR NAME OR GROUPMEMBER NAMES during the SEMESTER YEAR.

This project was begun on DATE and is anticipated to take X AMOUNT OF TIME. (Upon completion you can correct this with the actual length).

Objectives

State the purpose of this project. What is the point of this project? What do we hope to accomplish by undertaking it?

Prerequisites

In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:

  • resource1
  • resource2
  • resource3
  • experience1
  • experience2
  • etc.

Background

State the idea or purpose of the project. What are you attempting to pursue?

Upon approval, you'll want to fill this section out with more detailed background information. DO NOT JUST PROVIDE A LINK.

Providing any links to original source material, such as from a project page, is a good idea.

You'll want to give a general overview of what is going to be accomplished (for example, if your project is about installing a web server, do a little write-up on web servers. What is it, why do we need one, how does it work, etc.)

Scope

Give a general overview of your anticipated implementation of the project. Address any areas where you are making upfront assumptions or curtailing potential detail. State the focus you will be taking in implementation.

Attributes

State and justify the attributes you'd like to receive upon successful approval and completion of this project.

  • attribute1: why you feel your pursuit of this project will gain you this attribute
  • attribute2: why you feel your pursuit of this project will gain you this attribute
  • etc…

Procedure

The actual steps taken to accomplish the project. Include images, code snippets, command-line excerpts; whatever is useful for intuitively communicating important information for accomplishing the project.

Installation:

  • File Sets: The complete OpenBSD installation is broken up into a number of file sets:
    • bsd: The kernel (required)
    • bsd.mp: The multi-processor kernel (only on some platforms)
    • bsd.rd: The ramdisk kernel; a live OpenBSD environment that runs entirely in memory. This can be used to perform a complete installation, an upgrade to a newer version, or for disaster recovery.
    • baseXX.tgz: The base system (required)
    • compXX.tgz: The compiler collection, headers and libraries
    • manXX.tgz: Manual pages
    • gameXX.tgz: Text-based games
    • xbaseXX.tgz: Base libraries and utilities for X11 (requires xshareXX.tgz)
    • xfontXX.tgz: Fonts used by X11
    • xservXX.tgz: X11's X servers. This set is rarely needed if you don't intend to run X.
    • xshareXX.tgz: X11's man pages, locale settings and includes

Configuration:

Base System:

  • Default shell: ksh
    ksh first reads /home/user/.kshrc then /home/user/.profile. The .profile file is read only once by the login ksh instance, while the .kshrc file is read by each new ksh instance.
  • Initialization files:
    • user: ~/.profile
    • host/all users: /etc/profile
    • hardware/software: /etc/environment
    • shell: ~/.kshrc
      • Example .kshrc:
        EDITOR=vim
        EMAIL=user@example.com
        HISTFILE=~/.ksh_history
        HISTSIZE=10000
        LC_ALL=en_US.UTF-8
        LANG=en_US.UTF-8
        \#LC_CTYPE=en_US.UTF-8
        PKG_PATH=ftp://openbsd.mirror.net/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
        ALT_PKG_PATH=http://openbsd.mirror.net/pub/OpenBSD/$(uname -r)/packages/$(uname -m)
        \# color prompt: [$TIME]{$USER@$HOST}($PWD)$>
        RST="\e[00m"; RED="\e[1;91m"; GRN="\e[1;92m"; BLU="\e[1;94m"; MAG="\e[1;95m"; CYN="\e[1;96m"
        if [[ $EUID == 0 ]]; then
            PS1="[$BLU\A$RST]$RED{$RST$CYN\u@\h$RST$RED}($RST$MAG\w$RST$RED)\\$>$RST "
        else
            PS1="[$BLU\A$RST]$GRN{$RST$CYN\u@\h$RST$GRN}($RST$MAG\w$RST$GRN)\\$>$RST "
        fi
        unset RST RED GRN BLU MAG CYN
        export EDITOR EMAIL HISTFILE HISTSIZE LC_ALL LANG PKG_PATH ALT_PKG_PATH PS1
        unset MAIL
        unset MAILCHECK
        \# reload .kshrc
        alias reload='. ~/.kshrc'
        alias cp='cp -i'
        alias ls='ls -A --color=auto'
        alias ll='ls -aFhl --color=auto'
        alias mv='mv -i'
        alias rm='rm -i'
      • Enable execution of .kshrc:
        $ echo "export ENV=${HOME}/.kshrc; export ENV" >> .profile

Kernel:

Building the System from Source:

Networking:

Initial Steps:

## Edit system hostname
$ doas vi /etc/myname
## Configure gateway IP address
$ doas vi /etc/mygate
## Configure the DNS IP address
$ doas vi /etc/resolv.conf

Wired:

## Configure static IP address and network mask: (em0 used as example)
$ doas vi /etc/hostname.em0

Wireless:

## Configure static IP address and network mask: (urtw0 used as example)
$ doas vi /etc/hostname.urtw0
## wpa_supplicant instructions
## Installation
$ doas pkg_add -ivvv wpa_supplicant
## Usage: (urtw0 used as example)
# Scan for WiFi APs:
$ doas ifconfig urtw0 up
$ doas ifconfig urtw0 scan
 
# Connect to a WPA Network:
$ ifconfig urtw0 nwid AP-SSID wpakey $uPPP3R_$3CURE_p@$$WoRD
$ dhclient urtw0
 
# Connect to a WPA Network with spaces in the BSSID: (Single quotes)
$ ifconfig urtw0 nwid 'AP-SSID with Spaces' wpakey $uPPP3R_$3CURE_p@$$WoRD
$ dhclient urtw0
 
# Connect to a WPA Network with symbols in the BSSID: (Double quotes)
$ ifconfig urtw0 nwid "AP-SSID_w!th_$ymb01$" wpakey $uPPP3R_$3CURE_p@$$WoRD
$ dhclient urtw0
 
## Monitor Mode:
# Show wireless card information:
$ doas dmesg | grep 'urtw0'
# Show Media Options:
$ ifconfig urtw0 media
# ENABLE Monitor Mode:
$ doas ifconfig urtw0 mediaopt monitor
# DISABLE Monitor Mode:
$ doas ifconfig urtw0 -mediaopt monitor

Packages/Ports/Source:

Packages:

  • Install a package:
    $ doas pkg_add -imVvvvvv package_name | tee package_name.txt
  • Remove a package:
    $ doas pkg_delete -aimVvvvvv <package_name>
  • Update a single package:
    $ doas pkg_add -umVvvvvv <package_name>
  • Update installed packages:
    $ doas pkg_add -umVvvvvv
  • Useful Packages:
    • Package Management:
      • pkg_mgr: A high-level, user-friendly package browser for OpenBSD. It allows the user to install, uninstall, search & browse available packages using a simple curses interface. It relies on sqlports for its internal database, pkg_add(1), pkg_info(1) and pkg_delete(1) for package operations.
    • Terminal Multiplexers: byobu, screen, tmux

Ports:

Upgrading/Updating:

Initial Steps:

  • Add path:
    $ vi .profile
    export PKG_PATH=ftp://openbsd.mirror.frontiernet.net/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
    export ALT_PKG_PATH=http://openbsd.mirror.frontiernet.net/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
    $ doas vi /root/.profile
    export PKG_PATH=ftp://openbsd.mirror.frontiernet.net/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
    export ALT_PKG_PATH=http://openbsd.mirror.frontiernet.net/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/

Upgrading:

  • -release: The version shipped every six months.
  • -current: The development branch.
  • -stable: The -release branch, plus patches found on the errata page.
    • Using cvs:
      • Fetching the -stable trees:
        $ cd /usr
        $ cvs -qd anoncvs@anoncvs.example.org:/cvs checkout -rOPENBSD_6_3 -P src
      • Updating the -stable trees:
        $ cd /usr/src
        $ cvs -q up -Pd
        • Specify the branch with the -r command
        • All the trees (src, ports, xenocara, www) should be checked out and updated at the same time.
      • Fetching the -current trees:
        $ cd /usr
        $ cvs -qd anoncvs@anoncvs.example.org:/cvs checkout -P src
      • Updating the -current trees:
        $ cd /usr/src
        $ cvs -q up -Pd

Updating:

  • Firmware: using fw_update(1):
    $ doas fw_update -v
  • System:
  • Four active source repositories:
    • src - source code for the base system
    • ports - the ports tree
    • www - web pages
    • xenocara - xenocara
  • Preloading the source code tree:
    $ cd /tmp
    $ wget http://mirrors.mit.edu/pub/OpenBSD/6.3/src.tar.gz
    $ wget http://mirrors.mit.edu/pub/OpenBSD/6.3/sys.tar.gz
    $ wget http://mirrors.mit.edu/pub/OpenBSD/6.3/ports.tar.gz
    $ wget http://mirrors.mit.edu/pub/OpenBSD/6.3/xenocara.tar.gz
    $ cd /usr/src
    $ tar xvfz /tmp/sys.tar.gz
    $ tar xvfz /tmp/src.tar.gz
    $ cd /usr
    $ tar xvfz /tmp/ports.tar.gz
    $ tar xvfz /tmp/xenocara.tar.gz
    $ rm /tmp/*.tar.gz

Administration:

Services:

Users:

Security:

PGP/GPG:

SSH:

SSL:

Miscellaneous:

Mount a USB drive: (sd0 is used as an example)

  • Create a directory to mount the USB drive:
    $ doas mkdir /mnt/usb
    $ doas sysctl hw.disknames
    $ doas dmesg | grep sd0
    $ doas disklabel sd0
  • Mount the USB drive in the created directory:
    $ doas mount /dev/sd0i /mnt/usb
    $ cd /mnt/usb
    $ ls -aFhl
  • Unmounting the USB drive:
    $ doas umount /mnt/usb

Code

Upon completion of the project, if there is an applicable collection of created code, place a copy of your finished code within <code> </code> blocks here.

/*
 * hello.c - A sample "Hello, World!" program
 * 
 * written by NAME for COURSE on DATE
 *
 * compile with:
 *   gcc -o hello hello.c
 *
 * execute with:
 *   ./hello
 */
 
#include <stdio.h>
 
int main()
{
    printf("Hello, World!\n");    // Output message to STDOUT
    return(0);
}

Execution

Again, if there is associated code with the project, and you haven't already indicated how to run it, provide a sample run of your code:

lab46:~/src/cprog$ ./hello
Hello, World!
lab46:~/src/cprog$ 

Reflection

Comments/thoughts generated through performing the project, observations made, analysis rendered, conclusions wrought. What did you learn from doing this project?

References

In performing this project, the following resources were referenced:

  • Google: Of course Google was used, it knows everything. No particular page from Google was used, It was mainly used for information about the project (Linked Lists in general): http://www.google.com/; If ya don't know, now ya know, and knowing is half the battle.

Back to my Portfolio
Back to my Opus

user/nbrimme1/portfolio/openbsd.txt · Last modified: 2018/06/21 15:02 by nbrimme1