Skip to content

MFaouri/Vmware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Assignment #1

Vmware Workstation

Assignment #2

  1. I used Virtual Network Editor to add Virtual Network and i named it VMnet2 with Host-only Type

Screenshot_20230220_020250

  1. Install Pfsense Iso image and then Create Virtual machine
  2. Create New Network Adapter 2 as shows in image

Screenshot_20230220_122210

  1. lunch the Virtual Machine

Screenshot_20230220_121544

  1. WAN (eM0) DHCP4 : 172.29.174.144/20
  2. LAN (eM1) GW : 192.168.1.1/24

Screenshot_20230220_122951

Assignment 3#

  1. ubuntu server1 with ipv4 192.168.1.100 pinging 192.168.1.1

Screenshot_20230220_010311

  1. ubuntu server2 with ipv4 192.168.1.101 pinging 192.168.1.1

Screenshot_20230220_010311

  1. Centos7 server3 with ipv4 192.168.1.104 pinging 192.168.1.1

Screenshot_20230220_010350

Assignment #4

Hardening bash script for ubuntu

#!/bin/bash

#Disable unnecessary services
systemctl disable avahi-daemon.service
systemctl disable cups.service
systemctl disable isc-dhcp-server.service
systemctl disable slapd.service
systemctl disable nfs-server.service

#Configure user accounts and groups
passwd -d root
useradd -m -s /bin/bash user1
usermod -aG sudo user1
useradd -m -s /bin/bash user2
usermod -aG sudo user2
useradd -m -s /bin/bash user3
usermod -aG sudo user3

#Enforce strong password policies
sed -i 's/password    requisite     pam_cracklib.so retry=3 minlen=8 difok=3 ucredit=-1 lc>

#Restrict access to sensitive files and directories
chmod 600 /etc/shadow
chmod 600 /etc/gshadow
chmod 644 /etc/passwd
chmod 644 /etc/group
chmod 644 /etc/security/access.conf
chmod 644 /etc/security/group.conf
chmod 644 /etc/security/passwd
chmod 600 /etc/ssh/sshd_config

# Configure logging and auditing
sed -i 's/#SyslogFacility AUTH/SyslogFacility AUTH/g' /etc/ssh/sshd_config
sed -i 's/#LogLevel INFO/LogLevel INFO/g' /etc/ssh/sshd_config
systemctl restart sshd.service

Hardening bash script for Centos7

#!/bin/bash

#Disable unnecessary services
systemctl disable avahi-daemon.service
systemctl disable cups.service
systemctl disable dhcpd.service
systemctl disable slapd.service
systemctl disable nfs-server.service

#Configure user accounts and groups
passwd -d root
useradd -m -s /bin/bash user1
usermod -aG wheel user1
useradd -m -s /bin/bash user2
usermod -aG wheel user2
useradd -m -s /bin/bash user3
usermod -aG wheel user3

#Enforce strong password policies
sed -i 's/password    requisite     pam_cracklib.so retry=3 minlen=8 difok=3 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1/password    requisite     pam_cracklib.so retry=3 minlen=12 difok=4 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1 enforce_for_root/g' /etc/pam.d/system-auth

#Restrict access to sensitive files and directories
chmod 600 /etc/shadow
chmod 600 /etc/gshadow
chmod 644 /etc/passwd
chmod 644 /etc/group
chmod 644 /etc/security/access.conf
chmod 644 /etc/security/group.conf
chmod 644 /etc/security/passwd
chmod 600 /etc/ssh/sshd_config

#Configure logging and auditing
sed -i 's/#SyslogFacility AUTH/SyslogFacility AUTH/g' /etc/ssh/sshd_config
sed -i 's/#LogLevel INFO/LogLevel INFO/g' /etc/ssh/sshd_config
systemctl restart sshd.service

Assignment #5

  1. docker-compose.yml
version: '3'
services:
  grafana:
    image: grafana/grafana:latest
    ports:
      - "3001:3000"
    restart: always
  prometheus:
    image: prom/prometheus:latest
    ports:
      - "9901:9090"
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    restart: always
  1. prometheus.yml
global:
  scrape_interval:     15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
  
  - job_name: 'node-exporter'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.1.100:9100', '192.168.1.104:9100']

Screenshot_20230220_013122

Screenshot_20230220_013138

Assignment #6

exporters container for ubuntu Server and Grafana Dashboard

Screenshot_20230220_013801

Screenshot_20230220_014219

exporters container for Centos7 Server and Grafana Dashboard

Screenshot_20230220_014243

Screenshot_20230220_013841

Assignment #7

Dockerfile to create HTML static page

FROM nginx:alpine

# Copy index.html to the container
COPY index.html /usr/share/nginx/html

# Expose port 1309
EXPOSE 1309

# Start nginx
CMD ["nginx", "-g", "daemon off;"]

Screenshot_20230220_015644

Assignment #8

Create Dockerfile that writes the numbers from 1 to 10 on a text file named numbers.txt and maps the file to the host directory /opt when the docker-compose up command is run:

FROM alpine:latest

RUN apk add --no-cache bash

CMD ["bash", "-c", "seq 1 10 > /data/numbers.txt && tail -f /dev/null"]

Create docker-compose.yml file that maps the /data/numbers.txt file in the container to the /opt directory on the host:

version: '3'

services:
  numbers:
    build: .
    volumes:
      - type: bind
        source: /opt
        target: /data

Screenshot_20230220_020139

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors