Category: FreeBSD

Post-installation Setup and Configuration

Post-installation Setup and Configuration

Colorized Directory Listings

Description:

Enable display of colors to directory contents listing for command ls and ll.

Configuration

Add two alias commands to file .profile for the user user with:

user@freebsdsrv:~ $ echo 'alias ll="ls -lGF"' | tee -a .profile ; sudo echo 'alias ls="ls -GF"' | tee -a .profile [enter]
alias ll="ls l-GF"
alias ls="ls -GF"
user@freebsdsrv:~ $

…and for root with:

user@freebsdsrv:~ $ sudo echo 'alias ll="ls -lGF"' | sudo tee -a /root/.profile ; sudo echo 'alias ls="ls -GF"' | sudo tee -a /root/.profile [enter]
alias ll="ls l-GF"
alias ls="ls -GF"
user@freebsdsrv:~ $
Log off your system with:
user@freebsdsrv:~ $ exit [enter]

…and then log in to the FreeBSD server and see colors as in this example:

user@freebsdsrv:~ $ ls -l /usr/local [enter]
drwxr-xr-x   2 root wheel 11 Jan 26 17:20 bin
drwxr-xr-x   6 root wheel 14 Jan 26 17:22 etc
drwxr-xr-x   3 root wheel  7 Jan 26 17:20 include
drwxr-xr-x   3 root wheel 14 Jan 26 17:20 lib
drwxr-xr-x   4 root wheel  4 Jan 26 17:20 libdata
drwxr-xr-x   3 root wheel  3 Jan 26 17:20 libexec
drwxr-xr-x   2 root wheel  7 Jan 26 17:20 sbin
drwxr-xr-x  10 root wheel 10 Jan 26 17:20 share
user@freebsdsrv:~ $

/boot/loader.conf

The file loader.conf contains descriptive information on bootstrapping the system. Through it, you can specify the kernel to be booted, parameters to be passed to it, and additional modules to be loaded; generally, set all variables described in loader(8).

By default, the delay before automatically booting is set to 10 seconds.
In this example, the delay is set to zero seconds with:

autoboot_delay=”0″!
Reset content and add autoboot_delay=”0″ to file /boot/loader.conf and verify entries to file /mnt/boot/loader.conf with:

user@freebsdsrv:~ $ sudo sh -c 'echo -e "autoboot_delay=\"0\"" >> /boot/loader.conf' ; cat /boot/loader.conf [enter]
geom_mirror_load="YES"
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
autoboot_delay="0"
user@freebsdsrv:~ $

/etc/hosts

The host file /etc/hosts contains information regarding the known hosts on the network.
This file provides a backup used when the name server is not running.
Only a few addresses should be included in this file. These include addresses for the local interfaces that ifconfig needs at boot time and a few machines on the local network.

user@freebsdsrv:~ $ sudo sh -c 'cat <<EOF > /etc/hosts
#
# Host Database
#
::1           localhost localhost.local.lan
127.0.0.1     localhost localhost.local.lan
192.168.1.50  freebsdsrv freebsdsrv.local.lan
EOF' ; cat /etc/hosts [enter]
#
# Host Database
#
::1           localhost localhost.local.lan
127.0.0.1     localhost localhost.local.lan
192.168.1.50  freebsdsrv freebsdsrv.local.lan
user@freebsdsrv:~ $

/etc/resolv.conf

The resolver configuration file contains information that is read by the resolver routines the first time a process invokes them. The file is designed to be human-readable and contains a list of keywords with values that provide various types of resolver information.

To configure the FreeBSD server as a DNS client, you need to edit or modify the /etc/resolv.conf file to define which name servers should use.

Display content of file /etc/resolv.conf with:

user@freebsdsrv:~ $ sudo sh -c 'cat <<EOF > /etc/resolv.conf
#
# Resolver Database
#
domain local.lan
nameserver 192.168.1.1
nameserver 208.67.222.222
nameserver 208.67.220.220
EOF' ; cat /etc/resolv.conf [enter]
#
# Resolver Database
#
domain local.lan
nameserver 192.168.1.1
nameserver 208.67.222.222
nameserver 208.67.220.220
user@freebsdsrv:~ $

Verify Configuration with:

ping

ping – send ICMP or ICMPv6 ECHO_REQUEST packets to network hosts.

user@freebsdsrv:~ $ ping -c 3 freebsdsrv.local.lan [enter]
PING freebsdsrv (192.168.1.50): 56 data bytes
64 bytes from 192.168.1.50: icmp_seq=0 ttl=64 time=0.036 ms
64 bytes from 192.168.1.50: icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from 192.168.1.50: icmp_seq=2 ttl=64 time=0.026 ms

--- freebsdsrv ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.026/0.031/0.036/0.004 ms
user@freebsdsrv:~ $
user@freebsdsrv:~ $ ping -c 3 freebsdsrv [enter]
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.056 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.047 ms

--- localhost ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.047/0.058/0.072/0.010 ms
user@freebsdsrv:~ $
drill

drill is a tool designed to get all sorts of information out of the DNS.

user@freebsdsrv:~ $ drill freebsd.org [enter]
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 31073
;; flags: qr rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 
;; QUESTION SECTION:
;; freebsd.org.	IN	A

;; ANSWER SECTION:
freebsd.org.	3600	IN	A	96.47.72.84

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 37 msec
;; SERVER: 192.168.1.1
;; WHEN: Fri Oct 28 13:35:22 2022
;; MSG SIZE  rcvd: 45
user@freebsdsrv:~ $

Networking restart

Network interface setup is done using the netif, and routing setup is done using the routing.

N.B.: Always restart the netif and routing services together to avoid lockdown issues!

The right way to restart networking services on FreeBSD is:

user@freebsdsrv:~ $ sudo service netif restart ; sudo service routing restart [enter]
Stopping Network: lo0 em0.
...
Starting Network: lo0 em0.
...
delete host 127.0.0.1: gateway lo0 fib 0: gateway uses the same route
delete net default: gateway 192.168.1.1 fib 0: not in table
delete host ::1: gateway lo0 fib 0: gateway uses the same route
delete net fe80::: gateway ::1
delete net ff02::: gateway ::1
delete net ::ffff:0.0.0.0: gateway ::1
delete net ::0.0.0.0: gateway ::1
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add net default: gateway 192.168.1.1
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
user@freebsdsrv:~ $
user@freebsdsrv:~ $

Log Console Messages To File

Configuration:

Enable all writes to /dev/console during boot to be logged to file /var/log/console.log with:

user@freebsdsrv:~ $ sudo sed -e 's/#console.info/console.info/' -i "" /etc/syslog.conf && cat /etc/syslog.conf | grep console.info [enter]
console.info					/var/log/console.log
user@freebsdsrv:~ $

Create file /var/log/console.log and then change file modes to mode 600 with:

user@freebsdsrv:~ $ sudo touch /var/log/console.log && sudo chmod -vv 600 /var/log/console.log [enter]
/var/log/console.log: 0100644 [-rw-r--r-- ] -> 0100600 [-rw------- ]
user@freebsdsrv:~ $

Restart syslogd to log all new console messages to file /var/log/console.log with:

user@freebsdsrv:~ $ sudo service syslogd restart [enter]
Stopping syslogd.
Waiting for PIDS: 808.
Starting syslogd.
user@freebsdsrv:~ $

A reboot is required to record all console messages on the system boot.
Reboot the system with:

user@freebsdsrv:~ $ sudo reboot [enter]
Connection to 192.168.1.50 closed by remote host.
Connection to 192.168.1.50 closed.

Wait for the system to reboot, then log back in with a remote SSH client session.

Display file /var/log/console.log with:

user@freebsdsrv:~ $ sudo cat /var/log/console.log [enter]

…and look for ERRORs and WARNINGs.

Display lines with word warning, error or critical in file /var/log/console.log with:

user@freebsdsrv:~ $ sudo cat /var/log/console.log | grep -E -wi 'warning|error|critical' [enter]
user@ freebsdsrv:~ $

If any errors and warnings are found, fix the problem and restart service syslogd as described above.

Create a FreeBSD-14.2-RELEASE-amd64 Install USB Memory Stick

Create a FreeBSD-14.2-RELEASE-amd64 Install USB Memory Stick

Requirements:

Required hardware: USB Memory Stick, minimum size 2 GB

Required software: sudo and wget

Download files

user@freebsdsrv:~ $ wget https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.2/FreeBSD-14.2-RELEASE-amd64-memstick.img [enter]
--2025-01-24 16:47:51--  https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.2/FreeBSD-14.2-RELEASE-amd64-memstick.img
Resolving download.freebsd.org (download.freebsd.org)... 85.30.190.138, 2a02:80:0:3ffd::15:1
Connecting to download.freebsd.org (download.freebsd.org)|85.30.190.138|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1559351808 (1.5G) [application/octet-stream]
Saving to: ‘FreeBSD-14.2-RELEASE-amd64-memstick.img’

FreeBSD-14.2-RELEAS 100%[===================>]   1.45G  93.8MB/s    in 16s     

2025-01-24 16:48:07 (91.1 MB/s) - ‘FreeBSD-14.2-RELEASE-amd64-memstick.img’ saved [1559351808/1559351808]

user@freebsdsrv:~ $
user@freebsdsrv:~ $ wget https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.2/CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-amd64 [enter]
--2025-01-24 16:49:55--  https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.2/CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-amd64
Resolving download.freebsd.org (download.freebsd.org)... 85.30.190.138, 2a02:80:0:3ffd::15:1
Connecting to download.freebsd.org (download.freebsd.org)|85.30.190.138|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1811 (1.8K) [application/octet-stream]
Saving to: ‘CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-amd64’

CHECKSUM.SHA512-Fre 100%[===================>]   1.77K  --.-KB/s    in 0s      

2025-01-24 16:49:55 (200 MB/s) - ‘CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-amd64’ saved [1811/1811]

user@freebsdsrv:~ $

Verify file checksum

user@freebsdsrv:~ % sha512sum --ignore-missing -c CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-amd64 [enter]
FreeBSD-14.2-RELEASE-amd64-memstick.img: OK
user@freebsdsrv:~ %

Prepare the USB Memory Stick

Insert the USB Memory Stick into a USB Port on the FreeBSD Computer.

N.B.: All Data on the USB Memory Stick will be lost!

Since USB devices are seen as a SCSI device, camcontrol can be used to list device information for the inserted USB Memory Stick with this command:

user@freebsdsrv:~ $ sudo camcontrol devlist [enter]
<KINGSTON SKC600MS1024G S4500105>  at scbus0 target 0 lun 0 (pass0,ada0)
<AHCI SGPIO Enclosure 2.00 0001>   at scbus1 target 0 lun 0 (ses0,pass1)
<Generic STORAGE DEVICE 9454>      at scbus2 target 0 lun 0 (da0,pass2)
<USB SanDisk 3.2Gen1 1.00>         at scbus3 target 0 lun 0 (da1,pass3)
user@freebsdsrv:~ %

…or show the list with:

