0
0
Cybersecurityknowledge~30 mins

Why OS hardening reduces attack surface in Cybersecurity - See It in Action

Choose your learning style9 modes available
Why OS Hardening Reduces Attack Surface
📖 Scenario: You are a cybersecurity trainee learning how to protect computers from attacks. One important way is to make the operating system (OS) more secure by removing or fixing weak points. This process is called OS hardening.
🎯 Goal: Build a simple explanation using a list of common OS features and then mark which ones to disable or secure. This will show how OS hardening reduces the attack surface by limiting what attackers can use to break in.
📋 What You'll Learn
Create a dictionary called os_features with these exact entries: 'File Sharing': True, 'Remote Desktop': True, 'Unused Services': True, 'Default Passwords': True, 'Firewall': False
Create a variable called features_to_disable and set it to a list containing 'File Sharing', 'Remote Desktop', and 'Unused Services'
Create a new dictionary called hardened_os using dictionary comprehension that sets the value to False for all features in features_to_disable and keeps the original value for others
Add a final line that sets hardened_os['Firewall'] to True to show enabling protection
💡 Why This Matters
🌍 Real World
OS hardening is a key step in protecting computers and servers from hackers by reducing the number of ways they can attack.
💼 Career
Cybersecurity professionals use OS hardening to secure systems before deploying them in networks, reducing risks and improving safety.
Progress0 / 4 steps
1
Create the initial OS features dictionary
Create a dictionary called os_features with these exact entries: 'File Sharing': True, 'Remote Desktop': True, 'Unused Services': True, 'Default Passwords': True, 'Firewall': False
Cybersecurity
Need a hint?

Use curly braces to create a dictionary with the exact keys and values given.

2
Create the list of features to disable
Create a variable called features_to_disable and set it to a list containing 'File Sharing', 'Remote Desktop', and 'Unused Services'
Cybersecurity
Need a hint?

Use square brackets to create a list with the exact feature names.

3
Create the hardened OS dictionary with updated feature states
Create a new dictionary called hardened_os using dictionary comprehension that sets the value to False for all features in features_to_disable and keeps the original value from os_features for others
Cybersecurity
Need a hint?

Use dictionary comprehension with a condition to set values to False for features to disable.

4
Enable the firewall in the hardened OS
Add a final line that sets hardened_os['Firewall'] to True to show enabling protection
Cybersecurity
Need a hint?

Assign True to the 'Firewall' key in the hardened_os dictionary.