Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions curriculum/linux/level-3/Install and Configure SFTP/Solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### Solution

```shell

sshpass -p Ir0nM@n ssh -o StrictHostKeyChecking=no tony@172.16.238.10


# 1. Create user 'ammar' in 'ftp' group
sudo useradd -m -g ftp -s /bin/bash ammar

# 2. Set password to 'LQfKeWWxWD'
echo "ammar:LQfKeWWxWD" | sudo chpasswd

# 3. Verify creation
id ammar


# 4. Create user with nologin shell (blocks SSH)
sudo useradd -m -g ftp -s /sbin/nologin ammar

# 5. Setup chroot directory structure
sudo chown root:root /home/ammar
sudo chmod 755 /home/ammar
sudo mkdir -p /home/ammar/upload
sudo chown ammar:ftp /home/ammar/upload
sudo chmod 755 /home/ammar/upload

# 6. Add to /etc/ssh/sshd_config (at the end)
sudo tee -a /etc/ssh/sshd_config > /dev/null << 'EOF'

Match Group ftp
ChrootDirectory /home/%u
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
EOF

# 7. Test and restart SSH
sudo sshd -t
sudo systemctl restart sshd

# ✅ SFTP should work
sftp ammar@localhost

# ❌ SSH should fail with "sftp connections only"
ssh ammar@localhost

```
41 changes: 41 additions & 0 deletions curriculum/linux/level-3/Install and Configure Tomcat/Solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

### Problem

The Nautilus application development team recently finished the beta version of one of their Java-based applications, which they are planning to deploy on one of the app servers in Stratos DC. After an internal team meeting, they have decided to use the tomcat application server. Based on the requirements mentioned below complete the task:

a. Install tomcat server on App Server 1.

b. Configure it to run on port 6400.

c. There is a ROOT.war file on Jump host at location /tmp.


Deploy it on this tomcat server and make sure the webpage works directly on base URL i.e curl http://stapp01:6400


### Solution

```shell

sudo yum update

sudo yum install tomcat

# Configure port 6400
sudo sed -i 's/port="8080"/port="6400"/' /etc/tomcat/server.xml

# Copy to /tmp first
scp /tmp/ROOT.war tony@stapp01.stratos.xfusioncorp.com:/tmp/

# Deploy ROOT.war (copy from Jump Host first)
sudo rm -rf /var/lib/tomcat/webapps/ROOT*
sudo cp /tmp/ROOT.war /var/lib/tomcat/webapps/
sudo chown tomcat:tomcat /var/lib/tomcat/webapps/ROOT.war

# Start Tomcat
sudo systemctl enable --now tomcat

# Test
curl http://stapp01:6400

```
53 changes: 53 additions & 0 deletions curriculum/linux/level-3/Linux Network Services/Solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
### Problem

Our monitoring tool has reported an issue in Stratos Datacenter. One of our app servers has an issue, as its Apache service is not reachable on port 8084 (which is the Apache port). The service itself could be down, the firewall could be at fault, or something else could be causing the issue.


Use tools like telnet, netstat, etc. to find and fix the issue. Also make sure Apache is reachable from the jump host without compromising any security settings.

Once fixed, you can test the same using command curl http://stapp01:8084 command from jump host.

Note: Please do not try to alter the existing index.html code, as it will lead to task failure.


### Solution

```shell

#### Jumphost

iptables -L -n

#### stapp01

ssh tony@stapp01

curl http://localhost:8084

systemctl status httpd

grep -iR "^Listen" /etc/httpd/

vi /etc/httpd/conf/httpd.conf

netstat -tlnp | grep -i 8084

systemctl stop email
systemctl disbale email

systemctl start httpd
systemctl enable httpd

curl http://localhost:8084

iptables -L -n

iptables -I INPUT 5 -p tcp --dport 8084 -j ACCEPT
service iptables save

exit

#### Jumphost

curl http://localhost:8084
```
28 changes: 24 additions & 4 deletions curriculum/linux/level-3/apache-redirects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ b.) Redirect http://www.stapp01.stratos.xfusioncorp.com:<Port>/blog/ to http://w

sshpass -p Ir0nM@n ssh -o StrictHostKeyChecking=no tony@172.16.238.10

cd /etc/httpd/conf.d
cd /etc/httpd/conf

sudo vi httpd.conf
cat /etc/httpd/conf/httpd.conf | grep Listen
sudo vi httpd.conf
change Listen to 8083
# Add ServerName to main config
echo "ServerName stapp01.stratos.xfusioncorp.com" | sudo tee -a /etc/httpd/conf/httpd.conf

cd /etc/httpd/conf.d

vi xfusion.conf

"
NameVirtualHost *:8083
*:8083

<VirtualHost *:8083>
ServerName stapp01.stratos.xfusioncorp.com
Expand All @@ -42,14 +46,30 @@ NameVirtualHost *:8083
</VirtualHost>
"

echo "Ir0nM@n" | sudo -S systemctl restart httpd
sudo systemctl restart httpd

sudo mkdir -p /var/www/html/news

# If you have content in /blog/, you might want to copy it:
sudo cp -r /var/www/html/blog/* /var/www/html/news/ 2>/dev/null || echo "index" | sudo tee /var/www/html/news/index.html

# Set proper permissions
sudo chown -R apache:apache /var/www/html/news
sudo chmod -R 755 /var/www/html/news

# Test configuration
sudo httpd -t

# Restart Apache
sudo systemctl restart httpd

# How to check
curl -vL http://stapp01.stratos.xfusioncorp.com:8083

curl -vL http://stapp01.stratos.xfusioncorp.com:8083/blog

curl -vL http://stapp01.stratos.xfusioncorp.com:8083/news

```

- See: [Ansible solution](solution.yaml)