user@freebsdsrv:~ % geom disk list [enter]
Geom name: ada0
Providers:
1. Name: ada0
   Mediasize: 1024209543168 (954G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r3w3e6
   descr: KINGSTON SKC600MS1024G
   lunid: 50026b7784547f24
   ident: 50026B7784547F24
   rotationrate: 0
   fwsectors: 63
   fwheads: 16

Geom name: da0
Providers:
1. Name: da0
   Mediasize: 15682240512 (15G)
   Sectorsize: 512
   Mode: r0w0e0
   descr: USB SanDisk 3.2Gen1
   lunname: USB     SanDisk 3.2Gen10401d35adeca736bcb13
   lunid: USB     SanDisk 3.2Gen10401d35adeca736bcb13
   ident: 0401d35adeca736bcb13031ed3ec52718ba62977e6bc9346b77babe3dc0b8413cbd00000000000000000000073fbf77f0096801881558107632a548f
   rotationrate: unknown
   fwsectors: 63
   fwheads: 255

user@freebsdsrv:~ %

In this example, SanDisk 3.2Gen1 registered as device da0 is the target USB Memory Stick.

Optional: Display information about device da0 with, for example:

user@freebsdsrv:~ % sudo diskinfo -v da0 [enter]
da1
	512         	# sectorsize
	15682240512 	# mediasize in bytes (15G)
	30629376    	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	1906        	# Cylinders according to firmware.
	255         	# Heads according to firmware.
	63          	# Sectors according to firmware.
	USB SanDisk 3.2Gen1	# Disk descr.
	0401d35adeca736bcb13031ed3ec52718ba62977e6bc9346b77babe3dc0b8413cbd00000000000000000000073fbf77f0096801881558107632a548f	# Disk ident.
	umass-sim1  	# Attachment
	No          	# TRIM/UNMAP support
	Unknown     	# Rotation rate in RPM
	Not_Zoned   	# Zone Mode

user@freebsdsrv:~ %

Optional: Show the current partition information of the USB Memory Stick using this command:

user@freebsdsrv:~ % gpart show da0 [enter]
=>      63  30629313  da1  MBR  (15G)
        63      1985       - free -  (993K)
      2048  30625792    1  ntfs  (15G)
  30627840      1536       - free -  (768K)

user@freebsdsrv:~ %

N.B.: Your USB Memory Stick may have a different layout than this example!

WARNING: The next step will delete all information on the USB Memory Stick!

Destroy the partitioning scheme on the USB Memory Stick with the following:

user@freebsdsrv:~ % sudo gpart destroy -F da0 [enter]
da1 destroyed
user@freebsdsrv:~ %

Copy the FreeBSD image file to the USB Memory Stick

The image file FreeBSD-14.2-RELEASE-amd64-memstick.img is copied to the USB Memory Stick with the dd utility with this command:

user@freebsdsrv:~ % sudo sh -c 'dd if=FreeBSD-14.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=4M conv=sync status=progress' [enter]
  1560281088 bytes (1560 MB, 1488 MiB) transferred 85.038s, 18 MB/s
372+0 records in
372+0 records out
1560281088 bytes transferred in 85.306856 secs (18290219 bytes/sec)
user@freebsdsrv:~ $

Delete downloaded files

user@freebsdsrv:~ % rm FreeBSD-14.2-*; rm CHECKSUM.SHA512-FreeBSD-14.2-* [enter]
user@freebsdsrv:~ %
Update USB Stick For Headless Server Installation

Update USB Stick For Headless Server Installation

List /dev setup on the USB stick da0 with:

user@freebsdsrv:~ $ ls /dev/da* [enter]
/dev/da0     /dev/da0s1   /dev/da0s2   /dev/da0s2a
user@freebsdsrv:~ $

In this example, /dev/da0s2a contains the FreeBSD-14.2-RELEASE-amd64 OS installation.

Mount /dev/da0s2a with read and write permissions on /mnt with:

user@freebsdsrv:~ $ sudo mount -o rw /dev/da0s2a /mnt [enter]
user@freebsdsrv:~ $

List directory contents of /mnt with:

user@freebsdsrv:~ $ ls -l /mnt [enter]
total 72
-r--r--r--   1 root wheel 6109 Nov 29 13:53 COPYRIGHT
drwxr-xr-x   2 root wheel 1024 Nov 29 13:51 bin
drwxr-xr-x  14 root wheel 1536 Nov 29 13:53 boot
dr-xr-xr-x   2 root wheel  512 Nov 29 13:50 dev
drwxr-xr-x  30 root wheel 2048 Nov 29 14:02 etc
drwxr-xr-x   4 root wheel 2048 Nov 29 13:51 lib
drwxr-xr-x   3 root wheel  512 Nov 29 13:50 libexec
drwxr-xr-x   2 root wheel  512 Nov 29 13:50 media
drwxr-xr-x   2 root wheel  512 Nov 29 13:50 mnt
drwxr-xr-x   2 root wheel  512 Nov 29 13:50 net
dr-xr-xr-x   2 root wheel  512 Nov 29 13:50 proc
drwxr-xr-x   2 root wheel  512 Nov 29 13:50 rescue
drwxr-x---   2 root wheel  512 Nov 29 13:53 root
drwxr-xr-x   2 root wheel 3072 Nov 29 13:51 sbin
drwxrwxrwt   2 root wheel  512 Nov 29 13:50 tmp
drwxr-xr-x  13 root wheel  512 Nov 29 13:53 usr
drwxr-xr-x  24 root wheel  512 Nov 29 13:50 var
user@freebsdsrv:~ $

Delete file /mnt/etc/rc.local with:

user@freebsdsrv:~ $ sudo rm /mnt/etc/rc.local [enter]
user@freebsdsrv:~ $

Update /etc/fstab

Update file fstab status from read-only to read-write with:

user@freebsdsrv:~ $ sudo sh -c 'sed -e "s/ro/rw/" -i "" /mnt/etc/fstab' ; cat /mnt/etc/fstab [enter]
/dev/ufs/FreeBSD_Install / ufs rw,noatime 1 1
user@freebsdsrv:~ $

Update /etc/rc.conf

Find a currently-unused IP address in your local network.
In this example, IP address 192.168.1.250 and netmask 255.255.255.0 will be hard-coded in file rc.conf.

user@freebsdsrv:~ $ sudo sh -c 'echo ifconfig_DEFAULT=\"inet 192.168.1.250 netmask 255.255.255.0\" >> /mnt/etc/rc.conf'; sudo sh -c 'echo defaultrouter=\"192.168.1.1\" >> /mnt/etc/rc.conf' ; sudo sh -c 'echo sshd_enable=\"YES\" >> /mnt/etc/rc.conf'; sudo sh -c 'echo keymap=\"se.kbd\" >> /mnt/etc/rc.conf'; cat /mnt/etc/rc.conf [enter]
sendmail_enable="NONE"
hostid_enable="NO"
ifconfig_DEFAULT="inet 192.168.1.250 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="YES"
keymap="se.kbd"
user@freebsdsrv:~ $

Update /boot/loader.conf

Add autoboot_delay=”0″ to file /mnt/boot/loader.conf and verify entries to file /mnt/boot/loader.conf with:

user@freebsdsrv:~ $ sudo sh -c 'echo -e "autoboot_delay=\"0\"" >> /mnt/boot/loader.conf' ; cat /mnt/boot/loader.conf  [enter]
vfs.mountroot.timeout="10"
kernels_autodetect="NO"
loader_menu_multi_user_prompt="Installer"
autoboot_delay="0"
user@freebsdsrv:~ $

Update /etc/ssh/sshd_config

user@freebsdsrv:~ $ sudo sed -e "s/#PermitRootLogin no/PermitRootLogin yes/" -i "" /mnt/etc/ssh/sshd_config ; sudo sed -e 's/#PasswordAuthentication no/PasswordAuthentication yes/' -i "" /mnt/etc/ssh/sshd_config ; sudo sed -e 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' -i "" /mnt/etc/ssh/sshd_config ; sudo sed -e 's/#UsePAM yes/UsePAM no/' -i "" /mnt/etc/ssh/sshd_config ; sudo sed -e 's/#UseDNS yes/UseDNS no/' -i "" /mnt/etc/ssh/sshd_config ; cat /mnt/etc/ssh/sshd_config [enter]
#	$OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

# Note that some of FreeBSD's defaults differ from OpenBSD's, and
# FreeBSD has a few additional options.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# Change to yes to enable built-in password authentication.
# Note that passwords may also be accepted via KbdInteractiveAuthentication.
PasswordAuthentication yes
PermitEmptyPasswords yes

# Change to no to disable PAM authentication
#KbdInteractiveAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'no' to disable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#UseBlacklist no
#VersionAddendum FreeBSD-20221019

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	/usr/libexec/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server
user@freebsdsrv:~ $
user@freebsdsrv:~ $ sudo umount /mnt [enter]
user@freebsdsrv:~ $

Insert the modified USB into the target machine, boot it, and wait for a minute or so. You should be able to SSH into it as root.

user@iMac ~ % ssh root@192.168.1.250 [enter]   
The authenticity of host '192.168.1.250 (192.168.1.250)' can't be established.
ED25519 key fingerprint is SHA256:fJc/6q4xKsatzWj5voqi/Pst6R3oPLZN0Tgrrnm2ujY.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes [enter]
Warning: Permanently added '192.168.1.250' (ED25519) to the list of known hosts.
FreeBSD 14.2-RELEASE (GENERIC) releng/14.2-n269506-c8918d6c7412

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List:        https://www.FreeBSD.org/lists/questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
root@:~ #

bsdinstall

Run bsdinstall to install FreeBSD on the target machine.

root@:~ # bsdinstall [enter]

bsdconfig

If you’ve already installed FreeBSD, you may use bsdconfig to customise the server to suit your particular configuration. Most importantly, you can use the Package utility to load extra ‘3rd party’ software not provided in the base distributions.

root@:~ # bsdconfig [enter]
Webmin & Usermin

Webmin & Usermin

Webmin

Description

Webmin is a web-based system administration tool for Unix-like servers and services, and it has about 1,000,000 installations worldwide yearly. Using it, it is possible to configure operating system internals, such as users, disk quotas, services, or configuration files, as well as modify and control open-source apps, such as BIND DNS Server, Apache HTTP Server, PHP, MySQL, and many more.

Required packages

Since Webmin will be installed outside the package manager, ensure the following recommended Perl modules and packages are present:
Perl modules:
– DateTime, DateTime::Locale, DateTime::TimeZone, Data::Dumper
– Digest::MD5, Digest::SHA, Encode::Detect, File::Basename
– File::Path, Net::SSLeay, Time::HiRes, Time::Local, Time::Piece
– lib, open
Packages:
– openssl – Cryptography library with TLS implementation
– shared-mime-info – Shared MIME information database
– tar gzip unzip – File compression and packaging utilities

Install required packages with:

user@freebsdsrv:~ $ sudo pkg install -y perl5 p5-DateTime-Locale p5-DateTime-TimeZone p5-Data-Dumper p5-Digest-MD5 p5-Digest-SHA p5-Encode-Detect p5-File-Path p5-JSON-XS p5-Time-HiRes p5-Time-Local p5-Time-Piece p5-Authen-PAM p5-Net-LDAP-Express p5-Net-SSLeay p5-IO-Tty gzip unzip shared-mime-info [enter]
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 77 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	glib: 2.80.5_1,2
	gzip: 1.13_1
	libffi: 3.4.6
	libiconv: 1.17_1
	libxml2: 2.11.9
	mpdecimal: 4.0.0
	p5-Algorithm-C3: 0.11
	p5-Authen-PAM: 0.16_2
	p5-Authen-SASL: 2.17_1
	p5-B-Hooks-EndOfScope: 0.28
	p5-Class-C3: 0.35
	p5-Class-Data-Inheritable: 0.10
	p5-Class-Inspector: 1.36
	p5-Class-Method-Modifiers: 2.15
	p5-Class-Singleton: 1.6
	p5-Clone: 0.47
	p5-Convert-ASN1: 0.34
	p5-Data-Dumper: 2.183
	p5-Data-OptList: 0.114
	p5-DateTime-Locale: 1.44
	p5-DateTime-TimeZone: 2.63,1
	p5-Devel-StackTrace: 2.05
	p5-Digest-HMAC: 1.05
	p5-Digest-MD5: 2.59
	p5-Digest-SHA: 6.04
	p5-Dist-CheckConflicts: 0.11_1
	p5-Encode-Detect: 1.01_1
	p5-Eval-Closure: 0.14
	p5-Exception-Class: 1.45
	p5-File-Path: 2.18
	p5-File-ShareDir: 1.118
	p5-IO-Socket-IP: 0.43
	p5-IO-Socket-SSL: 2.089
	p5-IO-Tty: 1.20_1
	p5-JSON-XS: 4.03
	p5-MRO-Compat: 0.15
	p5-Module-Implementation: 0.09_1
	p5-Module-Runtime: 0.016
	p5-Mozilla-CA: 20240924
	p5-Net-LDAP-Express: 0.12_1
	p5-Net-SSLeay: 1.94
	p5-Package-Stash: 0.40
	p5-Package-Stash-XS: 0.30
	p5-Params-Util: 1.102
	p5-Params-ValidationCompiler: 0.31
	p5-Role-Tiny: 2.002004
	p5-Specio: 0.49
	p5-Sub-Exporter: 0.991
	p5-Sub-Exporter-Progressive: 0.001013
	p5-Sub-Identify: 0.14
	p5-Sub-Install: 0.929
	p5-Sub-Quote: 2.006008_1
	p5-Text-Soundex: 3.05
	p5-Time-HiRes: 1.9764,1
	p5-Time-Local: 1.35
	p5-Time-Piece: 1.3300
	p5-Try-Tiny: 0.32
	p5-Types-Serialiser: 1.01
	p5-URI: 5.31
	p5-Variable-Magic: 0.64
	p5-XML-Filter-BufferText: 1.01_1
	p5-XML-NamespaceSupport: 1.12
	p5-XML-SAX: 1.02
	p5-XML-SAX-Base: 1.09
	p5-XML-SAX-Writer: 0.57
	p5-XString: 0.005
	p5-common-sense: 3.75
	p5-namespace-autoclean: 0.31
	p5-namespace-clean: 0.27
	p5-perl-ldap: 0.6800
	pcre2: 10.43
	perl5: 5.36.3_2
	py311-packaging: 24.2
	python311: 3.11.11
	readline: 8.2.13_2
	shared-mime-info: 2.4_1
	unzip: 6.0_8

Number of packages to be installed: 77

The process will require 347 MiB more space.
57 MiB to be downloaded.
[1/77] Fetching p5-Try-Tiny-0.32.pkg: 100%   18 KiB  18.2kB/s    00:01    
[2/77] Fetching p5-XML-SAX-1.02.pkg: 100%   46 KiB  47.4kB/s    00:01    
[3/77] Fetching p5-Digest-MD5-2.59.pkg: 100%   20 KiB  20.5kB/s    00:01    
[4/77] Fetching p5-Net-SSLeay-1.94.pkg: 100%  281 KiB 288.2kB/s    00:01    
[5/77] Fetching p5-Sub-Quote-2.006008_1.pkg: 100%   25 KiB  25.2kB/s    00:01    
[6/77] Fetching gzip-1.13_1.pkg: 100%  177 KiB 181.4kB/s    00:01    
[7/77] Fetching p5-IO-Socket-SSL-2.089.pkg: 100%  194 KiB 198.7kB/s    00:01    
[8/77] Fetching p5-B-Hooks-EndOfScope-0.28.pkg: 100%   19 KiB  19.7kB/s    00:01    
[9/77] Fetching p5-Algorithm-C3-0.11.pkg: 100%   11 KiB  11.1kB/s    00:01    
[10/77] Fetching mpdecimal-4.0.0.pkg: 100%  156 KiB 159.3kB/s    00:01    
[11/77] Fetching p5-Module-Runtime-0.016.pkg: 100%   16 KiB  16.6kB/s    00:01    
[12/77] Fetching p5-perl-ldap-0.6800.pkg: 100%  305 KiB 311.9kB/s    00:01    
[13/77] Fetching p5-Package-Stash-XS-0.30.pkg: 100%   16 KiB  16.9kB/s    00:01    
[14/77] Fetching p5-Net-LDAP-Express-0.12_1.pkg: 100%   14 KiB  14.1kB/s    00:01    
[15/77] Fetching p5-IO-Socket-IP-0.43.pkg: 100%   29 KiB  29.3kB/s    00:01    
[16/77] Fetching p5-URI-5.31.pkg: 100%  101 KiB 103.0kB/s    00:01    
[17/77] Fetching p5-Digest-SHA-6.04.pkg: 100%   38 KiB  38.8kB/s    00:01    
[18/77] Fetching p5-Module-Implementation-0.09_1.pkg: 100%   10 KiB  10.2kB/s    00:01    
[19/77] Fetching p5-Params-Util-1.102.pkg: 100%   19 KiB  19.2kB/s    00:01    
[20/77] Fetching p5-Package-Stash-0.40.pkg: 100%   21 KiB  21.6kB/s    00:01    
[21/77] Fetching unzip-6.0_8.pkg: 100%  140 KiB 143.2kB/s    00:01    
[22/77] Fetching p5-Class-Method-Modifiers-2.15.pkg: 100%   19 KiB  19.1kB/s    00:01    
[23/77] Fetching p5-Data-OptList-0.114.pkg: 100%   14 KiB  14.4kB/s    00:01    
[24/77] Fetching p5-Class-Inspector-1.36.pkg: 100%   19 KiB  19.9kB/s    00:01    
[25/77] Fetching p5-XML-NamespaceSupport-1.12.pkg: 100%   17 KiB  17.0kB/s    00:01    
[26/77] Fetching pcre2-10.43.pkg: 100%    1 MiB   1.5MB/s    00:01    
[27/77] Fetching p5-Clone-0.47.pkg: 100%   11 KiB  11.3kB/s    00:01    
[28/77] Fetching p5-File-Path-2.18.pkg: 100%   25 KiB  26.0kB/s    00:01    
[29/77] Fetching libiconv-1.17_1.pkg: 100%  734 KiB 751.9kB/s    00:01    
[30/77] Fetching p5-XString-0.005.pkg: 100%   13 KiB  12.9kB/s    00:01    
[31/77] Fetching p5-Params-ValidationCompiler-0.31.pkg: 100%   21 KiB  21.8kB/s    00:01    
[32/77] Fetching p5-Time-Local-1.35.pkg: 100%   19 KiB  19.4kB/s    00:01    
[33/77] Fetching p5-Time-Piece-1.3300.pkg: 100%   31 KiB  31.8kB/s    00:01    
[34/77] Fetching p5-Types-Serialiser-1.01.pkg: 100%   12 KiB  12.7kB/s    00:01    
[35/77] Fetching p5-Class-Singleton-1.6.pkg: 100%   12 KiB  12.3kB/s    00:01    
[36/77] Fetching p5-Encode-Detect-1.01_1.pkg: 100%   81 KiB  82.9kB/s    00:01    
[37/77] Fetching p5-Authen-SASL-2.17_1.pkg: 100%   41 KiB  42.4kB/s    00:01    
[38/77] Fetching p5-Dist-CheckConflicts-0.11_1.pkg: 100%   10 KiB  10.4kB/s    00:01    
[39/77] Fetching libxml2-2.11.9.pkg: 100%  872 KiB 893.4kB/s    00:01    
[40/77] Fetching p5-DateTime-Locale-1.44.pkg: 100%    3 MiB   3.4MB/s    00:01    
[41/77] Fetching p5-Sub-Install-0.929.pkg: 100%   14 KiB  14.7kB/s    00:01    
[42/77] Fetching p5-XML-Filter-BufferText-1.01_1.pkg: 100%    7 KiB   7.0kB/s    00:01    
[43/77] Fetching p5-namespace-autoclean-0.31.pkg: 100%   11 KiB  10.9kB/s    00:01    
[44/77] Fetching p5-Time-HiRes-1.9764,1.pkg: 100%   29 KiB  30.0kB/s    00:01    
[45/77] Fetching py311-packaging-24.2.pkg: 100%  127 KiB 129.9kB/s    00:01    
[46/77] Fetching p5-Variable-Magic-0.64.pkg: 100%   33 KiB  33.4kB/s    00:01    
[47/77] Fetching p5-Class-Data-Inheritable-0.10.pkg: 100%    8 KiB   8.1kB/s    00:01    
[48/77] Fetching p5-Data-Dumper-2.183.pkg: 100%   41 KiB  42.4kB/s    00:01    
[49/77] Fetching p5-Sub-Exporter-0.991.pkg: 100%   53 KiB  53.9kB/s    00:01    
[50/77] Fetching glib-2.80.5_1,2.pkg: 100%    4 MiB   4.3MB/s    00:01    
[51/77] Fetching p5-Convert-ASN1-0.34.pkg: 100%   35 KiB  35.7kB/s    00:01    
[52/77] Fetching p5-Authen-PAM-0.16_2.pkg: 100%   24 KiB  24.6kB/s    00:01    
[53/77] Fetching p5-Role-Tiny-2.002004.pkg: 100%   20 KiB  20.5kB/s    00:01    
[54/77] Fetching p5-Exception-Class-1.45.pkg: 100%   28 KiB  28.6kB/s    00:01    
[55/77] Fetching perl5-5.36.3_2.pkg: 100%   15 MiB  16.1MB/s    00:01    
[56/77] Fetching p5-namespace-clean-0.27.pkg: 100%   13 KiB  13.7kB/s    00:01    
[57/77] Fetching p5-Sub-Identify-0.14.pkg: 100%   10 KiB  10.5kB/s    00:01    
[58/77] Fetching p5-JSON-XS-4.03.pkg: 100%   81 KiB  83.3kB/s    00:01    
[59/77] Fetching p5-Mozilla-CA-20240924.pkg: 100%  129 KiB 132.3kB/s    00:01    
[60/77] Fetching p5-Sub-Exporter-Progressive-0.001013.pkg: 100%   12 KiB  11.8kB/s    00:01    
[61/77] Fetching p5-Specio-0.49.pkg: 100%  129 KiB 132.1kB/s    00:01    
[62/77] Fetching libffi-3.4.6.pkg: 100%   45 KiB  46.0kB/s    00:01    
[63/77] Fetching readline-8.2.13_2.pkg: 100%  397 KiB 406.3kB/s    00:01    
[64/77] Fetching p5-Digest-HMAC-1.05.pkg: 100%   15 KiB  15.5kB/s    00:01    
[65/77] Fetching p5-MRO-Compat-0.15.pkg: 100%   11 KiB  11.0kB/s    00:01    
[66/77] Fetching p5-common-sense-3.75.pkg: 100%    8 KiB   8.6kB/s    00:01    
[67/77] Fetching shared-mime-info-2.4_1.pkg: 100%  631 KiB 645.7kB/s    00:01    
[68/77] Fetching p5-XML-SAX-Writer-0.57.pkg: 100%   22 KiB  22.9kB/s    00:01    
[69/77] Fetching p5-Devel-StackTrace-2.05.pkg: 100%   18 KiB  18.9kB/s    00:01    
[70/77] Fetching p5-File-ShareDir-1.118.pkg: 100%   18 KiB  18.8kB/s    00:01    
[71/77] Fetching p5-Class-C3-0.35.pkg: 100%   19 KiB  19.2kB/s    00:01    
[72/77] Fetching p5-DateTime-TimeZone-2.63,1.pkg: 100%  260 KiB 266.2kB/s    00:01    
[73/77] Fetching p5-Text-Soundex-3.05.pkg: 100%   17 KiB  17.8kB/s    00:01    
[74/77] Fetching python311-3.11.11.pkg: 100%   27 MiB  28.0MB/s    00:01    
[75/77] Fetching p5-XML-SAX-Base-1.09.pkg: 100%   25 KiB  25.2kB/s    00:01    
[76/77] Fetching p5-Eval-Closure-0.14.pkg: 100%   11 KiB  11.0kB/s    00:01    
[77/77] Fetching p5-IO-Tty-1.20_1.pkg: 100%   30 KiB  30.9kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/77] Installing perl5-5.36.3_2...
[1/77] Extracting perl5-5.36.3_2: 100%
[2/77] Installing p5-Params-Util-1.102...
[2/77] Extracting p5-Params-Util-1.102: 100%
[3/77] Installing p5-Sub-Install-0.929...
[3/77] Extracting p5-Sub-Install-0.929: 100%
[4/77] Installing p5-Data-OptList-0.114...
[4/77] Extracting p5-Data-OptList-0.114: 100%
[5/77] Installing p5-Try-Tiny-0.32...
[5/77] Extracting p5-Try-Tiny-0.32: 100%
[6/77] Installing p5-Module-Runtime-0.016...
[6/77] Extracting p5-Module-Runtime-0.016: 100%
[7/77] Installing p5-XML-NamespaceSupport-1.12...
[7/77] Extracting p5-XML-NamespaceSupport-1.12: 100%
[8/77] Installing p5-Sub-Exporter-0.991...
[8/77] Extracting p5-Sub-Exporter-0.991: 100%
[9/77] Installing p5-XML-SAX-Base-1.09...
[9/77] Extracting p5-XML-SAX-Base-1.09: 100%
[10/77] Installing p5-XML-SAX-1.02...
[10/77] Extracting p5-XML-SAX-1.02: 100%
could not find ParserDetails.ini in /usr/local/lib/perl5/site_perl/XML/SAX
[11/77] Installing p5-Algorithm-C3-0.11...
[11/77] Extracting p5-Algorithm-C3-0.11: 100%
[12/77] Installing mpdecimal-4.0.0...
[12/77] Extracting mpdecimal-4.0.0: 100%
[13/77] Installing p5-Package-Stash-XS-0.30...
[13/77] Extracting p5-Package-Stash-XS-0.30: 100%
[14/77] Installing p5-Module-Implementation-0.09_1...
[14/77] Extracting p5-Module-Implementation-0.09_1: 100%
[15/77] Installing p5-Dist-CheckConflicts-0.11_1...
[15/77] Extracting p5-Dist-CheckConflicts-0.11_1: 100%
[16/77] Installing p5-Variable-Magic-0.64...
[16/77] Extracting p5-Variable-Magic-0.64: 100%
[17/77] Installing p5-Sub-Exporter-Progressive-0.001013...
[17/77] Extracting p5-Sub-Exporter-Progressive-0.001013: 100%
[18/77] Installing libffi-3.4.6...
[18/77] Extracting libffi-3.4.6: 100%
[19/77] Installing readline-8.2.13_2...
[19/77] Extracting readline-8.2.13_2: 100%
[20/77] Installing p5-Net-SSLeay-1.94...
[20/77] Extracting p5-Net-SSLeay-1.94: 100%
[21/77] Installing p5-B-Hooks-EndOfScope-0.28...
[21/77] Extracting p5-B-Hooks-EndOfScope-0.28: 100%
[22/77] Installing p5-IO-Socket-IP-0.43...
[22/77] Extracting p5-IO-Socket-IP-0.43: 100%
[23/77] Installing p5-Package-Stash-0.40...
[23/77] Extracting p5-Package-Stash-0.40: 100%
[24/77] Installing p5-Class-Method-Modifiers-2.15...
[24/77] Extracting p5-Class-Method-Modifiers-2.15: 100%
[25/77] Installing p5-XString-0.005...
[25/77] Extracting p5-XString-0.005: 100%
[26/77] Installing p5-XML-Filter-BufferText-1.01_1...
[26/77] Extracting p5-XML-Filter-BufferText-1.01_1: 100%
[27/77] Installing p5-Class-Data-Inheritable-0.10...
[27/77] Extracting p5-Class-Data-Inheritable-0.10: 100%
[28/77] Installing p5-Mozilla-CA-20240924...
[28/77] Extracting p5-Mozilla-CA-20240924: 100%
[29/77] Installing p5-Digest-HMAC-1.05...
[29/77] Extracting p5-Digest-HMAC-1.05: 100%
[30/77] Installing p5-Devel-StackTrace-2.05...
[30/77] Extracting p5-Devel-StackTrace-2.05: 100%
[31/77] Installing p5-Class-C3-0.35...
[31/77] Extracting p5-Class-C3-0.35: 100%
[32/77] Installing python311-3.11.11...
[32/77] Extracting python311-3.11.11: 100%
[33/77] Installing p5-Sub-Quote-2.006008_1...
[33/77] Extracting p5-Sub-Quote-2.006008_1: 100%
[34/77] Installing p5-IO-Socket-SSL-2.089...
[34/77] Extracting p5-IO-Socket-SSL-2.089: 100%
[35/77] Installing p5-URI-5.31...
[35/77] Extracting p5-URI-5.31: 100%
[36/77] Installing p5-Class-Inspector-1.36...
[36/77] Extracting p5-Class-Inspector-1.36: 100%
[37/77] Installing pcre2-10.43...
[37/77] Extracting pcre2-10.43: 100%
[38/77] Installing p5-Clone-0.47...
[38/77] Extracting p5-Clone-0.47: 100%
[39/77] Installing libiconv-1.17_1...
[39/77] Extracting libiconv-1.17_1: 100%
[40/77] Installing p5-Authen-SASL-2.17_1...
[40/77] Extracting p5-Authen-SASL-2.17_1: 100%
[41/77] Installing py311-packaging-24.2...
[41/77] Extracting py311-packaging-24.2: 100%
[42/77] Installing p5-Convert-ASN1-0.34...
[42/77] Extracting p5-Convert-ASN1-0.34: 100%
[43/77] Installing p5-Role-Tiny-2.002004...
[43/77] Extracting p5-Role-Tiny-2.002004: 100%
[44/77] Installing p5-Exception-Class-1.45...
[44/77] Extracting p5-Exception-Class-1.45: 100%
[45/77] Installing p5-namespace-clean-0.27...
[45/77] Extracting p5-namespace-clean-0.27: 100%
[46/77] Installing p5-Sub-Identify-0.14...
[46/77] Extracting p5-Sub-Identify-0.14: 100%
[47/77] Installing p5-MRO-Compat-0.15...
[47/77] Extracting p5-MRO-Compat-0.15: 100%
[48/77] Installing p5-common-sense-3.75...
[48/77] Extracting p5-common-sense-3.75: 100%
[49/77] Installing p5-XML-SAX-Writer-0.57...
[49/77] Extracting p5-XML-SAX-Writer-0.57: 100%
[50/77] Installing p5-Text-Soundex-3.05...
[50/77] Extracting p5-Text-Soundex-3.05: 100%
[51/77] Installing p5-Eval-Closure-0.14...
[51/77] Extracting p5-Eval-Closure-0.14: 100%
[52/77] Installing p5-perl-ldap-0.6800...
[52/77] Extracting p5-perl-ldap-0.6800: 100%
[53/77] Installing p5-Params-ValidationCompiler-0.31...
[53/77] Extracting p5-Params-ValidationCompiler-0.31: 100%
[54/77] Installing p5-Types-Serialiser-1.01...
[54/77] Extracting p5-Types-Serialiser-1.01: 100%
[55/77] Installing p5-Class-Singleton-1.6...
[55/77] Extracting p5-Class-Singleton-1.6: 100%
[56/77] Installing libxml2-2.11.9...
[56/77] Extracting libxml2-2.11.9: 100%
[57/77] Installing p5-namespace-autoclean-0.31...
[57/77] Extracting p5-namespace-autoclean-0.31: 100%
[58/77] Installing glib-2.80.5_1,2...
[58/77] Extracting glib-2.80.5_1,2: 100%
[59/77] Installing p5-Specio-0.49...
[59/77] Extracting p5-Specio-0.49: 100%
[60/77] Installing p5-File-ShareDir-1.118...
[60/77] Extracting p5-File-ShareDir-1.118: 100%
[61/77] Installing p5-Digest-MD5-2.59...
[61/77] Extracting p5-Digest-MD5-2.59: 100%
[62/77] Installing gzip-1.13_1...
[62/77] Extracting gzip-1.13_1: 100%
[63/77] Installing p5-Net-LDAP-Express-0.12_1...
[63/77] Extracting p5-Net-LDAP-Express-0.12_1: 100%
[64/77] Installing p5-Digest-SHA-6.04...
[64/77] Extracting p5-Digest-SHA-6.04: 100%
[65/77] Installing unzip-6.0_8...
[65/77] Extracting unzip-6.0_8: 100%
[66/77] Installing p5-File-Path-2.18...
[66/77] Extracting p5-File-Path-2.18: 100%
[67/77] Installing p5-Time-Local-1.35...
[67/77] Extracting p5-Time-Local-1.35: 100%
[68/77] Installing p5-Time-Piece-1.3300...
[68/77] Extracting p5-Time-Piece-1.3300: 100%
[69/77] Installing p5-Encode-Detect-1.01_1...
[69/77] Extracting p5-Encode-Detect-1.01_1: 100%
[70/77] Installing p5-DateTime-Locale-1.44...
[70/77] Extracting p5-DateTime-Locale-1.44: 100%
[71/77] Installing p5-Time-HiRes-1.9764,1...
[71/77] Extracting p5-Time-HiRes-1.9764,1: 100%
[72/77] Installing p5-Data-Dumper-2.183...
[72/77] Extracting p5-Data-Dumper-2.183: 100%
[73/77] Installing p5-Authen-PAM-0.16_2...
[73/77] Extracting p5-Authen-PAM-0.16_2: 100%
[74/77] Installing p5-JSON-XS-4.03...
[74/77] Extracting p5-JSON-XS-4.03: 100%
[75/77] Installing shared-mime-info-2.4_1...
[75/77] Extracting shared-mime-info-2.4_1: 100%
[76/77] Installing p5-DateTime-TimeZone-2.63,1...
[76/77] Extracting p5-DateTime-TimeZone-2.63,1: 100%
[77/77] Installing p5-IO-Tty-1.20_1...
[77/77] Extracting p5-IO-Tty-1.20_1: 100%
==> Running trigger: gio-modules.ucl
Generating GIO modules cache
==> Running trigger: glib-schemas.ucl
Compiling glib schemas
No schema files found: doing nothing.
==> Running trigger: shared-mime-info.ucl
Building the Shared MIME-Info database cache
=====
Message from python311-3.11.11:

