├── 4.4BSD-brief-intro.adoc ├── OpenBSD-pfctl-cheatsheet.adoc ├── README.md ├── Story-BSD-UNIX.png ├── Unix-Architecture.png ├── firewall.adoc ├── installer.adoc ├── jobs.png ├── latest-version.adoc ├── package.adoc ├── process.adoc ├── single-user-mode.adoc ├── sources.list ├── startup.adoc └── which-one.adoc /4.4BSD-brief-intro.adoc: -------------------------------------------------------------------------------- 1 | == 4.4 BSD 2 | 3 | *BSD* (Berkeley Software Distribution), sometimes called Berkeley Unix, 4 | it is the Unix operating system developed and distributed by the Computer 5 | Systems Research Group (*CSRG*) of the University of California, Berkeley, from 1977 to 1995. 6 | 7 | Historically, BSD has been considered as a branch of UNIX — "BSD UNIX", 8 | because it shared the initial codebase and design with the original AT&T UNIX operating system. 9 | 10 | The final release from Berkeley was 1995's 4.4BSD-Lite Release 2, 11 | after which the CSRG was dissolved and development of BSD at Berkeley ceased. 12 | Since then, several variants based directly or indirectly on 4.4BSD-Lite 13 | (such as FreeBSD, NetBSD, OpenBSD and DragonFly BSD) have been maintained. 14 | -------------------------------------------------------------------------------- /OpenBSD-pfctl-cheatsheet.adoc: -------------------------------------------------------------------------------- 1 | == OpenBSD pfctl cheatsheet 2 | 3 | - General PFCTL Commands 4 | 5 | .... 6 | pfctl -d # disable packet-filtering 7 | pfctl -e # enable packet-filtering 8 | pfctl -q # run quiet 9 | pfctl -vv # run even more verbose 10 | .... 11 | 12 | - Loading PF Rules 13 | 14 | .... 15 | pfctl -f /etc/pf.conf # load /etc/pf.conf 16 | pfctl -n -f /etc/pf.conf # parse /etc/pf.conf, but dont load it 17 | pfctl -R -f /etc/pf.conf # load only the FILTER rules 18 | pfctl -N -f /etc/pf.conf # load only the NAT rules 19 | pfctl -O -f /etc/pf.conf # load only the OPTION rules 20 | .... 21 | 22 | - Clearing PF Rules & Counters 23 | 24 | .... 25 | pfctl -F all # flush ALL 26 | pfctl -F rules # flush only the RULES 27 | pfctl -F queue # flush only queue’s 28 | pfctl -F nat # flush only NAT 29 | pfctl -F info # flush all stats that are not part of any rule. 30 | pfctl -z # clear all counters 31 | .... 32 | _**Note:** flushing rules do not touch any existing stateful connections_ 33 | 34 | 35 | - Get PF Information 36 | 37 | .... 38 | pfctl -s rules # show filter information 39 | pfctl -v -s rules # show filter information for what FILTER rules hit.. 40 | pfctl -vvsr # show filter information as above and prepend rule numbers 41 | pfctl -v -s nat # show NAT information, for which NAT rules hit.. 42 | pfctl -s nat -i xl1 # show NAT information for interface xl1 43 | pfctl -s queue # show QUEUE information 44 | pfctl -s label # show LABEL information 45 | pfctl -s state # show contents of the STATE table 46 | pfctl -s info # show statistics for state tables and packet normalization 47 | pfctl -s all # show everything 48 | .... 49 | 50 | - Maintaining PF Tables 51 | 52 | .... 53 | pfctl -t blacklist -T show # show table blacklist 54 | pfctl -vvsTables # view global information about all tables 55 | pfctl -t blacklist -T add 10.100.1.1 # add entry to table blacklist 56 | pfctl -t blacklist -T add 10.100.1.0/24 # add a network to table blacklist 57 | pfctl -t blacklist -T delete 10.100.1.0./24 # delete nework from table blacklist 58 | pfctl -t blacklist -T flush # remove all entries from table blacklist 59 | pfctl -t blacklist -T kill # delete table blacklist entirely 60 | pfctl -t blacklist -T replace -f /etc/blacklist # reload table blacklist on the fly 61 | pfctl -t blacklist -T test 10.100.1.150 # check IP is present in the table blacklist 62 | pfctl -T load -f /etc/pf.conf # load a new table definition 63 | pfctl -t blacklist -T show -v # output stats for each ip address in table blacklist 64 | pfctl -t blacklist -T zero # reset all counters for table blacklist 65 | .... 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🔖 bsd.specialist 2 | *The main goal of this repo is to help you to pass the LPI 702-100 exam successfully!* 3 | 4 | > ## NEWS FROM LPI 5 | > May 13, 2020 6 | > 7 | > Linux Professional Institute to Offer Online Testing 8 | In response to the closing of many of its global testing locations, Linux Professional Institute (LPI) will offer online testing to candidates. 9 | > 10 | > LPI will begin offering the Linux Essentials and LPIC-1 (101 and 102) exams in English via the Pearson VUE OnVUE system on May 31, 2020. Candidates will be able to write the exams and get certified from home. Additional exams and languages will be made available as soon as possible. Candidates will be able to schedule their online exams beginning May 31. Further instructions on the registration and testing process will be published on https://www.lpi.org/coronavirus. 11 | 12 | ## Course Curriculum 13 | 14 | ### A brief introduction about 4.4BSD 15 | 16 | ### 1. BSD Installation and Software Management 17 | 18 |      a. BSD Operating System Installation 19 | 20 |      b. BSD Software and Package Management 21 | 22 |      c. BSD System Startup Configuration 23 | 24 |      d. Hardware Configuration 25 | 26 |      e. BSD Kernel Parameters and System Security Level 27 | 28 | ### 2. Storage Devices and BSD Filesystems 29 | 30 |      a. BSD Partitioning and Disk Labels 31 | 32 |      b. Create File Systems and Maintain their Integrity 33 | 34 |      c. Control Mounting and Unmounting of File Systems 35 | 36 |      d. Manage File Permissions and Ownership 37 | 38 |      e. Create and Change Hard and Symbolic Links 39 | 40 |      f. Find Files and BSD Directory Layout 41 | 42 | ### 3. Basic BSD System Administration 43 | 44 |      a. Manage User Accounts and Groups 45 | 46 |      b. Automate System Administration Tasks by Scheduling Jobs 47 | 48 |      c. Maintain System Time 49 | 50 |      d. System Logging 51 | 52 |      e. Mail Transfer Agents (MTA) Basics 53 | 54 |      f. Manage Printing and Print Jobs 55 | 56 |      g. Manage User Sessions 57 | 58 | ### 4. Basic BSD Network Administration 59 | 60 |      a. Fundamentals of Internet Protocols 61 | 62 |      b. Basic network configuration 63 | 64 |      c. Basic network troubleshooting 65 | 66 |      d. Configure Client Side DNS 67 | 68 | ### 5. Basic Unix Skills 69 | 70 |      a. Use the Shell and Work on the Command Line 71 | 72 |      b. Perform basic file management 73 | 74 |      c. Create, Monitor and Kill Processes 75 | 76 |      d. Use Simple Regular Expressions 77 | 78 |      e. Perform basic file editing operations 79 | 80 |      f. Customize or write simple scripts 81 | 82 | --- 83 | 84 | 👷 Work in progress. Stay tuned! Oh ! Don't forget to add a ⭐ 😊 85 | -------------------------------------------------------------------------------- /Story-BSD-UNIX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wesley974/bsd.specialist/10f4e03d45391daf3b6930ec94409348f5b5fc32/Story-BSD-UNIX.png -------------------------------------------------------------------------------- /Unix-Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wesley974/bsd.specialist/10f4e03d45391daf3b6930ec94409348f5b5fc32/Unix-Architecture.png -------------------------------------------------------------------------------- /firewall.adoc: -------------------------------------------------------------------------------- 1 | == Firewall 2 | * OpenBSD: Packet Fitler (PF) 3 | * FreeBSD: 3 options 4 | - PF 5 | - IPFW 6 | - IPFilter 7 | * NetBSD: 3 options 8 | - an old PF version 9 | - IPFilter 10 | - NPF (you should use this one) 11 | -------------------------------------------------------------------------------- /installer.adoc: -------------------------------------------------------------------------------- 1 | == System installer 2 | - OpenBSD: *bsd.rd*, a ramdisk kernel, source at http://cvsweb.openbsd.org/src/distrib/miniroot 3 | - FreeBSD: *bsdinstall*, a Bourne shell script, source at https://github.com/freebsd/freebsd/tree/master/usr.sbin/bsdinstall 4 | - NetBSD: *sysinst*, a C program, source at http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/sysinst 5 | -------------------------------------------------------------------------------- /jobs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wesley974/bsd.specialist/10f4e03d45391daf3b6930ec94409348f5b5fc32/jobs.png -------------------------------------------------------------------------------- /latest-version.adoc: -------------------------------------------------------------------------------- 1 | == Latest version 2 | - OpenBSD release 6.7 3 | - FreeBSD release 12.1 4 | - NetBSD release 9.0 5 | -------------------------------------------------------------------------------- /package.adoc: -------------------------------------------------------------------------------- 1 | == Package management 2 | 3 | .Command line 4 | [cols="2,1,1,1", options="header"] 5 | |=== 6 | |Action 7 | |OpenBSD 8 | |FreeBSD 9 | |NetBSD 10 | 11 | |Display information on software packages 12 | |`pkg_info _name_` 13 | |`pkg info _name_` 14 | |`pkg_info _name_` 15 | 16 | |Packages search 17 | |`pkg_info -Q _query_` 18 | |`pkg search _query_` 19 | |`pkgin search _query_` (can be installed from sysinst) 20 | 21 | |Install software packages 22 | |`pkg_add _name_` 23 | |`pkg install _name_` 24 | |`pkg_add _name_` 25 | 26 | |Delete software package distributions 27 | |`pkg_delete _name_` 28 | |`pkg delete _name_` 29 | |`pkg_delete _name_` 30 | |=== 31 | -------------------------------------------------------------------------------- /process.adoc: -------------------------------------------------------------------------------- 1 | == Control process execution 2 | 3 | *jobs*, *bg*, *fg*, *stop*, and *notify* are shell built-in commands. 4 | 5 | TIP: If you are running a job and wish to do something else you may press which sends a STOP signal to the current job. 6 | 7 | TIP: You can run a command line in background just adding a `&` at the end of the line, example: `sleep 10 && echo Hello World &` 8 | 9 | `jobs` displays the status of the jobs that were started in the current shell environment 10 | 11 | `fg _[%job]_` brings the current or specified jobs into the foreground, continuing them if they were stopped. 12 | 13 | `bg _[%job]_` puts the current or specified jobs into the background, continuing them if they were stopped. 14 | 15 | `stop _%job_` stops the current or specified jobs that are executing in the background. 16 | 17 | `notify _[%job]_` causes the shell to notify the user asynchronously when the status of the current or specified jobs change. 18 | 19 | WARNING: `notify` is not available on ksh, and sh. 20 | -------------------------------------------------------------------------------- /single-user-mode.adoc: -------------------------------------------------------------------------------- 1 | == Booting to Single-User Mode 2 | 3 | Once init takes control of the booting process, it can place the system in single-user mode instead of completing all the 4 | initialization tasks required for multiuser mode. Single-user mode is a system state designed for administrative and 5 | maintenance activities, which require complete and unshared control of the system. This system state is selected by a 6 | special boot command parameter or option; on some systems, the administrator may select it by pressing a designated key 7 | at a specific point in the boot process. 8 | 9 | To initiate single-user mode, init forks to create a new process, which then executes the default 10 | shell (usually /bin/sh) as user root. The prompt in single-user mode is the number sign (#), 11 | the same as for the superuser account, reflecting the root privileges inherent in it. Single-user mode is occasionally 12 | called maintenance mode . 13 | 14 | Another situation in which the system might enter single-user mode automatically occurs if there are any problems 15 | in the boot process that the system cannot handle on its own. Examples of such circumstances include filesystem problems 16 | that fsck cannot fix in its default mode and errors in one of the system initialization files. The system administrator 17 | must then take whatever steps are necessary to resolve the problem. Once this is done, booting may continue to multiuser 18 | mode by entering CTRL-D, terminating the single-user mode shell. 19 | 20 | Single-user mode represents a minimal system startup. Although you have root access to the system, many of the normal system 21 | services are not available at all or are not set up. On a mundane level, the search path and terminal type are often not 22 | set correctly. Less trivially, no daemons are running, so many Unix facilities are shut down (e.g., printing). In general, 23 | the system is not connected to the network. The available filesystems may be mounted read-only, so modifying files is initially 24 | disabled (we’ll see how to overcome this in a bit). Finally, since only some of the filesystems are mounted, only commands 25 | that physically reside on these filesystems are available initially. 26 | 27 | This limitation is especially noticeable if /usr was created on a separate disk partition from the root filesystem and is 28 | not mounted automatically under single-user mode. In this case, even commands stored in the root filesystem (in /bin, for example) 29 | will not work if they use shared libraries stored under /usr. Thus, if there is some problem with the /usr filesystem, you will 30 | have to make do with the tools that are available. For such situations, however rare and unlikely, 31 | you should know how to use the ed editor if vi is not available in single-user mode; you should know which tools are 32 | available to you in that situation before you have to use them. 33 | 34 | On a few systems, vendors have exacerbated this problem by making /bin a symbolic link to /usr/bin, thereby rendering the 35 | system virtually unusable if there is a problem with a separate /usr filesystem. 36 | 37 | Now, how to boot manually in single user mode ? 38 | 2 ways : 39 | 40 | - On startup, at the boot prompt: 41 | 42 | .... 43 | boot> boot -s 44 | .... 45 | 46 | - Or using the file /etc/boot.conf: 47 | 48 | .... 49 | # echo "boot -s" >> /etc/boot.conf 50 | .... 51 | -------------------------------------------------------------------------------- /sources.list: -------------------------------------------------------------------------------- 1 | https://www.it-training.pro/courses/702-100-linux-professional-institute-bsd-specialist 2 | https://www.lpi.org/our-certifications/exam-702-objectives 3 | https://software.fandom.com/wiki/Berkeley_Software_Distribution 4 | https://www.networxsecurity.org/members-area/glossary/b/bsd.html 5 | https://www.oreilly.com/library/view/essential-system-administration/0596003439/ch04s01.html 6 | http://www.openbsd.org 7 | http://www.freebsd.org 8 | http://www.netbsd.org 9 | https://idoc.pub/documents/the-bsd-family-tree-gen5d7x0354o 10 | http://bsdwiki.reedmedia.net/PDF/book-8.5x11-20111124.pdf 11 | https://netbsd.gw.com 12 | https://man.openbsd.org/boot_amd64.8 13 | https://www.netmeister.org/book/principles-of-system-administration.pdf 14 | -------------------------------------------------------------------------------- /startup.adoc: -------------------------------------------------------------------------------- 1 | == OpenBSD startup process 2 | 3 | == Cold starts 4 | 5 | PC computers and clones will perform a POST (Power On Self Test) upon being booted cold. This test will find and initialize memory, keyboard, and other devices. It will search for and initialize any extension ROMs that are present, and then attempt to boot the operating system from an available boot drive. 6 | 7 | == Warm starts 8 | 9 | The BIOS loads the first block (at physical location: track 0, head 0, sector 1) off the boot device into memory, and if the last two bytes in the block match the signature 0xAA55, the BIOS considers the block a valid bootable drive. The BIOS then proceeds to call the machine code program in this block. 10 | 11 | There are two different types of boot blocks on devices. There is the MBR (master boot record) and the PBR (partition boot record). A digression into a little piece of history will quickly give light as to why this is so. In the beginning, the PC “architecture” came with single or dual floppy drives, and no hard drives. The only type of bootable sectors on any device were the PBRs. They were responsible for loading the rest of the operating system from the correct device. When hard disks came out, it was felt that such a huge space should be able to be partitioned into separate drives, and this is when the MBR was invented. 12 | 13 | The MBR relocates itself upon being loaded and invoked by the BIOS. Embedded within the MBR is a partition table, with four partition table entries. The MBR code traverses this table (which was loaded with the MBR by the BIOS), looking for an active entry, and then loads the MBR or PBR from the disk location specified by the partition table entry. So in reality, the MBR is nothing more than a fancy chaining PBR. 14 | 15 | On most OpenBSD systems, booting OpenBSD from the BIOS will load the OpenBSD-specific first-stage bootstrap, biosboot(8), which in turn will locate and load the second-stage bootstrap, boot(8). 16 | -------------------------------------------------------------------------------- /which-one.adoc: -------------------------------------------------------------------------------- 1 | == Which one to choose ? 2 | - OpenBSD: _secure-by-default_ has produced one of the most robust operating systems available. OpenBSD claims three years without a 3 | remote root-exploit allowing many system administrators to sleep better at night. 4 | - FreeBSD: provides a stable and fast general purpose operating system that may be used for any purpose without strings attached. 5 | - NetBSD: provides a portable system, which runs on many hardware platforms. 6 | --------------------------------------------------------------------------------