# Practice Exam - Betriebssysteme und Netzwerke ## Exam Information - **Duration:** 45 minutes - **Tasks:** 5 problems to diagnose and fix - **Allowed:** 1x A4 cheat sheet (front and back) --- ## Scenario You are a system administrator for a company. Multiple services on the server have stopped working after a colleague made some changes. Your task is to diagnose and fix all issues. --- ## Task 1: Company Portal Unreachable **Service:** http://company.local **Problem:** The company portal website is not loading. Users report seeing an error page or the page won't load at all. **Expected Result:** The website should display "Company Portal" with "Status: Online" **Test Command:** ```bash curl http://company.local ``` **Category:** Web Server Configuration --- ## Task 2: Online Shop Shows 403 Forbidden **Service:** http://shop.local **Problem:** The online shop returns a "403 Forbidden" error when accessed. **Expected Result:** The website should display "Online Shop" with "Status: Online" **Test Command:** ```bash curl http://shop.local ``` **Category:** File System Permissions --- ## Task 3: API Returns 502 Bad Gateway **Service:** http://api.local:8080 **Problem:** The REST API returns a "502 Bad Gateway" error instead of JSON data. **Expected Result:** The API should return a JSON response with `"status": "success"` **Test Command:** ```bash curl http://api.local:8080 ``` **Category:** Service Management (systemd) --- ## Task 4: Docker Application Unreachable **Service:** http://localhost:8888 **Problem:** The Docker web application running on port 8888 is not accessible. The connection times out. **Expected Result:** The page should display "Docker Application" running in a container. **Test Command:** ```bash curl http://localhost:8888 ``` **Hint:** The Docker container itself is running correctly. **Category:** Firewall (UFW) --- ## Task 5: Database Connection Refused **Service:** MySQL Database **Problem:** The web application cannot connect to the MySQL database. Connection attempts with the `webuser` account are being refused. **Credentials:** - Username: `webuser` - Password: `WebPass123!` - Database: `practicedb` **Expected Result:** Should be able to connect and query the database. **Test Command:** ```bash mysql -u webuser -p'WebPass123!' practicedb -e "SELECT * FROM products;" ``` **Category:** Database Administration --- ## Verification Run the verification script to check your progress: ```bash sudo ./break_server.sh # Then select option 7) Verify all services ``` Or test each service manually with the curl commands above. --- ## Diagnostic Commands Reference | Tool | Purpose | |------|---------| | `systemctl status ` | Check service status | | `systemctl start/restart ` | Start or restart service | | `nginx -t` | Test nginx configuration | | `journalctl -u ` | View service logs | | `ufw status` | Check firewall rules | | `ss -tulnp` | Show listening ports | | `ls -la ` | Check file permissions | | `docker ps` | List running containers | | `cat /var/log/nginx/error.log` | View nginx error logs | --- ## Good Luck! Remember to work systematically: 1. Identify the symptom 2. Check service status 3. Review configuration/logs 4. Apply the fix 5. Verify the solution --- *Practice Exam - Betriebssysteme und Netzwerke*