--
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

py311-gdbm       databases/py-gdbm@py311
py311-sqlite3    databases/py-sqlite3@py311
py311-tkinter    x11-toolkits/py-tkinter@py311
user@freebsdsrv:~ $

Download Webmin Code

Download the current version of the Webmin code with:

user@freebsdsrv:~ $ fetch https://github.com/webmin/webmin/releases/download/2.202/webmin-2.202.tar.gz [enter]
webmin-2.202.tar.gz                                   44 MB   27 MBps    02s
user@freebsdsrv:~ $

Extract the Webmin code

user@freebsdsrv:~ $ tar zxvf webmin-2.202.tar.gz [enter]
x webmin-2.202/
x webmin-2.202/acl/
x webmin-2.202/acl/module.info.fi
...
x webmin-2.202/change-user/module.info.pt_BR.auto
x webmin-2.202/password_change.cgi
x webmin-2.202/config-irix
user@freebsdsrv:~ $

Webmin setup

Create directory /usr/local/etc/rc.d with:

user@freebsdsrv:~ $ sudo mkdir /usr/local/etc/rc.d [enter]
user@freebsdsrv:~ $

Change directory to the Webmin installation directory with:

user@freebsdsrv:~ $ cd webmin-2.202 [enter]
user@freebsdsrv:~/webmin-2.202 $

Run the Webmin installtion script with:

user@freebsdsrv:~/webmin-2.202 $ sudo ./setup.sh /usr/local/webmin [enter]
****************************************************************************
           Welcome to the Webmin setup script, version 2.202
****************************************************************************
Webmin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.

Installing Webmin from /home/user/webmin-2.202 to /usr/local/webmin

****************************************************************************
Webmin uses separate directories for configuration files and log files.
Unless you want to run multiple versions of Webmin at the same time
you can just accept the defaults.

Config file directory [/etc/webmin]: [enter]
Log file directory [/var/webmin]: [enter]

****************************************************************************
Webmin is written entirely in Perl. Please enter the full path to the
Perl 5 interpreter on your system.

Full path to perl (default /usr/local/bin/perl): [enter]

Testing Perl ..
.. done

****************************************************************************
Operating system name:    FreeBSD
Operating system version: 14.2

