diff --git a/book.toml b/book.toml index b17cd90..308d465 100644 --- a/book.toml +++ b/book.toml @@ -9,4 +9,17 @@ title = "IT Learning Notes" default-theme = "light" preferred-dark-theme = "navy" git-repository-url = "http://192.168.2.2:3003/hugh/it-knowledge.git" -port = 3001 \ No newline at end of file +port = 3001 +mathjax-support = true +no-section-label = true +fold = { enable = true, level = 1 } +additional-css = ["custom.css"] +additional-js = ["custom.js"] + +[build] +build-dir = "book" +create-missing = false +use-default-preprocessors = true + +[preprocessor] +[preprocessor.index] \ No newline at end of file diff --git a/custom.css b/custom.css new file mode 100644 index 0000000..805f9ff --- /dev/null +++ b/custom.css @@ -0,0 +1,87 @@ +/* Custom styling for IT Learning Notes */ + +/* Ensure all sections are properly visible */ +.section { + display: block !important; + visibility: visible !important; + opacity: 1 !important; +} + +/* Improve nested section visibility */ +.chapter li.chapter-item { + margin-left: 1em; +} + +.chapter li.chapter-item.expanded { + margin-left: 0; +} + +/* Better styling for scenario headers */ +h2 { + margin-top: 2em; + border-bottom: 1px solid #ddd; + padding-bottom: 0.3em; +} + +/* Make anchors more reliable */ +h2:before, h3:before { + content: ""; + display: block; + height: 70px; + margin-top: -70px; + visibility: hidden; +} + +/* Styling for code blocks */ +pre { + background-color: #f5f5f5; + border-radius: 4px; + padding: 1em; + overflow-x: auto; +} + +/* Improve table styling */ +table { + width: 100%; + border-collapse: collapse; + margin: 20px 0; +} + +table, th, td { + border: 1px solid #ddd; +} + +th, td { + padding: 12px; + text-align: left; +} + +th { + background-color: #f5f5f5; +} + +/* Style for tags */ +.tag { + background-color: #f0f0f0; + border-radius: 4px; + padding: 3px 6px; + font-size: 0.85em; + font-family: monospace; +} + +/* Ensure content is visible */ +.content { + display: block !important; +} + +/* Fix for potentially hidden elements */ +.hidden { + display: block !important; + visibility: visible !important; +} + +/* Ensure chapters don't disappear */ +.chapter { + display: block !important; + visibility: visible !important; +} \ No newline at end of file diff --git a/custom.js b/custom.js new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/custom.js @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 23f0f32..cbdda9a 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -18,28 +18,34 @@ ## User Management [👤] - [User Management Solutions](solutions/user-management.md) - - [Creating Users with Specific Requirements (v1-S1)](solutions/user-management.md#scenario-creating-users-with-specific-requirements) - - [Departmental User Structure (v1-S1 Expanded)](solutions/user-management.md#scenario-creating-users-with-specific-requirements-1) +- [Creating Users with Specific Requirements (v1-S1)](solutions/user-management.md#scenario-creating-users-with-specific-requirements) +- [Departmental User Structure (v1-S1 Expanded)](solutions/user-management.md#scenario-creating-users-with-specific-requirements-1) ## Storage Management [💾] - [Storage Management Solutions](solutions/storage-management.md) - - [LVM Configuration and Extension (v1-S2)](solutions/storage-management.md#scenario-create-a-new-2gb-partition-on-devsdb-and-extend-the-logical-volume-by-500mb-using-lvm) +- [LVM Configuration and Extension (v1-S2)](solutions/storage-management.md#scenario-v1-s2-lvm-configuration-and-management) +- [Create and Extend Logical Volume (v1-S2)](solutions/storage-management.md#scenario-v1-s2-create-a-new-2gb-partition-on-devsdb-and-extend-the-logical-volume-by-500mb-using-lvm) ## Service Management [⚙️] - [Service Management Solutions](solutions/service-management.md) - - [Time Synchronization and Security (v1-S3)](solutions/service-management.md#scenario-time-synchronization-and-security-configuration) +- [Time Synchronization and Security (v1-S3)](solutions/service-management.md#scenario-v1-s3-time-synchronization-and-security-configuration) ## Networking [🌐] - [Network Solutions](solutions/networking.md) +- [Network Interface Configuration (v1-S7)](solutions/networking.md#scenario-v1-s7-network-interface-configuration) ## Security [🔒] - [Security Solutions](solutions/security.md) +- [SELinux and Firewall Configuration (v1-S3)](solutions/security.md#scenario-v1-s3-selinux-and-firewall-configuration) ## Container Management [📦] - [Container Management Solutions](solutions/container-management.md) +- [Container Deployment (v1-S4)](solutions/container-management.md#scenario-v1-s4-container-management) ## System Recovery & Maintenance [🔧] - [System Recovery Solutions](solutions/system-recovery.md) +- [System Recovery and Maintenance (v1-S5)](solutions/system-recovery.md#scenario-v1-s5-system-recovery-and-maintenance) ## Shell Scripting [📜] - [Shell Scripting Solutions](solutions/shell-scripting.md) +- [File Management Script (v1-S6)](solutions/shell-scripting.md#scenario-v1-s6-shell-scripting) diff --git a/src/solutions/networking.md b/src/solutions/networking.md index 8e7e063..b32347e 100644 --- a/src/solutions/networking.md +++ b/src/solutions/networking.md @@ -34,30 +34,79 @@ From Practice Scenarios v1, Scenario 7: # Check routing ip route show ``` - [My explanation will go here after completing the exercise] + The first step is to identify the current network configuration to understand what needs to be changed. -2. Configure Network Interface +2. Configure Static IPv4 and IPv6 Addresses ```bash - # Network configuration commands - # To be filled with my solution + # Configure static IPv4 address + sudo nmcli connection modify eth0 ipv4.addresses 192.168.1.100/24 ipv4.method manual + + # Configure static IPv6 address + sudo nmcli connection modify eth0 ipv6.addresses 2001:db8:1234:5678::100/64 ipv6.method manual + + # Set default gateways + sudo nmcli connection modify eth0 ipv4.gateway 192.168.1.1 + sudo nmcli connection modify eth0 ipv6.gateway 2001:db8:1234:5678::1 ``` - [My explanation will go here after completing the exercise] + This configures the static IP addresses on the network interface. -3. Apply and Verify Changes +3. Set Hostname ```bash + # Set hostname + sudo hostnamectl set-hostname rhcsa.example.com + + # Update /etc/hosts + sudo echo "127.0.0.1 rhcsa.example.com rhcsa" >> /etc/hosts + ``` + This sets the system hostname and updates the hosts file. + +4. Configure DNS Resolution + ```bash + # Configure DNS servers + sudo nmcli connection modify eth0 ipv4.dns "8.8.8.8 8.8.4.4" + # Apply changes - # To be filled with my solution + sudo nmcli connection up eth0 ``` - [My explanation will go here after completing the exercise] + This configures the DNS servers and applies all the network configuration changes. + +5. Configure Firewall Zones + ```bash + # Create a new zone for restricted access + sudo firewall-cmd --permanent --new-zone=restricted + + # Add services to the zone + sudo firewall-cmd --permanent --zone=restricted --add-service=ssh + sudo firewall-cmd --permanent --zone=restricted --add-service=http + + # Add source network to the zone + sudo firewall-cmd --permanent --zone=restricted --add-source=192.168.1.0/24 + + # Reload firewall + sudo firewall-cmd --reload + ``` + This sets up a new firewall zone that restricts access to only SSH and HTTP from the local network. ### Verification ```bash -# Test connectivity -# To be filled with my verification steps +# Verify IP configuration +ip addr show + +# Verify hostname +hostname + +# Verify DNS resolution +dig google.com + +# Verify firewall zones +sudo firewall-cmd --list-all-zones ``` ### Key Learnings -- [To be filled after completing the exercise] +- Network configuration with NetworkManager +- IPv4 and IPv6 +- Firewall zone management +- DNS configuration ## Skills Demonstrated - Network Configuration diff --git a/src/solutions/security.md b/src/solutions/security.md index 054eb66..e5d9eba 100644 --- a/src/solutions/security.md +++ b/src/solutions/security.md @@ -32,46 +32,80 @@ From Practice Scenarios v1, Scenario 3 (Security Part): # Check SELinux contexts ls -Z /var/www/html ``` - [Explanation of current state] + First we verify that SELinux is in enforcing mode and check the current contexts for the web server directory. 2. Configure SELinux Policies ```bash - # Set SELinux boolean - setsebool -P httpd_can_network_connect on + # Install SELinux policy utilities + sudo dnf install policycoreutils-python-utils + + # Allow Apache to listen on port 8080 + sudo semanage port -a -t http_port_t -p tcp 8080 - # Modify context - semanage fcontext -a -t httpd_sys_content_t "/custom/path(/.*)?" + # Set SELinux boolean for network connections + sudo setsebool -P httpd_can_network_connect on ``` - [Explanation of configuration] + This configures SELinux to allow Apache to listen on port 8080 and enables network connections. 3. Configure Firewall ```bash - # To be filled with my solution + # Check current firewall status + sudo firewall-cmd --list-all + + # Allow HTTP and HTTPS + sudo firewall-cmd --permanent --add-service=http + sudo firewall-cmd --permanent --add-service=https + + # Allow custom port 8080 + sudo firewall-cmd --permanent --add-port=8080/tcp + + # Reload firewall + sudo firewall-cmd --reload ``` - [My explanation will go here after completing the exercise] + This configures the firewall to allow incoming connections on ports 80, 443, and 8080. 4. Secure SSH Configuration ```bash - # To be filled with my solution + # Make a backup of sshd_config + sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak + + # Edit SSH configuration + sudo vi /etc/ssh/sshd_config ``` - [My explanation will go here after completing the exercise] + + Add or modify these lines: + ``` + PermitRootLogin no + PasswordAuthentication no + PubkeyAuthentication yes + ``` + + ```bash + # Restart SSH service + sudo systemctl restart sshd + ``` + This secures SSH by disabling root login and password authentication, requiring key-based authentication. ### Verification ```bash -# Verify SELinux status -sestatus +# Verify SELinux port configuration +sudo semanage port -l | grep http_port_t -# Check audit logs -ausearch -m AVC -ts recent +# Verify firewall configuration +sudo firewall-cmd --list-all -# Test functionality -curl localhost/custom/path +# Verify SSH configuration +sudo sshd -T | grep -E 'permitrootlogin|passwordauthentication|pubkeyauthentication' + +# Test Apache on port 8080 +curl localhost:8080 ``` ### Key Learnings -- Understanding of SELinux concepts -- Security best practices -- Troubleshooting methodology +- Understanding of SELinux port contexts +- Firewall configuration with firewalld +- SSH security best practices +- Verification methodology ## Skills Demonstrated - SELinux Management @@ -96,37 +130,7 @@ From Practice Scenarios v2, Scenario 5: - Required Outcome: Hardened system with granular access controls and application-specific security ### Solution Steps -1. Configure SELinux for custom application - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -2. Implement firewalld rich rules - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -3. Set up ACLs and sudo restrictions - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -4. Configure password policies - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -### Verification -```bash -# To be filled with my verification steps -``` - -### Key Learnings -- [To be filled after completing the exercise] +[To be filled when I complete this exercise] ## Scenario: [v3-S5] Comprehensive Security Setup @@ -154,30 +158,4 @@ From Practice Scenarios v3, Scenario 5: - Required Outcome: Enterprise-grade security implementation with custom policies ### Solution Steps -1. Develop comprehensive SELinux strategy - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -2. Configure advanced firewalld setup - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -3. Implement hardened SSH configuration - ```bash - # To be filled with my solution - ``` - [My explanation will go here after completing the exercise] - -### Verification -```bash -# To be filled with my verification steps -``` - -### Key Learnings -- [To be filled after completing the exercise] - -[Additional scenarios will be documented here as completed] \ No newline at end of file +[To be filled when I complete this exercise] \ No newline at end of file diff --git a/src/solutions/service-management.md b/src/solutions/service-management.md index c209777..a416af0 100644 --- a/src/solutions/service-management.md +++ b/src/solutions/service-management.md @@ -85,8 +85,8 @@ curl localhost ### Environment - OS Version: RHEL/Rocky Linux -- Initial State: -- Required Outcome: +- Initial State: Default installation without time sync or security configurations +- Required Outcome: Properly configured time synchronization, firewall, SELinux, SSH, and automated updates ### Solution Steps 1. Configure chronyd to sync with time server 'time.example.com' @@ -103,8 +103,6 @@ curl localhost # Save and exit :wq - The output should show the chrony service enabled and running - # Enable and start service sudo systemctl enable chronyd sudo systemctl start chronyd diff --git a/src/solutions/storage-management.md b/src/solutions/storage-management.md index ebc47c9..7a3484c 100644 --- a/src/solutions/storage-management.md +++ b/src/solutions/storage-management.md @@ -14,7 +14,7 @@ This section documents my solutions to storage management scenarios, including p ## Scenario: [v1-S2] LVM Configuration and Management ### Original Problem -[To be filled with actual scenario] +Create a new 2GB partition and configure it with LVM. ### Environment - OS Version: RHEL/Rocky Linux diff --git a/src/solutions/user-management.md b/src/solutions/user-management.md index 19d8c78..7264709 100644 --- a/src/solutions/user-management.md +++ b/src/solutions/user-management.md @@ -10,7 +10,7 @@ This section contains my solutions to various user management scenarios from the | [v2-S1] | System Access and File Management - Practice Scenarios v2 | | [v3-S1] | Advanced User Management - Practice Scenarios v3 | -## Scenario: [v1-S1] Creating Users with Specific Requirements +## Scenario: Creating Users with Specific Requirements ### Original Problem From Practice Scenarios v1: Create a user named 'john' with a custom shell and home directory. @@ -54,7 +54,7 @@ From Practice Scenarios v1: Create a user named 'john' with a custom shell and h *** *** -## Scenario: [v1-S1] Creating Users with Specific Requirements (Expanded) +## Scenario: Creating Users with Specific Requirements-1 ### Original Problem - Create a new user called 'analyst1' with home directory '/home/analyst1' @@ -109,7 +109,20 @@ From Practice Scenarios v1: Create a user named 'john' with a custom shell and h This sets the password expiry for 'analyst1' to 90 days ### Verification -Commands used to verify the solution works correctly +Commands used to verify the solution works correctly: +```bash +# Verify user creation +id analyst1 + +# Verify group membership +groups analyst1 + +# Verify directory permissions +ls -la /data/reports + +# Verify password expiry +sudo chage -l analyst1 +``` ### Key Learnings - Understanding of useradd, groupadd, usermod, mkdir, chown, chmod, chage commands