2026-09-22 05:26:56 +03:00
2026-09-22 04:37:10 +03:00
2026-09-22 03:22:39 +03:00
2026-09-21 18:34:03 +03:00
2026-09-22 04:37:10 +03:00
2026-09-22 04:37:10 +03:00
2026-09-22 03:23:19 +03:00
2023-07-11 11:45:51 +03:00
2026-09-22 05:26:56 +03:00

OpenBSD-Notes

Time saver scripts installing and configuring basic stuff on secure OpenBSD installations

ksh

add stuff to ./profile

  • aliases coloring ls and grep, cd with many dots, git basic commands
  • prompt.ksh coloring the prompt, adding git branch, latest exit code, [SSH]
  • srm.ksh alias for real rm, show first 10 lines before delete aprovion

netstat

shows net sockecks with parent pid and command

  • netstat-tulp.sh: like the linux command netstat -tulp
# netstat-tulp.sh                                                                                        
PROTO LOCAL ADDRESS       PID      USER      COMMAND
----- ------------------- -------- --------- -------
tcp4  192.168.0.2:22461   14372    root      curl https://git.vaidis.eu/stevaidis
tcp4  192.168.1.1:22      34378    stevaidi  sshd-session: stevaidis@ttyp1 (sshd-session)
tcp4  192.168.1.1:22      4220     root      sshd-session: stevaidis [priv] (sshd-session)
udp4  *:0                 27528    _iftop    iftop
tcp4  *:22                64524    root      sshd: /usr/sbin/sshd [listener] (sshd)
udp4  *:0                 24588    _dhcp     dhcpleased: frontend (dhcpleased)
udp4  *:0                 34598    root      /sbin/dhcpleased
udp6  *:0                 71243    _slaacd   slaacd: frontend (slaacd)
udp6  *:0                 84073    root      /sbin/slaacd

Enviroment

  • prompt : color prompt, git branch, latest exit Code
  • navigation: color ls
  • working : color grep, git aliases (ga, gs, gd, gc, gp)

Packages

  • ggrep: pair with shell alias, coloring grep output
  • vim: zero plguns, molokai theme, common keymaps from popular distros, tabs,
  • git: must
  • iftop: monitor network traffic
  • tcpdump: monitor network packages
  • curl: http client

Vim

  • .vim/colors/molokai.vim: light modified black side numbers, black tabline, transparent
  • .vimrc: common keymaps for file managers, tabs navigation, cursons, keymaps help screen

Install

git clone 
cd openbsd-onboard
./install.ksh
./install-firewall.ksh
./install-dhcp.ksh
./install-lamp.ksh

set -o vi

WEB SERVER

WEB

# Configure
cp -p /etc/examples/httpd.conf /etc/
nvim /etc/httpd.conf

# Start
rcctl enable httpd
rcctl start httpd
rcctl status httpd

# Check
fstat | grep ':80'
httpd -n

# Test

PHP

pkg_info -Q php | grep 7.4
pkg_info -Q php | grep 8.1
pkg_add wget unzip composer git
pkg_add libxml xz png jpeg libiconv

pkg_add `pkg_info -Q php | grep 7.4.33 | grep -v debug`
# The following new rcscripts were installed:
#
# /etc/rc.d/apache2
# /etc/rc.d/netsnmpd
# /etc/rc.d/netsnmptrapd
# /etc/rc.d/php74_fpm
# /etc/rc.d/saslauthd

Database

# Installation
pkg_add mariadb-server php_mysqli php_pdo_mysql

# Start
rcctl enable mysqld
rcctl start mysqld
rcctl check mysqld

# Setup
mysql_install_db          # create system tables and binary files
mysql_secure_installation # Enable socket at /var/run/mysql.sock

/etc/my/cnf

[client-server]
socket=/var/run/mysql/mysql.sock
port=3306

Test mysql

mysql -uroot -p1234 -e 'CREATE USER drupal@localhost IDENTIFIED BY "1234"'
mysql -uroot -p1234 -e 'CREATE DATABASE drupal'
mysql -uroot -p1234 -e 'GRANT ALL ON drupal.* TO drupal@localhost'
mysql -uroot -p1234 -e 'FLUSH PRIVILEGES'

Test php mysql

/var/www/htdocs/test.php

<?php
$servername = "127.0.0.1";
$user = "drupal";
$pass = "1234";
$conn = new mysqli($servername, $user, $pass);
if ($conn->connect_error) {
    die("Database Connection failed: " . $conn->connect_error);
}
echo "Database connected successfully, Congratulations ";
?>
curl http://localhost/test.php

HTTPD

S
Description
No description provided
Readme 0BSD
99 KiB
Languages
Shell 63.6%
Vim Script 36.4%