****************************************************************************
Webmin uses its own password protected web server to provide access
to the administration programs. The setup script needs to know :
 - What port to run the web server on. There must not be another
   web server already using this port.
 - The login name required to access the web server.
 - The password required to access the web server.
 - If the web server should use SSL (if your system supports it).
 - Whether to start webmin at boot time.

Web server port (default 10000): [enter]
Login name (default admin): [enter]
Login password: AdminPassWd [enter]
Password again: AdminPassWd [enter]
Use SSL (y/n): y [enter]
Start Webmin at boot time (y/n): y [enter]

****************************************************************************
Copying files to /usr/local/webmin ..
.. done

Creating web server config files ..
.. done

Creating access control file ..
.. done

Inserting path to perl into scripts ..
.. done

Creating start and stop scripts ..
.. done

Copying config files ..
.. done

Configuring Webmin to start at boot time ..
.. done

Creating uninstall script /usr/local/etc/webmin/uninstall.sh ..
.. done

Changing ownership and permissions ..
.. done

Running postinstall scripts ..
.. done

Enabling background status collection ..
.. done

Attempting to start Webmin web server ..
.. done

****************************************************************************
Webmin has been installed and started successfully.

Since Webmin was installed outside the package manager, ensure the
following recommended Perl modules and packages are present:
 Perl modules:
  - DateTime, DateTime::Locale, DateTime::TimeZone, Data::Dumper
  - Digest::MD5, Digest::SHA, Encode::Detect, File::Basename
  - File::Path, Net::SSLeay, Time::HiRes, Time::Local, Time::Piece
  - lib, open
 Packages:
  - openssl - Cryptography library with TLS implementation
  - shared-mime-info - Shared MIME information database
  - tar gzip unzip - File compression and packaging utilities

Use your web browser to go to the following URL and login
with the name and password you entered previously:

  https://freebsdsrv:10000

Because Webmin uses SSL for encryption only, the certificate
it uses is not signed by one of the recognized CAs such as
Verisign. When you first connect to the Webmin server, your
browser will ask you if you want to accept the certificate
presented, as it does not recognize the CA. Say yes.

user@freebsdsrv:~/webmin-2.202 $

Change directory with:

user@freebsdsrv:~/webmin-2.202 $ cd [enter]
user@freebsdsrv:~ $

Configure permissions for access to the Webmin service with:

user@freebsdsrv:~ $ sudo sh -c 'echo -e "allow=127.0.0.1 192.168.1.0/24" >> /etc/webmin/miniserv.conf' ; sudo cat /etc/webmin/miniserv.conf [enter] 
port=10000
root=/usr/local/webmin
mimetypes=/usr/local/webmin/mime.types
addtype_cgi=internal/cgi
realm=Webmin Server
logfile=/var/log/webmin/miniserv.log
errorlog=/var/log/webmin/miniserv.error
pidfile=/var/log/webmin/miniserv.pid
logtime=168
ssl=0
no_ssl2=1
no_ssl3=1
ssl_honorcipherorder=1
no_sslcompression=1
env_WEBMIN_CONFIG=/usr/local/etc/webmin
env_WEBMIN_VAR=/var/log/webmin
atboot=1
logout=/usr/local/etc/webmin/logout-flag
listen=10000
denyfile=\.pl$
log=1
blockhost_failures=5
blockhost_time=60
syslog=1
ipv6=1
session=1
premodules=WebminCore
server=MiniServ/2.202
userfile=/usr/local/etc/webmin/miniserv.users
keyfile=/usr/local/etc/webmin/miniserv.pem
passwd_file=/etc/master.passwd
passwd_uindex=0
passwd_pindex=1
passwd_mode=0
preroot=authentic-theme
passdelay=1
logout_script=/usr/local/etc/webmin/logout.pl
cipher_list_def=1
login_script=/usr/local/etc/webmin/login.pl
failed_script=/usr/local/etc/webmin/failed.pl
allow=127.0.0.1 192.168.1.0/24
user@freebsdsrv:~ $

Restart the Webmin service with:

user@freebsdsrv:~ $ sudo service webmin.sh restart [enter]
Stopping Webmin server in /usr/local/webmin
Starting Webmin server in /usr/local/webmin
user@freebsdsrv:~ $

The Webmin service should be listening on port 10000. Verify this with:

user@freebsdsrv:~ $ sudo sockstat -4 -6 | grep 10000 [enter]
root     perl        3724 5   tcp4   *:10000               *:*
root     perl        3724 6   udp4   *:10000               *:*
user@freebsdsrv:~ $

You can now access the Webmin service at https://192.168.1.50:10000/ from a client computer in the network you allowed. When the Webmin login form is displayed, log in as the admin user you set during the installation.

Delete downloaded file

user@freebsdsrv:~ $ rm -R webmin-* [enter]
user@freebsdsrv:~ $

Usermin

Usermin is a web-based interface for webmail, password changing, mail filters, fetchmail and much more. It is designed for use by regular non-root users on a Unix system, and limits them to tasks that they would be able to perform if logged in via SSH or at the console.

Most users of Usermin are sysadmins looking for a simple webmail interface to offer their customers. Unlike most other webmail solutions, it can be used to change passwords, read email with no additional servers installed (like IMAP or POP3), and setup users’ configurations for forwarding, spam filtering and autoreponders.

Download Usermin Code

Download the current version of the Userbmin code with:

user@freebsdsrv:~ $ fetch https://github.com/webmin/usermin/releases/download/2.102/usermin-2.102.tar.gz [enter]
usermin-2.102.tar.gz                                    17 MB   36 MBps    00s
user@freebsdsrv:~ $

Extract the Usermin code

user@freebsdsrv:~ $ tar zxvf usermin-2.102.tar.gz [enter]
x usermin-2.102/
x usermin-2.102/update-from-repo.sh
x usermin-2.102/forward/
...
x usermin-2.102/ui-lib.pl
x usermin-2.102/password_change.cgi
x usermin-2.102/config-irix
user@freebsdsrv:~ $

Usermin setup

Change the directory to the Webmin installation directory with:

user@freebsdsrv:~ $ cd usermin-2.102 [enter]
user@freebsdsrv:~/usermin-2.102 $

Run the Userbmin installation script with:

user@freebsdsrv:~/usermin-2.102 $ sudo ./setup.sh /usr/local/usermin [enter]
****************************************************************************
          Welcome to the Usermin setup script, version 2.102
****************************************************************************
Usermin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.

Installing Usermin from /root/usermin-2.102 to /usr/local/usermin

****************************************************************************
Usermin uses separate directories for configuration files and log files.
Unless you want to run multiple versions of Usermin at the same time
you can just accept the defaults.

Config file directory [/etc/usermin]: [enter]
Log file directory [/var/usermin]: [enter]

****************************************************************************
Usermin is written entirely in Perl. Please enter the full path to the
Perl 5 interpreter on your system.

Full path to perl (default /usr/local/bin/perl): [enter]

Testing Perl ..
.. done

****************************************************************************
Operating system name:    FreeBSD
Operating system version: 14.2

****************************************************************************
Usermin uses its own password protected web server to provide access
to the administration programs. The setup script needs to know :
 - What port to run the web server on. There must not be another
   web server already using this port.
 - If the web server should use SSL (if your system supports it).

Web server port (default 20000): [enter]

Use SSL (y/n): y [enter]
****************************************************************************
Copying files to /usr/local/usermin ..
.. done

Creating web server config files ..
.. done

Creating access control file ..
.. done

Inserting path to perl into scripts ..
.. done

Creating start and stop init scripts ..
.. done

Creating start and stop init symlinks to scripts ..
.. done

Copying config files ..
.. done

Creating uninstall script /usr/local/etc/usermin/uninstall.sh ..
.. done

Changing ownership and permissions ..
.. done

Attempting to start Usermin web server ..
.. done

****************************************************************************
Usermin has been installed and started successfully.

Since Usermin was installed outside the package manager, ensure the
following recommended Perl modules and packages are present:
 Perl modules:
  - DateTime, DateTime::Locale, DateTime::TimeZone, Data::Dumper
  - Digest::MD5, Digest::SHA, Encode::Detect, File::Basename
  - File::Path, Net::SSLeay, Time::HiRes, Time::Local, Time::Piece
  - lib, open
 Packages:
  - openssl - Cryptography library with TLS implementation
  - shared-mime-info - Shared MIME information database
  - tar gzip unzip - File compression and packaging utilities

Use your web browser to go to the following URL and login
with the name and password you entered previously:

  http://freebsdsrv:20000

user@freebsdsrv:~/usermin-2.102 $

Change directory with:

user@freebsdsrv:~/usermin-2.102 $ cd [enter]
user@freebsdsrv:~ $

Enable Usermin to start on system boot with:

user@freebsdsrv:~ $ sudo sysrc usermin_enable="YES" [enter]
usermin_enable: -> YES
user@freebsdsrv:~ $

Configure permissions for access to the Usermin service with:

user@freebsdsrv:~ $ sudo sh -c 'echo -e "allow=127.0.0.1 192.168.1.0/24" >> /etc/usermin/miniserv.conf' ; sudo cat /etc/usermin/miniserv.conf [enter]
port=20000
root=/usr/local/usermin
mimetypes=/usr/local/usermin/mime.types
addtype_cgi=internal/cgi
realm=Usermin Server
logfile=/var/usermin/miniserv.log
errorlog=/var/usermin/miniserv.error
pidfile=/var/usermin/miniserv.pid
logtime=168
ppath=
ssl=1
no_ssl2=1
no_ssl3=1
env_WEBMIN_CONFIG=/etc/usermin
env_WEBMIN_VAR=/var/usermin
atboot=
logout=/etc/usermin/logout-flag
listen=20000
denyfile=\.pl$
log=1
blockhost_failures=5
blockhost_time=60
session=1
unixauth=user
pam=usermin
premodules=WebminCore
server=MiniServ/2.102
userfile=/etc/usermin/miniserv.users
keyfile=/etc/usermin/miniserv.pem
passwd_file=/etc/master.passwd
passwd_uindex=0
passwd_pindex=1
passwd_mode=2
sidname=usid
preroot=authentic-theme
passdelay=1
allow=127.0.0.1 192.168.1.0/24
user@freebsdsrv:~ $

The Usermin service should be listening on port 20000. Verify this with:

user@freebsdsrv:~ $ sudo sockstat -4 -6 | grep 20000 [enter]
root     perl        4619 4   tcp4   *:20000               *:*
root     perl        4619 5   udp4   *:20000               *:*
user@freebsdsrv:~ $

You can now access the Usermin service at https://192.168.1.50:20000/ from a client computer in the network you allowed. When the Usermin login form is displayed, log in as a local FreeBSD Server user.

Delete downloaded file

user@freebsdsrv:~ $ rm -R usermin-* [enter]
user@freebsdsrv:~ $
tftp-hpa – BSD derived TFTP Server

tftp-hpa – BSD derived TFTP Server

Description

tftp-hpa is portable, BSD derived tftp server. It supports advanced options such as blksize, blksize2, tsize, timeout, and utimeout. It also supported rule-based security options.

Requirements

The following application(s) must be installed, configured and running before tftp-hpa is installed:

  • None

Preparation for Installation

Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.

In this example Terminal on a Mac is used.

Open a remote SSH session to the server with:

Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#

N.B.: Enter user password, not the root password!

Installation

Search for tftp in the remote package repositories with:

[root@server /usr/home/user]# pkg search tftp  [enter]
atftp-0.7_3                    Advanced tftp server and client
nagios-check_tftp-1.0.1        Nagios plugin to check tftp servers
p5-TFTP-1.0                    TFTP client in Perl as described in RFC783
py27-tftpy-0.6.2               Pure Python TFTP Implementation
tftp-hpa-5.2                   Advanced tftp server
tftpgrab-0.2                   TFTP stream extractor
utftpd-0.2.4_2                 secure tftpd server with fine grained access and revision control
[root@server /usr/home/user]##

In this example, tftp-hpa will be installed.

Install port tftp-hpa with;

[root@server /usr/home/user]# pkg install tftp-hpa [enter]
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	tftp-hpa: 5.2

Number of packages to be installed: 1

38 KiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
Fetching tftp-hpa-5.2.txz: 100%   38 KiB  39.3kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing tftp-hpa-5.2...
[1/1] Extracting tftp-hpa-5.2: 100%
[root@server /usr/home/user]#

Configuration

packet filter (pf)

Access to the tftpd service must be enabled in the packet filter (pf) configuration file.

Start editing file /etc/pf.conf with:

[root@server /usr/home/user]# ee /etc/pf.conf [enter]

…and add port information to enable access to the TFTP service from clients on the local network as in this example:

...
# Ports:
#  53 TCP UDP   Domain Name System (DNS)
#  67 TCP UDP	Bootstrap Protocol (BOOTP) server
#  69 TCP UDP   Trivial File Transfer Protocol (TFTP)
# 123 TCP       Network Time Protocol
...
tcp_pass="{ 53,  67, 69, 123 }"
udp_pass="{ 53,  67, 69, }"
...
# Pass specified tcp traffic in to this server from LAN clients
pass in on $lan_if proto tcp from $lan_if:network to $lan_if port $tcp_pass

# Pass specified udp  traffic in to this server from LAN clients
pass in on $lan_if proto udp from $lan_if:network to $lan_if port $udp_pass

# Pass SSH traffic from LAN clients (for Admin)
pass in on $lan_if proto tcp from $lan_if:network to $lan_if port ssh
...

Check /etc/pf.conf for errors, but do not load ruleset with:

[root@server /usr/home/user]# pfctl -vvnf /etc/pf.conf [enter]

…and then reload /etc/pf.conf with:

[root@server /usr/home/user]# service pf reload [enter]
Reloading pf rules.
[root@server /usr/home/user]#

/tftpboot Directory

List current ZFS pool information with:

[root@server /usr/home/user]# zpool list [enter]
NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot  5,44T   254G  5,19T         -     2%     4%  1.00x  ONLINE  -
[root@server /usr/home/user]#

In this example, zroot pool was found.

Creates a dataset where the tftpboot files will be stored with:

[root@server /usr/home/user]# zfs create -o compression=lz4 -o mountpoint=/tftpboot zroot/tftpboot [enter]
[root@server /usr/home/user]#
[root@server /usr/home/user]# chown tftpd:tftpd /tftpboot [enter]
[root@server /usr/home/user]#
[root@server /usr/home/user]# chmod u=rwx,g=rx,o= /tftpboot [enter]
[root@server /usr/home/user]#

tftpd User

Create a separate user tftpd with group tftpd, no login shell and the home directory set to /nonexistent for running tftpd with:

Add a separate user group tftpd for running the tftpd service with:

[root@server /usr/home/user]# pw groupadd tftpd  [enter]
[root@server /usr/home/user]#

Add a separate user tftpd in group tftpd, no login shell and the home directory set to /nonexistent for running the tftpd service with:

[root@server /usr/home/user]# pw useradd tftpd -c tftp_manager -d /nonexistent -g tftpd -s /usr/sbin/nologin [enter]
[root@server /usr/home/user]#
[root@server /usr/home/user]# vipw [enter]
...
tftpd:*:4004:4003::0:0:tftp_manager:/nonexistent:/usr/sbin/nologin
...
[root@server /usr/home/user]#

Enable tftpd Service

List installed tftpd services with:

[root@server /usr/home/user]# service -r | grep tftpd [enter]
/usr/local/etc/rc.d/tftpd
[root@server /usr/home/user]#

Find the rcvar for /etc/rc.conf with:

[root@server /usr/home/user]# /usr/local/etc/rc.d/tftpd rcvar [enter]
# tftpd
#
tftpd_enable="NO"
#   (default: "")

[root@server /usr/home/user]#

To start tftpd at system boot, add information to /etc/rc.conf with this commands:

[root@server /usr/home/user]# echo '' >> /etc/rc.conf; echo '# tftpd-hpa' >> /etc/rc.conf; echo 'tftpd_enable="YES"' >> /etc/rc.conf; echo 'tftpd_flags="--ipv4 --secure --create --user tftpd --umask 027 --permissive --address 0.0.0.0:69 /tftpboot"' >> /etc/rc.conf [enter]
[root@server /usr/home/user]#

Optional: Add –blocksize 1468 to the tftpd_flags may improve the performance on some systems.

Display full list of tftpd options with:

[root@server /usr/home/user]# man in.tftpd [enter]

Start

Manually start tftpd with:

[root@server /usr/home/user]# service tftpd start [enter]
Starting tftpd.
[root@server /usr/home/user]#

Verify and Test

Check whether the tftpd service daemon is running:

[root@server /usr/home/user]# ps -x | grep tftp | grep -v grep [enter]
 2970  -  Is       0:00,00 /usr/local/libexec/in.tftpd --ipv4 --secure --create --user tftpd --umask 027 --permissive --address 0.0.0.0:69 /tftpboot -P /var/run/tftpd.pid -l
[root@server /usr/home/user]#

You should now have an operational TFTP server. Since your FreeBSD system also has a TFTP client, you can test that the server is running.

First, tftp to the address of your TFTP server as a regular user. Here, we will use the tftp client from the same computer, that is the TFTP server.

Connect to the TFTP service on the local host with:

[root@server /usr/home/user]# tftp localhost [enter]

If the server responds, your prompt will change to:

tftp>

If you type ?, you’ll get a list of command that the tftp client supports:

tftp> ? [enter]
Commands may be abbreviated.  Commands are:

connect 	connect to remote tftp
mode    	set file transfer mode
put     	send file
get     	receive file
quit    	exit tftp
verbose 	toggle verbose mode
status  	show current status
binary  	set mode to octet
ascii   	set mode to netascii
rexmt   	set per-packet retransmission timeout[-]
timeout 	set total retransmission timeout
trace   	enable 'debug packet'[-]
debug   	enable verbose output
blocksize	set blocksize[*]
blocksize2	set blocksize as a power of 2[**]
rollover	rollover after 64K packets[**]
options 	enable or disable RFC2347 style options
help    	print help information
packetdrop	artificial packetloss feature
?       	print help information

[-] : You shouldn't use these ones anymore.
[*] : RFC2347 options support required.
[**] : Non-standard RFC2347 option.
tftp>

Exit the tftp client with:

tftp> q [enter]
[root@server /usr/home/user]#
arp-scan ARP scanning and fingerprinting tool

arp-scan ARP scanning and fingerprinting tool

Description

arp-scan is a command-line tool that uses the ARP protocol to discover and fingerprint IP hosts on the local network. It is available for Linux and BSD under the GPL licence.

WWW: http://www.isc.org/products/DHCP/.

Preparation for Installation

Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.

In this example Terminal on a Mac is used.

Open a remote SSH session to the server with:

Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#

N.B.: Enter user password, not the root password!

Installation

Search for isc-dhcp in the remote package repositories with:

[root@server /usr/home/user]# pkg search arp-scan [enter]
arp-scan-1.9                   ARP scanning and fingerprinting tool
[root@server /usr/home/user]#

In this example arp-scan will be installed.

Install arp-scan with;

[root@server /usr/home/user]# pkg install arp-scan [enter]
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	arp-scan: 1.9

Number of packages to be installed: 1

252 KiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
Fetching arp-scan-1.9.txz: 100%  252 KiB 258.2kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing arp-scan-1.9...
[1/1] Extracting arp-scan-1.9: 100%
[root@server /usr/home/user]#

Configuration

No configuration needed!n

How to Use

Display up Network Interface Cards with:

[root@server /usr/home/user]# ifconfig -u [enter]
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
	ether 84:2b:2b:bf:b4:bf
	inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255 
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
	groups: lo 
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
	groups: pflog
[root@server /usr/home/user]#

In this example Network Interface Card em0 was found.

Scan local network and list all devices found:

[root@server /usr/home/user]# arp-scan --interface=em0 --localnet [enter]
Interface: em0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.1.1	50:c7:bf:01:cc:0f	(Unknown)
192.168.1.7	00:1b:21:a4:4e:cc	Intel Corporate
192.168.1.9	a4:5d:36:5d:30:e9	Hewlett Packard
192.168.1.10	00:08:9b:f8:db:03	ICP Electronics Inc.
192.168.1.11	00:11:32:0f:42:ec	Synology Incorporated
192.168.1.20	00:23:df:fd:6f:18	Apple, Inc
192.168.1.22	1c:1b:0d:66:e3:f0	(Unknown)
192.168.1.113	9c:20:7b:9a:d1:53	Apple Inc
192.168.1.210	00:04:a3:91:58:d1	Microchip Technology, Inc.
192.168.1.211	00:1d:ec:0a:e2:8b	Marusys
192.168.1.114	68:5b:36:00:8a:bd	POWERTECH INDUSTRIAL CO., LTD.
192.168.1.115	68:5b:36:00:81:0a	POWERTECH INDUSTRIAL CO., LTD.
192.168.1.132	60:c5:47:54:81:07	Apple, Inc.
192.168.1.201	d4:9a:20:5a:e8:0e	Apple, Inc
192.168.1.209	c8:69:cd:6e:26:30	(Unknown)
192.168.1.206	d0:ae:ec:4e:2e:67	Alpha Networks Inc.
192.168.1.205	68:5b:36:00:88:5b	POWERTECH INDUSTRIAL CO., LTD.

556 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 256 hosts scanned in 2.201 seconds (116.31 hosts/sec). 17 responded
[root@server /usr/home/user]#
isc-dhcp – ISC Dynamic Host Configuration Protocol server

isc-dhcp – ISC Dynamic Host Configuration Protocol server

Description

ISC’s Dynamic Host Configuration Protocol Distribution provides a freely redistributable reference implementation of all aspects of DHCP, through a suite of DHCP tools

  • A DHCP server (this port)
  • A DHCP client
  • A DHCP relay agent

WWW: http://www.isc.org/products/DHCP/.

Preparation for Installation

Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.

In this example Terminal on a Mac is used.

Open a remote SSH session to the server with:

Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#

N.B.: Enter user password, not the root password!

Installation

Search for isc-dhcp in the remote package repositories with:

[root@server /usr/home/user]# pkg search isc-dhcp [enter]
isc-dhcp43-client-4.3.5        The ISC Dynamic Host Configuration Protocol client
isc-dhcp43-relay-4.3.5         The ISC Dynamic Host Configuration Protocol relay
isc-dhcp43-server-4.3.5        ISC Dynamic Host Configuration Protocol server
[root@server /usr/home/user]#

In this example, sc-dhcp43-server will be installed.

Install isc-dhcp43-server with;

[root@server /usr/home/user]# pkg install isc-dhcp43-server [enter]
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	isc-dhcp43-server: 4.3.5

Number of packages to be installed: 1

The process will require 4 MiB more space.
989 KiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
Fetching isc-dhcp43-server-4.3.5.txz: 100%  989 KiB   1.0MB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing isc-dhcp43-server-4.3.5...
===> Creating groups.
Creating group 'dhcpd' with gid '136'.
===> Creating users
Creating user 'dhcpd' with uid '136'.
[1/1] Extracting isc-dhcp43-server-4.3.5: 100%
Message from isc-dhcp43-server-4.3.5:
****  To setup dhcpd, please edit /usr/local/etc/dhcpd.conf.

****  This port installs the dhcp daemon, but doesn't invoke dhcpd by default.
      If you want to invoke dhcpd at startup, add these lines to /etc/rc.conf:

	    dhcpd_enable="YES"				# dhcpd enabled?
	    dhcpd_flags="-q"				# command option(s)
	    dhcpd_conf="/usr/local/etc/dhcpd.conf"	# configuration file
	    dhcpd_ifaces=""				# ethernet interface(s)
	    dhcpd_withumask="022"			# file creation mask

****  If compiled with paranoia support (the default), the following rc.conf
      options are also supported:

	    dhcpd_chuser_enable="YES"		# runs w/o privileges?
	    dhcpd_withuser="dhcpd"		# user name to run as
	    dhcpd_withgroup="dhcpd"		# group name to run as
	    dhcpd_chroot_enable="YES"		# runs chrooted?
	    dhcpd_devfs_enable="YES"		# use devfs if available?
	    dhcpd_rootdir="/var/db/dhcpd"	# directory to run in
	    dhcpd_includedir="<some_dir>"	# directory with config-
						  files to include

****  WARNING: never edit the chrooted or jailed dhcpd.conf file but
      /usr/local/etc/dhcpd.conf instead which is always copied where
      needed upon startup.
[root@server /usr/home/user]#

Configuration

List installed services dhcp with:

[root@server /usr/home/user]# service -r | grep dhcp [enter]
/usr/local/etc/rc.d/isc-dhcpd
/usr/local/etc/rc.d/isc-dhcpd6
[root@server /usr/home/user]#

Find the rcvar for /etc/rc.conf:

[root@server /usr/home/user]# /usr/local/etc/rc.d/isc-dhcpd rcvar [enter]
# dhcpd
#
dhcpd_enable="NO"
#   (default: "")

[root@server /usr/home/user]#

To start isc-dhcp43-server on system boot, add information to /etc/rc.conf with this commands:

[root@server /usr/home/user]# echo '' >> /etc/rc.conf; echo '# ISC dhcpd' >> /etc/rc.conf; echo 'dhcpd_enable="YES"' >> /etc/rc.conf; echo 'dhcpd_ifaces="em0"' >> /etc/rc.conf [enter]
[root@server /usr/home/user]#

Replace the ’em0′ interface name with the interface (or interfaces, separated by whitespace) that your DHCP server should listen on for DHCP client requests.

Edit /usr/local/etc/dhcpd.conf with:

[root@server /usr/home/user]# ee /usr/local/etc/dhcpd.conf [enter]

N.B.: This is an example with support for client PXE Boot!

#
# dhcpd.conf
#

authoritative;

default-lease-time 3600;
max-lease-time 86400;

ddns-updates on;
ddns-domainname "example.net.";
ddns-rev-domainname "in-addr.arpa.";
ddns-update-style interim;

log-facility local7;

server-name "server.example.net";
server-identifier server.example.net;

allow client-updates;
allow unknown-clients;
do-forward-updates true;

include "/usr/local/etc/namedb/rndc.key";

# example.net
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.200 192.168.1.249;
        option domain-name-servers 192.168.1.4;
        option subnet-mask 255.255.255.0;
        option routers 192.168.1.1;
        option broadcast-address 192.168.1.255;
        option ntp-servers 192.168.1.4;
        option domain-name "example.net.";
        default-lease-time 3600;
        max-lease-time 86400;
        next-server 192.168.1.4;
        option root-path "192.168.1.4:/tftpboot";
        filename "/gpxelinux.0";
        }

# Hosts Forward
zone example.net. {
        primary 127.0.0.1;
        key rndc-key;
        }

# Hosts Reverse
zone 1.168.192.in-addr.arpa. {
        primary 127.0.0.1;
        key rndc-key;
        }

Make sure that file /usr/local/etc/dhcpd.conf is not world readable with:

[root@server /usr/home/user]# chmod 640 /usr/local/etc/dhcpd.conf [enter]
[root@server /usr/home/user]#

 

Start

Manually start isc-dhcp43-server with;

[root@server /usr/home/user]# service isc-dhcpd start [enter]
Starting dhcpd.
Internet Systems Consortium DHCP Server 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /usr/local/etc/dhcpd.conf
Database file: /var/db/dhcpd/dhcpd.leases
PID file: /var/run/dhcpd/dhcpd.pid
Wrote 0 leases to leases file.
Listening on BPF/igb0/00:1b:21:a4:4e:cc/192.168.1.0/24
Sending on   BPF/igb0/00:1b:21:a4:4e:cc/192.168.1.0/24
Sending on   Socket/fallback/fallback-net
[root@srv /usr/home/stureah]#
[root@server /usr/home/user]#

Display isc-dhcp43-server status with:

[root@server /usr/home/user]# service isc-dhcpd status [enter]
dhcpd is running as pid 31662.
[root@server /usr/home/user]#

View content of dhcpd-leases

[root@server /usr/home/user]# cat /var/db/dhcpd/dhcpd.leases [enter]
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.3.5

# authoring-byte-order entry is generated, DO NOT DELETE
authoring-byte-order little-endian;

lease 192.168.1.200 {
  starts 3 2017/03/01 14:32:06;
  ends 3 2017/03/01 15:32:06;
  tstp 3 2017/03/01 15:32:06;
  cltt 3 2017/03/01 14:32:06;
  binding state free;
  hardware ethernet e4:a7:a0:73:c4:ea;
  uid "\001\344\247\240s\304\352";
  set vendor-class-identifier = "MSFT 5.0";
.
.
[root@server /usr/home/user]#
BIND Domain Name Server

BIND Domain Name Server

Description

BIND is open source software that enables you to publish your Domain Name System (DNS) information on the Internet and to resolve DNS queries for your users. The name BIND stands for “Berkeley Internet Name Domain” because the software originated in the early 1980s at the University of California at Berkeley.

BIND is by far the most widely used DNS software on the Internet, providing a robust and stable platform on top of which organizations can build distributed computing systems with the knowledge that those systems are fully compliant with published DNS standards.

WWW: https://www.isc.org/software/bind.

Installed and configured package(s) requirement:

  1. OpenSSL – Open Secure Sockets Layer

Preparation for Installation

Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.

In this example Terminal on a Mac is used.

Open a remote SSH session to the server with:

Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#

N.B.: Enter user password, not the root password!

Installation

Search for bind in the remote package repositories with:

[root@server /usr/home/user]# pkg search bind <enter>
bind-tools-9.10.4P6            Command line tools from BIND: delv, dig, host, nslookup...
bind9-devel-9.12.0.a.2017.02.09 BIND DNS suite with updated DNSSEC and DNS64
bind910-9.10.4P6               BIND DNS suite with updated DNSSEC and DNS64
bind911-9.10.4P6               BIND DNS suite with updated DNSSEC and DNS64
bind99-9.9.9P6                 BIND DNS suite with updated DNSSEC and DNS64
bindgraph-0.3_1                RRDtool frontend for BIND statistics
bindtest-1.56_1                Test bind() semantics of IPv6 sockets
.
.
[root@server /usr/home/user]#

In this example, bind910 will be installed due to that bind911 has TCP_FASTOPEN error issues when running under FreeBSD 11.0-RELEASE-amd64.

Install bind910 with;

[root@server /usr/home/user]# pkg install bind910 [enter]
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	bind911: 9.10.4P6
	lmdb: 0.9.18_1
	idnkit: 1.0_6
	json-c: 0.12.1

Number of packages to be installed: 4

The process will require 61 MiB more space.
8 MiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
Fetching bind911-9.10.4P6.txz: 100%    8 MiB   2.7MB/s    00:03    
Fetching lmdb-0.9.18_1.txz: 100%   87 KiB  89.5kB/s    00:01    
Fetching idnkit-1.0_6.txz: 100%  194 KiB 198.4kB/s    00:01    
Fetching json-c-0.12.1.txz: 100%   38 KiB  39.2kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/4] Installing lmdb-0.9.18_1...
[1/4] Extracting lmdb-0.9.18_1: 100%
[2/4] Installing idnkit-1.0_6...
[2/4] Extracting idnkit-1.0_6: 100%
[3/4] Installing json-c-0.12.1...
[3/4] Extracting json-c-0.12.1: 100%
[4/4] Installing bind911-9.10.4P6...
[4/4] Extracting bind911-9.10.4P6: 100%
Message from idnkit-1.0_6:
===>   NOTICE:

The idnkit port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
Message from bind911-9.10.4P6:
**********************************************************************
*            _  _____ _____ _____ _   _ _____ ___ ___  _   _         *
*           / \|_   _|_   _| ____| \ | |_   _|_ _/ _ \| \ | |        *
*          / _ \ | |   | | |  _| |  \| | | |  | | | | |  \| |        *
*         / ___ \| |   | | | |___| |\  | | |  | | |_| | |\  |        *
*        /_/   \_\_|   |_| |_____|_| \_| |_| |___\___/|_| \_|        *
*                                                                    *
*   BIND requires configuration of rndc, including a "secret" key.   *
*    The easiest, and most secure way to configure rndc is to run    *
*   'rndc-confgen -a' to generate the proper conf file, with a new   *
*            random key, and appropriate file permissions.           *
*                                                                    *
*     The /usr/local/etc/rc.d/named script will do that for you.     *
*                                                                    *
**********************************************************************
[root@server /usr/home/user]#

Configuration

List installed services named with:

[root@server /usr/home/user]# service -r | grep named
/usr/local/etc/rc.d/named
[root@server /usr/home/user]#

Find the rcvar for /etc/rc.conf:

[root@server /usr/home/user]# /usr/local/etc/rc.d/named rcvar
# named
#
named_enable="NO"
#   (default: "")

[root@server /usr/home/user]#

To start BIND at system boot, add information to /etc/rc.conf with this commands:

[root@server /usr/home/user]# echo '' >> /etc/rc.conf; echo '# BIND' >> /etc/rc.conf; echo 'named_enable="YES"' >> /etc/rc.conf; echo 'named_auto_forward="YES"' >> /etc/rc.conf [enter]
[root@server /usr/home/user]#

N.B.: named_auto_forward=”YES” tells BIND to pick forward Name Server(s) from file /etc/resolve.conf!

Automatically rotate the /var/named/var/log/named.log log file with:

[root@server /usr/home/user]# echo '/var/log/named.log                      600  9   100000 *     Z' >> /etc/syslog.conf [enter]
[root@server /usr/home/user]#

Update Resolve Config

Update file /etc/resolv.conf and set the local host as the primary DNS:

[root@server /usr/home/user]# ee /etc/resolv.conf [enter]
search		example.net
nameserver	127.0.0.1
nameserver	208.67.222.222
nameserver	208.67.220.220

N.B.: In this example OpenDNS Name Servers 208.67.222.222 and 208.67.220.220 is will be used by the local BIND Name Server for forward requests.

Generate Cryptograpic Key

Generate a rndc.key file with the following command:

[root@server /usr/home/user]# rndc-confgen -a [enter]
wrote key file "/usr/local/etc/namedb/rndc.key"
[root@server /usr/home/user]#

Change file modes on file /usr/local/etc/namedb/rndc.key with:

[root@server /usr/home/user]# chmod 440 /usr/local/etc/namedb/rndc.key [enter]
[root@server /usr/home/user]#

Display content of file /usr/local/etc/namedb/rndc.key with:

[root@server /usr/home/user]# cat /usr/local/etc/namedb/rndc.key [enter]
key "rndc-key" {
        algorithm hmac-md5;
        secret "XcwJ.............JSCMw==";
        };

N.B.: The content of file cat /usr/local/etc/namedb/rndc.key must be copied to the BIND configuration file /usr/local/etc/namedb/named.conf!

Configuration file

Edit the BIND configuration file for /usr/local/etc/namedb/named.conf with:

[root@server /usr/home/user]# ee /usr/local/etc/namedb/named.conf [enter]

N.B.: This is an example file. Please use it only as a template!

//
// named.conf
//

acl nets { 192.168.1/24; 127.0.0.1; };

options {
	// Relative to the chroot directory, if any, and should be fully qualified.
	directory       "/usr/local/etc/namedb/working";
	pid-file        "/var/run/named/pid";
	dump-file       "/var/dump/named_dump.db";
	statistics-file "/var/stats/named.stats";
	listen-on { 192.168.1.4; 127.0.0.1; };
	forwarders { 208.67.222.222; 208.67.220.220; };
	allow-query { nets; };
	allow-recursion { nets; };
	};

logging {
	channel log_file { file "/var/log/named/named.log" versions 3 size 5M;
	severity  debug 3 ; };
	category queries { log_file; };
	category xfer-in { log_file; };
	category xfer-out { log_file; };
	category default { log_file; };
	};

include "/usr/local/etc/namedb/rndc.key";

controls {
        inet 127.0.0.1 port 953 allow { nets; } keys { "rndc-key"; };
        inet 192.168.1.1 port 953 allow { nets; } keys { "rndc-key"; };
        };

//zone "." { type hint; file "named.root"; };
zone "localhost" { type master; file "/usr/local/etc/namedb/master/localhost-forward.db"; };
zone "127.in-addr.arpa" { type master; file "/usr/local/etc/namedb/master/localhost-reverse.db"; };
zone "255.in-addr.arpa" { type master; file "/usr/local/etc/namedb/master/empty.db"; };

zone "example.net" {
        notify yes;
        type master;
        file "/usr/local/etc/namedb/dynamic/hosts-forward.db";
        allow-update { key rndc-key; };
        };

zone "1.168.192.in-addr.arpa" {
        notify yes;
        type master;
        file "/usr/local/etc/namedb/dynamic/hosts-reverse.db";
        allow-update { key rndc-key; };
        };

“Seed” zone files

Prepare a “seed” zone file for the domain the server should update dynamically.

In this example, the dynamic subdomain is going to be example.net. Remember to replace example.net with your domain name, it must match what you have used in file /var/named/etc/namedb/named.conf.

The “seed” zone file is very minimal and should contain information that WON’T ever change. In this case, that will be the SOA record, the NS records, and the MX record.

Create the forward “seed” zone file with:

[root@server /usr/home/user]# ee /usr/local/etc/namedb/dynamic/hosts-forward.db [enter]

N.B.: This is an example file!

$ORIGIN .
$TTL 3600       ; 1 hour
example.net  IN SOA  server.example.net. admin.example.net. (
                                0          ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
                        NS      server.example.net.
                        MX      10 server.example.net.
$ORIGIN example.net.
server                  A       192.168.1.1
ftp                     CNAME   server
mx                      CNAME   server
ns                      CNAME   server
www                     CNAME   server

Create the reverse “seed” zone file with:

[root@server /usr/home/user]# ee /usr/local/etc/namedb/dynamic/hosts-reverse.db [enter]

N.B.: This is an example file:

$ORIGIN .
$TTL 3600       ; 1 hour
1.168.192.in-addr.arpa  IN SOA  server.example.net. admin.example.net. (
                                0          ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
                        NS      server.example.net.
                        MX      10 server.example.net.
$ORIGIN 1.168.192.in-addr.arpa.
1                       PTR     server.example.net.

Feel free to modify based on what you want to do, you can add more aliases, A or MX records, and make sure to change your domain name above from example.net to your domain name. Make sure to add a “.” after words, also change your hostname from server to the hostname you are using.

admin.example.net is the e-mail address of the person responsible for the zone. Here we use a “.” instead of an “@” sign in the e-mail address.

name service needs to update the configuration for the dynamic IPs itself. Set write permission for the user bind with:

[root@server /usr/home/user]# chown bind:bind /usr/local/etc/namedb/dynamic/hosts-* [enter]
[root@server /usr/home/user]#

Create a new directory called /var/log/named with:

[root@server /usr/home/user]# mkdir /var/log/named [enter]
[root@server /usr/home/user]#

Change file owner and group with:

[root@server /usr/home/user]# chown bind:bind /var/log/named [enter]
[root@server /usr/home/user]#

Change file modes with:

[root@server /usr/home/user]# chmod 777 /var/log/named [enter]
[root@server /usr/home/user]#

Create a empty log files called /var/log/named/named.log with:

[root@server /usr/home/user]# touch /var/log/named/named.log [enter]
[root@server /usr/home/user]#

/var/log/named/named.log files must have write permission for user bind:

[root@server /usr/home/user]# chown bind:bind /var/log/named/named.log [enter]
[root@server /usr/home/user]#

Syntax Checks

named-checkzone checks the syntax and integrity of a zone file. It performs the same checks as named does when loading a zone. This makes named-checkzone useful for checking zone files before configuring them into a name server.

[root@server /usr/home/user]# named-checkconf -zj [enter]
zone localhost/IN: loaded serial 42
zone 127.in-addr.arpa/IN: loaded serial 42
zone 255.in-addr.arpa/IN: loaded serial 42
zone example.net/IN: loaded serial 0
zone 1.168.192.in-addr.arpa/IN: loaded serial 0
[root@server /usr/home/user]#

Optional: rndc.conf

rndc.conf is the configuration file for rndc, the BIND 9 name server control utility. This file has a similar structure and syntax to named.conf. Statements are enclosed in braces and terminated with a semi-colon. Clauses in the statements are also semi-colon terminated.

Add /usr/local/etc/namedb/rndc.key to file /usr/local/etc/namedb/rndc.conf with:

[root@server /usr/home/user]# cat /usr/local/etc/namedb/rndc.key >> /usr/local/etc/namedb/rndc.conf
[root@server /usr/home/user]#

Edit the configuration file for rndc with:

[root@server /usr/home/user]# ee /usr/local/etc/namedb/rndc.conf [enter]

N.B.: This is an example file!

/*
 * rndc configuration file.
 */

options {
        default-server  localhost;
        default-key     "rndc-key";
};

server localhost {
        key             "rndc-key";
};

key "rndc-key" {
        algorithm hmac-md5;
        secret "XcwJ.............JSCMw==";
};

Start

Manually start BIND with;

[root@server /usr/home/user]# service named start [enter]
Starting named.
[root@server /usr/home/user]#

Test BIND status with:

[root@server /usr/home/user]# service named status [enter]
named is running as pid 64826.
[root@server /usr/home/user]#

Check the error logs with:

[root@server /usr/home/user]# grep named /var/log/messages [enter]
Mar  1 12:33:35 srv named[92074]: starting BIND 9.10.4-P6 <id:a6837d0> -u bind -c /usr/local/etc/namedb/named.conf
Mar  1 12:33:35 srv named[92074]: running on FreeBSD amd64 11.0-RELEASE-p2 FreeBSD 11.0-RELEASE-p2 #0: Mon Oct 24 06:55:27 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
Mar  1 12:33:35 srv named[92074]: built with '--localstatedir=/var' '--disable-linux-caps' '--disable-symtable' '--with-randomdev=/dev/random' '--with-libxml2=/usr/local' '--with-readline=-L/usr/local/lib -ledit' '--with-dlopen=yes' '--sysconfdir=/usr/local/etc/namedb' '--disable-fetchlimit' '--disable-filter-aaaa' '--disable-fixed-rrset' '--without-geoip' '--with-idn=/usr/local' '--enable-ipv6' '--with-libjson' '--disable-largefile' '--without-python' '--disable-querytrace' '--enable-rpz-nsdname' '--enable-rpz-nsip' 'STD_CDEFINES=-DDIG_SIGCHASE=1' '--without-gssapi' '--with-openssl=/usr' '--disable-native-pkcs11' '--with-dlz-filesystem=yes' '--without-gost' '--enable-threads' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd11.0' 'build_alias=amd64-portbld-freebsd11.0' 'CC=cc' 'CFLAGS=-O2 -pipe -DLIBICONV_PLUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing' 'LDFLAGS= -fstack-protector' 'LIBS=-L/usr/local/lib' 'CPPFLAGS=-DLIBICONV_P
Mar  1 12:33:35 srv named[92074]: ----------------------------------------------------
Mar  1 12:33:35 srv named[92074]: BIND 9 is maintained by Internet Systems Consortium,
Mar  1 12:33:35 srv named[92074]: Inc. (ISC), a non-profit 501(c)(3) public-benefit 
Mar  1 12:33:35 srv named[92074]: corporation.  Support and training for BIND 9 are 
Mar  1 12:33:35 srv named[92074]: available at https://www.isc.org/support
Mar  1 12:33:35 srv named[92074]: ----------------------------------------------------
Mar  1 12:33:35 srv named[92074]: command channel listening on 127.0.0.1#953
Mar  1 12:33:35 srv named[92074]: command channel listening on 192.168.1.4#953
[root@server /usr/home/user]#
[root@server /usr/home/user]# tail /var/log/named/named.log [enter]
.
zone_settimer: zone 100.51.198.IN-ADDR.ARPA/IN: enter
zone_timer: zone id.server/CH: enter
zone_maintenance: zone id.server/CH: enter
zone_settimer: zone id.server/CH: enter
[root@server /usr/home/user]#

Reload Config

Reload configuration file and zones after manual updates with:

[root@server /usr/home/user]# rndc reload [enter]
server reload successful
[root@server /usr/home/user]#

…or with:

[root@server /usr/home/user]# service named reload [enter]
server reload successful
[root@server /usr/home/user]#

How to use

Checked if the nameserver is working on the server:

[root@server /usr/home/user]# dig @localhost ns.example.net [enter]

; <<>> DiG 9.9.4 <<>> @localhost ns.example.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 15863
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;ns1.example.net.	IN	A

;; AUTHORITY SECTION:
example.net.	3600	IN	SOA	server.example.net. admin.server.example.net. 247 10800 3600 604800 86400

;; Query time: 0 msec
;; SERVER: 192.168.1.4#53(192.168.1.4)
;; WHEN: Mon Aug  8 23:52:15 2011
;; MSG SIZE  rcvd: 91

[root@server /usr/home/user]#

You can try to dig for google.com to make sure all is good with your DNS server:

[root@server /usr/home/user]# dig @localhost google.com [enter]
	
; <<>> DiG 9.9.4 <<>> @localhost google.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4584
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 13, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		300	IN	A	173.194.32.36
google.com.		300	IN	A	173.194.32.33
google.com.		300	IN	A	173.194.32.32
google.com.		300	IN	A	173.194.32.41
google.com.		300	IN	A	173.194.32.39
google.com.		300	IN	A	173.194.32.38
google.com.		300	IN	A	173.194.32.35
google.com.		300	IN	A	173.194.32.46
google.com.		300	IN	A	173.194.32.40
google.com.		300	IN	A	173.194.32.37
google.com.		300	IN	A	173.194.32.34

;; AUTHORITY SECTION:
.			510352	IN	NS	f.root-servers.net.
.			510352	IN	NS	e.root-servers.net.
.			510352	IN	NS	k.root-servers.net.
.			510352	IN	NS	b.root-servers.net.
.			510352	IN	NS	j.root-servers.net.
.			510352	IN	NS	l.root-servers.net.
.			510352	IN	NS	m.root-servers.net.
.			510352	IN	NS	a.root-servers.net.
.			510352	IN	NS	h.root-servers.net.
.			510352	IN	NS	i.root-servers.net.
.			510352	IN	NS	g.root-servers.net.
.			510352	IN	NS	d.root-servers.net.
.			510352	IN	NS	c.root-servers.net.

;; Query time: 48 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Dec 15 23:10:43 CET 2013
;; MSG SIZE  rcvd: 426

[root@server /usr/home/user]#

Manual dynamic DNS update

A dynamic DNS update can be performed with the nsupdate tool. The nsupdate tool requires that you have a valid key-file, /usr/local/etc/namedb/rndc.key that matches the key in file /usr/local/etc/namedb/named.conf.

In this example a new A record will be added for myhost.example.net with IP address 192.168.1.248:

[root@server /usr/home/user]# nsupdate -k /usr/local/etc/namedb/rndc.key [enter]
> update add myhost.example.net 3600 A 192.168.1.248 [enter]
> send [enter]
> [ctrl][D][root@server /usr/home/user]#

Verify the add of host myhost.example.net with:

[root@server /usr/home/user]# host myhost.example.net [enter]
myhost.example.net has address 192.168.1.248
[root@server /usr/home/user]#

Remove the A record entry for myhost.example.net so it doesn’t cause problems later with:

[root@server /usr/home/user]# nsupdate -k /usr/local/etc/namedb/rndc.key [enter]
> update delete myhost.example.net [enter]
> send [enter]
> [ctrl][D][root@server /usr/home/user]#

Verify the delete of host myhost.example.net with:

[root@server /usr/home/user]# host myhost.example.net [enter]
Host myhost.example.net not found: 3(NXDOMAIN)
[root@server /usr/home/user]#
UTF-8 Character Encoding

UTF-8 Character Encoding

Description

The LANG=xx_YY.ZZZZ environment variable sets the system locale to language code xx, country code YY, and character encoding ZZZZ. Language and country code affect default application language, number formatting, date and time formatting, string collation, currency settings, and more.

By enabling a locale using UTF-8 character encoding, the system can understand and display each of the 1112064 characters in the Unicode character set, instead of just US ASCII as is default with LANG=C.

Preparation for Installation

Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.

In this example Terminal on a Mac is used.

Open a remote SSH session to the server with:

Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#

N.B.: Enter user password, not the root password!

Available UTF-8 Locale

Display a list of every available UTF-8 locale on your computer with:

[root@server /usr/home/user]# locale -a | grep '\.UTF-8$' [enter]
af_ZA.UTF-8
am_ET.UTF-8
.
.
.
sv_SE.UTF-8
tr_TR.UTF-8
uk_UA.UTF-8
zh_CN.UTF-8
zh_HK.UTF-8
zh_TW.UTF-8
[root@server /usr/home/user]#

Customize UTF-8 Locale

In this example, as a Swede, I will use English as the default language with Swedish monetary, numeric and time settings.

Create a copy of the en_US.UTF-8 directory with:

[root@server /usr/home/user]# cp -R /usr/share/locale/en_US.UTF-8 /usr/share/locale/en_SE.UTF-8 [enter]
[root@server /usr/home/user]#

…then modify this directory with:

[root@server /usr/home/user]# cp /usr/share/locale/sv_SE.UTF-8/LC_MONETARY /usr/share/locale/en_SE.UTF-8/ [enter]
[root@server /usr/home/user]# cp /usr/share/locale/sv_SE.UTF-8/LC_NUMERIC /usr/share/locale/en_SE.UTF-8/ [enter]
[root@server /usr/home/user]#

Change to 24h clock in uptime, w etc with:

[root@server /usr/home/user]# ee /usr/share/locale/en_SE.UTF-8/LC_TIME [enter]

Edit the LC_TIME file, line 40 – 44, and line 58 as in this example. Do NOT delete the emty lines 42, 43 and 58!

Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
January
February
March
April
May
June
July
August
September
October
November
December
Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
%H:%M:%S
%Y-%m-%d
%a %e %b %X %Y

%a %e %b %Y %X %Z
January
February
March
April
May
June
July
August
September
October
November
December
md

Edit the login class capability database in /etc/login.conf with:

[root@server /usr/home/user]# ee /etc/login.conf [enter]

It is recommended that LC_COLLATE be set to C because some programs still require ASCII ordering in order to function correctly.

…and add a default character set and locale as in this example:

default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=64K:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:swapuse=unlimited:\
:pseudoterminals=unlimited:\
:kqueues=unlimited:\
:umtxp=unlimited:\
:priority=0:\
:ignoretime@:\
:charset=UTF-8:\
:lang=en_SE.UTF-8:\
:umask=022:
.
.

Login shells will inherit the environment variables defined here in the default class or in a narrower class if it matches one.

After making this changesrRebuild the login database with:

[root@server /usr/home/user]# cap_mkdb /etc/login.conf [enter]
[user@server /usr/home/user]#

You may have to specify the new locale elsewhere (like /etc/profile) for non login shell uses such as GDM and other login managers.

[root@server /usr/home/user]# echo 'export LANG=en_SE.UTF-8' >> /etc/profile; echo 'export CHARSET=UTF-8' >> /etc/profile [enter]
[root@server /usr/home/user]#

…and add a default character set and locale as in this example:

You can read more in the Using Localization chapter of the Handbook.

On next login check your work by running:

[root@server /usr/home/user]# locale [enter]
LANG=en_SE.UTF-8
LC_CTYPE="en_SE.UTF-8"
LC_COLLATE="en_SE.UTF-8"
LC_TIME="en_SE.UTF-8"
LC_NUMERIC="en_SE.UTF-8"
LC_MONETARY="en_SE.UTF-8"
LC_MESSAGES="en_SE.UTF-8"
LC_ALL=
[root@server /usr/home/user]#
Post-installation Setup and Configuration

Post-installation Setup and Configuration

This page was last modified [last-modified]

First login

As the FreeBSD server boots, informational messages are displayed on the screen and after the system finishes booting, a login prompt is displayed as in this example:

FreeBSD/amd64 (srv.local) (ttyv0)

login:

Login as user root with the password you entered during the installation:

login: root [enter]
Password: <-- password [enter]

Display current Network settings

Display the current active Network Interface settings with:

$ ifconfig -u [enter]
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=81249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER>
	ether 00:23:24:ba:1a:1b
	inet 192.168.1.21 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
	inet 127.0.0.1 netmask 0xff000000
	groups: lo
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
$

In this example, Network Interface Controller, NIC, em0 has been found and it has been configured to have IP Address 192.168.1.21.

Remote login

To make life easier and permit you to copy commands from this web page go to another computer connected to the same local network as your FreeBSD server.

Start for example PuTTY on a Windows PC, Terminal on a Mac or a similar application on a Linux PC. In this example Terminal on a Mac is used.

Mac:~ user$ ssh user@192.168.1.21 [enter]

N.B.: The use of an SSH client is highly recommended for logging into the remote FreeBSD server!

ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to provide secure encrypted communications between two untrusted hosts over an insecure network.

N.B.: If an ssh login has been performed before to the selected IP Address a warning – in this example on an iMac – will be displayed:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:.....
Please contact your system administrator.
Add correct host key in /Users/user/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/user/.ssh/known_hosts:1
ECDSA host key for 192.168.1.21 has changed and you have requested strict checking.
Host key verification failed.
user@Users-iMac ~ %

On a Mac, use the following steps to get access to the hidden file known_hosts:

  1. Select and Copy the file name in the warning messag, in this example: /Users/user/.ssh/known_hosts
  2. Click on the Finder icon and verify that Finder is displayed next to the Apple icon
  3. Click on Go and then Go to folder…
  4. Click in the Go to the folder: field, past file name into it and then click button Go

A Finder window with file known_hosts should now be displayed on the screen.

Dubble-click known_hosts to open the file in TextEdit. Delete the offending line, save the file, quit TextEdit, and finally repeat the login command above.

The authenticity of host 'srv.local (192.168.1.21)' can't be established.
ECDSA key fingerprint is SHA256:...
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes [enter]
Warning: Permanently added 'srv.local' (ECDSA) to the list of known hosts.
Password for user@srv.local: <-- passwd [enter]
FreeBSD 12.2-RELEASE r366954 GENERIC 

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
If you have a CD-ROM drive in your machine, you can make the CD-ROM that is
presently inserted available by typing 'mount /cdrom' as root.  The CD-ROM
will be available under /cdrom/.  Remember to do 'umount /cdrom' before
removing the CD-ROM (it will usually not be possible to remove the CD-ROM
without doing this.)

Note: This tip may not work in all configurations.
user@server:~ $

sudo

The best practice is to never log in as the root superuser interactively. If you do – you are doing it wrong!

sudo is a program that allows a permitted user to execute a command as the superuser or another user, as specified by the user’s security policy. Unlike the su utility, sudo authenticates the user against the user’s own password rather than that of the target user. Sudo allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments. This allows the delegation of specific commands to specific users on specific systems without sharing passwords among the users.

Installation

Installation and configuration of sudo requires superuser privileges. This sudo installation will be the only and last interactive login as the root superuser you will ever need to perform on this system.

Substitute User identity to the root superuser identity with:

user@server:~ $ su -
Password: <-- passwd [enter]
root@server:~ #

Install sudo with:

root@server:~ # pkg install sudo [enter]
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y [enter]
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.15.10...
Extracting pkg-1.15.10: 100%
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB   1.1MB/s    00:06    
Processing entries: 100%
FreeBSD repository update completed. 31737 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	gettext-runtime: 0.21
	indexinfo: 0.3.1
	sudo: 1.9.3p1

Number of packages to be installed: 3

The process will require 5 MiB more space.
1 MiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
[1/3] Fetching sudo-1.9.3p1.txz: 100%  925 KiB 473.4kB/s    00:02    
[2/3] Fetching gettext-runtime-0.21.txz: 100%  165 KiB 168.9kB/s    00:01    
[3/3] Fetching indexinfo-0.3.1.txz: 100%    6 KiB   5.8kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/3] Installing indexinfo-0.3.1...
[1/3] Extracting indexinfo-0.3.1: 100%
[2/3] Installing gettext-runtime-0.21...
[2/3] Extracting gettext-runtime-0.21: 100%
[3/3] Installing sudo-1.9.3p1...
[3/3] Extracting sudo-1.9.3p1: 100%
root@server:~ #

Configuration

A default sudo configuration file /usr/local/etc/sudoers was created as part of the installation process.

N.B.: /usr/local/etc/sudoers MUST be edited with the visudo command as root.

The use of visudo minimizes the risk for syntax or file permission errors that prevents sudo from running.

Start editing file /usr/local/etc/sudoers with:

root@server:~ # visudo [enter]
## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##
.
.
.

visudo use the famous vi editor commands. The following commands is needed for updating and saving or exit without saving file /usr/local/etc/sudoers:

  1. Use the arrow keys to move the cursor or…
  2. Move the cursor up one line with key ‘K’, down one line with key ‘J’, left one character with key ‘H’ and right one character with key ‘L’
  3. Press key ‘I’ to start inserting charters before the current cursor location
  4. Press key ‘A’ to start inserting charters after the current cursor location
  5. Press key ‘esc’ to abort inserting charters
  6. Press key ‘X’ to delete the character under the cursor
  7. Press key ‘:’, then ‘W’ and ‘Q’ to save and exit
  8. Press key ‘:’, then ‘Q’ and ‘!’ to exit without saving

To delegate privileges to the example user user locate section User privilege specification in the file /usr/local/etc/sudoers.

To allow user user to execute any command via sudo add the following text:

##
## User privilege specification
##
root ALL=(ALL) ALL
user ALL=(ALL) ALL

…or to allow user user as a members of group wheel to execute any command via sudo uncomment – delete the ‘#’ character. The line should look like this:

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

Finally exit the root superuser identity with:

root@server:~ # exit [enter]
logout
$

Date and Time

Enable superuser privileges with:

$ sudo -s [enter]

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

Password: <-- passwd [enter]
#

Stop the ntpd daemon program if it is running with:

# service ntpd stop [enter]
Stopping ntpd.
Waiting for PIDS: 647.
#

Set the date and time via NTP, using this command:

# ntpdate -v -b pool.ntp.org [enter]
14 Feb 14:11:07 ntpdate[831]: ntpdate 4.2.8p8-a (1)
14 Feb 14:11:15 ntpdate[831]: step time server 79.138.40.123 offset 0.001542 sec
#

N.B.: The ntp server “pool.ntp.org” is recommended by ntp.org. You can also select another one, check out http://www.ntp.org for details.

Defaults

List defaults for ntpd with:

# cat /etc/defaults/rc.conf | grep ntpd_ [enter]
ntpd_enable="NO" # Run ntpd Network Time Protocol (or NO).
ntpd_program="/usr/sbin/ntpd" # path to ntpd, if you want a different one.
ntpd_config="/etc/ntp.conf" # ntpd(8) configuration file
ntpd_sync_on_start="NO" # Sync time on ntpd startup, even if offset is high
ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift" # Flags to ntpd (if enabled).
#

Enable NTPd

To ensure the NTP server is started at boot time verify that line ntpd_enable=”YES” to has been added to file /etc/rc.conf with:

# echo '' >> /etc/rc.conf; echo '# Network Time Protocol' >> /etc/rc.conf [enter]
# echo 'ntpd_enable="YES"' >> /etc/rc.conf [enter]
# echo 'ntpd_sync_on_start="YES"' >> /etc/rc.conf [enter]
# echo 'ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift -g"' >> /etc/rc.conf [enter]
#

If ntpd daemon program was running and stoped without any warnings or error above, then you should edit file /etc/rc.conf with:

# ee /etc/rc.conf [enter]

…and delete line ntpd_enable=”YES” above line # Network Time Protocol.

Configure NTPd

The /etc/ntp.conf configuration file is read at initial startup by the ntpd(8) daemon in order to specify the synchronization sources, modes and other related information.

Specify the NTP synchronization sources your server will use with:

# ee /etc/ntp.conf [enter]

The following three servers will give you a random set of three NTP servers geographically close to you:

##
# ntpd.conf
#
server 0.freebsd.pool.ntp.org iburst
server 1.freebsd.pool.ntp.org iburst
server 2.freebsd.pool.ntp.org iburst

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 127.127.1.0

leapfile "/etc/ntp/leap-seconds"

See http://www.pool.ntp.org/ for details.

Example: Sweden — se.pool.ntp.org:

#
# ntpd.conf
#
server 0.se.pool.ntp.org iburst
server 1.se.pool.ntp.org iburst
server 2.se.pool.ntp.org iburst
server 3.se.pool.ntp.org iburst

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 127.127.1.0

leapfile "/etc/ntp/leap-seconds"

The driftfile is by default /var/db/ntpd.drift.

Manually start NTPd

Start Network Time Protocol (NTP) daemon, using this command:

# service ntpd start [enter]
Starting ntpd.
#

NTP is a very cautious standard. It will report its stratum to 16 (the worst possible) until it’s sure that its in sync. This can take a few minutes to few hours.

Standard NTP query program

The ntpq utility is used to monitor NTP daemon ntpd operations and determine performance.

Print a list of the peers known to the server as well as a summary of their state:

# ntpq -pn localhost [enter]
remote refid st t when poll reach delay offset jitter
==============================================================================
-188.126.88.9 192.36.144.22 2 u 22 64 1 20.184 1.962 3.454
*192.36.143.130 .PPS. 1 u 26 64 3 18.953 8.415 27.720
+194.71.144.71 192.36.144.22 2 u 31 64 3 32.755 8.158 28.261
+83.168.200.199 192.36.143.154 2 u 28 64 3 15.500 7.787 27.919
#

N.B.: Waiting for “st” to drop to 2 (since those should be stratum 2 servers) before the server is used for time sync of local computers.

Documentation

Documentation in HTML format for the NTP server can be found in: /usr/share/doc/ntp/.

Base System Binary Update

The freebsd-update tool is used to fetch, install, and rollback binary updates to the FreeBSD base system.

Fetch

Fetch files necessary for upgrading to a new release with:

# freebsd-update fetch < enter>
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching public key from update6.freebsd.org... done.
Fetching metadata signature for 11.0-RELEASE from update6.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 171 patches.....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150....160....170 done.
Applying patches... done.
Fetching 6 files... done.
--More--(END)

Press key ‘Q’ to skip displaying the list of fetched files.

The following files will be removed as part of updating to 11.0-RELEASE-p7:
/usr/share/zoneinfo/America/Santa_Isabel
/usr/share/zoneinfo/Asia/Rangoon
--More--(END)

Press ‘space’ key to displaying a list of files that will be added.

The following files will be added as part of updating to 11.0-RELEASE-p7:
/usr/share/zoneinfo/Asia/Barnaul
/usr/share/zoneinfo/Asia/Famagusta
/usr/share/zoneinfo/Asia/Tomsk
/usr/share/zoneinfo/Asia/Yangon
/usr/share/zoneinfo/Europe/Astrakhan
/usr/share/zoneinfo/Europe/Kirov
/usr/share/zoneinfo/Europe/Ulyanovsk
--More--(END)

Press key ‘Q’ to skip displaying a list of files that will be updated.

#

Installation

The binary updates is installed with:

# freebsd-update install [enter]
src component not installed, skipped
Installing updates... done.
#

BASH – Bourne Again SHell

Bash is the GNU Project’s Bourne Again SHell, a complete implementation of the POSIX.2 shell spec, but also with interactive command line editing, job control on architectures that support it, csh-like features such as history substitution and brace expansion, and a slew of other features.

WWW: http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html

Installation

Install bash with:

# pkg install bash [enter]
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 2.0MB/s 00:03
Processing entries: 100%
FreeBSD repository update completed. 25860 packages processed.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
bash: 4.4.12

Number of packages to be installed: 1

The process will require 8 MiB more space.
1 MiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
Fetching bash-4.4.12.txz: 100% 1 MiB 730.5kB/s 00:02
Checking integrity... done (0 conflicting)
[1/1] Installing bash-4.4.12...
[1/1] Extracting bash-4.4.12: 100%
Message from bash-4.4.12:
======================================================================

bash requires fdescfs(5) mounted on /dev/fd

If you have not done it yet, please do the following:

mount -t fdescfs fdesc /dev/fd

To make it permanent, you need the following lines in /etc/fstab:

fdesc /dev/fd fdescfs rw 0 0

======================================================================
#

Configuration

# mount -t fdescfs fdesc /dev/fd [enter]
#

Make this mount permanent with:

Start editing file /etc/fstab with;

# echo 'fdesc /dev/fd fdescfs rw 0 0' >> /etc/fstab
#

Change the current user’s shell setting to bash with:

# chsh -s /usr/local/bin/bash user [enter]
chsh: user information updated
# chsh -s /usr/local/bin/bash root [enter]
chsh: user information updated
#

Verify that bash is the default shell for user account user, with:

# cat /etc/passwd | grep user
.
.
.
user:*:1001:1001:Example User:/home/user:/usr/local/bin/bash
.
.
#

Verify that bash is the default shell for user account root, with:

# cat /etc/passwd | grep root
.
.
root:*:0:0:Charlie &:/root:/usr/local/bin/bash
.
.
#

Optional: Colorized ‘ls’ and ‘ll’ in BASH

Description

Enable ls color and add command ll with some color.

Configuration

Add two alias commands to file /etc/profile for all users with:

# echo "alias ll='ls -lGF'" >> /etc/profile; echo "alias ls='ls -GF'" >> /etc/profile [enter]
#

Revoke Privileges

Revoke superuser privileges with:

# exit [enter]
$

Log off your system with:

$ exit [enter]

Log Console Messages to File

Messages printed to the console during boot will pass by too fast to be read, or are too long to be copied.

Login to your system via a remote ssh session.

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
[root@server /usr/home/user]#

Enable all writes to /dev/console to be logged to file /var/log/console.log with:

[root@server /usr/home/user]# ee /etc/syslog.conf [enter]

…and then uncomment line 21 as in this example:

console.info /var/log/console.log

Create file /var/log/console.log with:

[root@server /usr/home/user]# touch /var/log/console.log [enter]
[root@server /usr/home/user]#

…and then change file modes to mode 600 with:

[root@server /usr/home/user]# chmod 600 /var/log/console.log [enter]
[root@server /usr/home/user]#

Restart syslogd to log all new console messages to file /var/log/console.log with:

[root@server /usr/home/user]# service syslogd restart [enter]
Stopping syslogd.
Waiting for PIDS: 808.
Starting syslogd.
[root@server /usr/home/user]#

A reboot is required to record all console messages on system boot. Reboot the system with:

[root@server /usr/home/user]# reboot [enter]

Wait for system to reboot and the log back in with a remote ssh client session.

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
[root@server /usr/home/user]#

Display file /var/log/console.log with:

[root@server /usr/home/user]# cat /var/log/console.log [enter]

…and look for ERRORs and WARNINGs as in this example:

.
.
Jan 14 15:51:11 server kernel: WARNING:
Jan 14 15:51:11 server kernel: New keymap: In /etc/rc.conf replace 'keymap=swedish.cp850.kbd' by 'keymap=se'.
.
.

If any errors and warnings is found, fix the problem and restart service syslogd as described above.

N.B.: The error displayed above has been fixed in the /etc/rc.conf example below!

Packet Filter (PF) Firewall

This PF setup is configured be very secure. All attempts to access the server via the network is blocked on all network ports with one critical exception; ssh clients on the local network using port 123 can access to allow for management of the headless server.

The example setup is designed to be used on a Headless Server with a single network interface card connected to a local network behind a firewall for internet access.

List LAN Network Card

List status up network interfaces with:

[root@server /usr/home/user]# ifconfig -u [enter]
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO>
ether xx:xx:xx:xx:xx:xx
inet 192.168.1.114 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
groups: lo
[root@server /usr/home/user]#

In this example Network Interface Card em0 will be used.

Packet Filter (pf) Config File

Create file /etc/pf.conf with:

[root@server /usr/home/user]# ee /etc/pf.conf [enter]

…and copy this text to the file:

################ FreeBSD pf.conf ##########################################
# Required order: options, normalization, queueing, translation, filtering.
# Note: translation rules are first match while filter rules are last match.
################ Macros ####################################################

# Macros
lan_if="em0" # Local Network Interface Card

# Ports:
# 123 TCP Network Time Protocol

tcp_pass="{ 123 }"

# Tables

### Options
set block-policy return

### Normalization
scrub on $lan_if all random-id reassemble tcp fragment reassemble

### Queueing

### Translation

### Filtering

# Skip filtering on loopback
set skip on lo0

# Block traffic trying to get into the loopback interface from outside.
block quick from any to lo0:network

# Block all traffic in on LAN NIC by default
block in on $lan_if

# Pass specified traffic in to this server from LAN clients
pass in on $lan_if proto tcp from $lan_if:network to $lan_if port $tcp_pass

# Pass SSH traffic from LAN clients (for Admin)
pass in on $lan_if proto tcp from $lan_if:network to $lan_if port ssh

# Pass icmp (for ping) on LAN NIC
pass in on $lan_if proto icmp

# Pass all traffic out on LAN NIC by default
pass out on $lan_if proto { tcp, udp, icmp } all

N.B.: Update lan_if=”em0″ to match your systems LAN Internet Network Card ID!

Display the default packet filter (pf) and packet filter logging (pflog) settings with:

[root@server /usr/home/user]# cat /etc/defaults/rc.conf | grep -e "pf_\|pflog_" [enter]
pf_enable="NO" # Set to YES to enable packet filter (pf)
pf_rules="/etc/pf.conf" # rules definition file for pf
pf_program="/sbin/pfctl" # where the pfctl program lives
pf_flags="" # additional flags for pfctl
pflog_enable="NO" # Set to YES to enable packet filter logging
pflog_logfile="/var/log/pflog" # where pflogd should store the logfile
pflog_program="/sbin/pflogd" # where the pflogd program lives
pflog_flags="" # additional flags for pflogd
[root@server /usr/home/user]#

Service start on Boot

List installed pf services with:

[root@server /usr/home/user]# service -r | grep /pf [enter]
/etc/rc.d/pfsync
/etc/rc.d/pflog
/etc/rc.d/pf
[root@server /usr/home/user]#

Find the rcvar for /etc/rc.d/pf with:

[root@server /usr/home/user]# /etc/rc.d/pf rcvar [enter]
# pf : Packet filter
#
pf_enable="NO"
# (default: "")

[root@server /usr/home/user]#

..and for /etc/rc.d/pflog with:

[root@server /usr/home/user]# /etc/rc.d/pflog rcvar [enter]
# pf : Packet filter
#
pflog_enable="NO"
# (default: "")

[root@server /usr/home/user]#

Enable packet filter (pf) and packet filter logging (pflog) at boot with:

[root@server /usr/home/user]# echo '' >> /etc/rc.conf; echo '# Packet Filter (pf)' >> /etc/rc.conf; echo 'pf_enable="YES"' >> /etc/rc.conf; echo 'pflog_enable="YES"' >> /etc/rc.conf [enter]
[root@server /usr/home/user]#

Check /etc/pf.conf for errors, but do not load ruleset with:

[root@server /usr/home/user]# pfctl -vvnf /etc/pf.conf [enter]
int_if = "em0"
tcp_pass = "{ 123 }"
set block-policy return
set skip on { lo0 }
@0 scrub on em0 all random-id reassemble tcp fragment reassemble
@0 block return quick inet6 from any to ::1
@1 block return quick inet from any to 127.0.0.0/8
@2 block return in on em0 all
@3 pass in on em0 inet proto tcp from 192.168.1.0/24 to 192.168.1.5 port = ntp flags S/SA keep state
@4 pass in on em0 inet proto tcp from 192.168.1.0/24 to 192.168.1.5 port = netbios-ssn flags S/SA keep state
@5 pass in on em0 inet proto tcp from 192.168.1.0/24 to 192.168.1.5 port = microsoft-ds flags S/SA keep state
@6 pass in on em0 inet proto tcp from 192.168.1.0/24 to 192.168.1.5 port = ssh flags S/SA keep state
@7 pass in on em0 proto icmp all keep state
@8 pass out on em0 proto tcp all flags S/SA keep state
@9 pass out on em0 proto udp all keep state
@10 pass out on em0 proto icmp all keep state
[root@server /usr/home/user]#

Manually start the packet filter (pf) with:

[root@server /usr/home/user]# service pf start [enter]
Enabling pf

N.B.: This may disconnect the current ssh connections!

If you are disconnected, open a new remote ssh terminal session to the server and enable superuser privileges with:

[user@server ~]$ sudo -s
[root@server /usr/home/user]#

If everything is alright, then you will be able to verify the packet filter (pf) status with:

[root@server /usr/home/user]# service pf status [enter]
Status: Enabled for 0 days 00:13:15 Debug: Urgent

State Table Total Rate
current entries 1
searches 222 0.3/s
inserts 1 0.0/s
removals 0 0.0/s
Counters
match 79 0.1/s
bad-offset 0 0.0/s
fragment 0 0.0/s
short 0 0.0/s
normalize 0 0.0/s
memory 0 0.0/s
bad-timestamp 0 0.0/s
congestion 0 0.0/s
ip-option 0 0.0/s
proto-cksum 14 0.0/s
state-mismatch 0 0.0/s
state-insert 0 0.0/s
state-limit 0 0.0/s
src-limit 0 0.0/s
synproxy 0 0.0/s
map-failed 0 0.0/s
[root@server /usr/home/user]#

N.B.: Verify that the pf status is Enabled as in the example above.

Reload updates to /etc/pf.conf file with:

[root@server /usr/home/user]# service pf reload [enter]
[root@server /usr/home/user]#

…or load another file – in this example file /etc/pf.new – with:

[root@server /usr/home/user]# pfctl -vf /etc/pf.new [enter]
[root@server /usr/home/user]#

To see in real-time who is trying to connect to your server:

[root@server /usr/home/user]# tcpdump -n -e -ttt -i pflog0 [enter]
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on pflog0, link-type PFLOG (OpenBSD pflog file), capture size 262144 bytes

When network activites is detected it will be listas as in this example:

00:00:00.000000 rule 28..16777216/0(match): block in on em0: 192.168.1.11.138 > 192.168.1.255.138: NBT UDP PACKET(138)
00:00:40.080628 rule 28..16777216/0(match): block in on em0: 192.168.1.11.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:25.057112 rule 28..16777216/0(match): block in on em0: 192.168.1.127.138 > 192.168.1.255.138: NBT UDP PACKET(138)
00:01:00.244084 rule 28..16777216/0(match): block in on em0: 192.168.1.10.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:13.685497 rule 28..16777216/0(match): block in on em0: 192.168.1.124.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:00.749718 rule 28..16777216/0(match): block in on em0: 192.168.1.124.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:00.096546 rule 28..16777216/0(match): block in on em0: 192.168.1.124.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:00.653724 rule 28..16777216/0(match): block in on em0: 192.168.1.124.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:00.093843 rule 28..16777216/0(match): block in on em0: 192.168.1.124.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
00:00:00.750227 rule 28..16777216/0(match): block in on em0: 192.168.1.124.137 > 192.168.1.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST

Hit [ ctr ] and [ C ] to abort.

^C
10 packets captured
10 packets received by filter
0 packets dropped by kernel
[root@server /usr/home/user]#

In this example a HP LaserJet printer is broadcasting UDB packages, port 137 – ‘NetBIOS Name Service, used for name registration and resolution’ – and port 138 – ‘NetBIOS Datagram Service’.

Show history:

[root@server /usr/home/user]# tcpdump -n -e -ttt -r /var/log/pflog [enter]

And that’s it. You have successfully implemented PF firewall on your FreeBSD server!

Configuration Files

/etc/rc.conf

The file rc.conf contains descriptive information about the local host name, configuration details for any potential network interfaces and which services should be started up at system initial boot time. In new installations, the rc.conf file is generally initialized by the system installation utility.

[root@server /usr/home/user]# cat /etc/rc.conf [enter]

Example: When option < Yes >, use DHCP, was selected in the Network Configuration dialog.

clear_tmp_enable="YES"
sendmail_enable="NONE"
hostname="server.example.net"
keymap="se"
ifconfig_em0="DHCP"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"
# ahci Advanced Host Controller Interface (AHCI)
# coretemp Device driver for Intel Core on-die digital thermal sensor
# i915kms Intel Graphics
kld_list="ahci coretemp i915kms"

# Network Time Protocol
ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift -g"

# Packet Filter (pf)
pf_enable="YES"
pflog_enable="YES"

Example: When option < No >, use DHCP, was selected in the Network Configuration dialog.

clear_tmp_enable="YES"
sendmail_enable="NONE"
hostname="server.example.net"
keymap="se"
ifconfig_em0="inet 192.168.1.4 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"

# Network Time Protocol
ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift -g"

# ahci Advanced Host Controller Interface (AHCI)
# coretemp Device driver for Intel Core on-die digital thermal sensor
# i915kms Intel Graphics
kld_list="ahci coretemp i915kms"

# Packet Filter (pf)
pf_enable="YES"
pflog_enable="YES"

Information will be added as required by programs and services installed on the system.

The ifconfig_em0 entry in the example file above

/boot/loader.conf

The file loader.conf contains descriptive information on bootstrapping the system. Through it you can specify the kernel to be booted, parameters to be passed to it, and additional modules to be loaded; and generally set all variables described in loader(8).

[root@server /usr/home/user]# cat /boot/loader.conf

Example: New installation of FreeBSD.

kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
vfs.zfs.min_auto_ashift=12
zfs_load="YES"

Example: Modules and parameters added for a Intel HW based FreeBSD Server.

kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
vfs.zfs.min_auto_ashift=12
zfs_load="YES"

# How many seconds to sit at the boot menu before booting
autoboot_delay="3"

# Use new graphical consol driver
kern.vty="vt"
hw.vga.textmode=1

# Displayed the colored Beastie logo to the right of the boot options menu
loader_logo="beastie"

Optional: Add Local User

The adduser utility is a shell script, implemented around the pw(8) command, for adding new users.

N.B.: Remember to invite the user into other group wheel to enable this user login remotely via a ssh client!

Create a new local user for remote login with:

[root@server /usr/home/user]# sudo adduser [enter]
Password: <-- passwd [enter]
Username: username [enter]
Full name: Full Name [enter]
Uid (Leave empty for default):
Login group [username]:
Login group is username. Invite username into other groups? []: wheel [enter]
Login class [default]:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/username]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : username
Password : *****
Full Name : Full Name
Uid : 1001
Class :
Groups : username wheel
Home : /home/username
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no): yes [enter]
adduser: INFO: Successfully added (username) to the user database.
Add another user? (yes/no): no [enter]
Goodbye!
[root@server /usr/home/user]#

Completion of Basic Installation

Power off the server with:

[root@server /usr/home/user]# poweroff [enter]

Wait for the server to perform power off, disconnect the monitor and the keyboard and then start the server again.

That’s it!

Your FreeBSD Headless Server is now ready for the next step, installation of services and utilities to fulfill your need of a secure and reliable local data and web server for your home or small office.