Lab 1 Setting up ssh

cat ~/.ssh/id_rsa.pub | ssh @HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"







1. SSH config for VM unclear if it is completed need lab 1

2.1 Fixed Hosts --done

2.2
sudo apt-get install resolvconf
sudo systemctl start resolvconf.service
sudo systemctl enable resolvconf.service
sudo systemctl status resolvconf.service

sudo nano /etc/resolvconf/resolv.conf.d/head

make edits
nameserver 8.8.8.8

save
reboot 0

cat /etc/resolv.conf  should have edits

2.3 Knowledge of Apt

3 Install Apache

install synaptic search apache2
install apache

or sudo apt install apache2


3.2 Install Mysql
-install from apt use password given

3.3 install php

sudo apt update
sudo apt install php libapache2-mod-php

sudo systemctl restart apache2

check: firefox localhost/group.php

3.4
gedit /etc/sudoers
serveroperator ALL=(ALL) /sbin/reboot
serveroperator ALL=(ALL) /sbin/service apache2 restart



Eval
cat /etc/resolv.conf   ---> contains 8.8.8.8

cat /etc/hosts ---> contains correct hostname

mysql -u root –p  --> works with password

firefox localhost/group.php ---> works

su serveroperator  ---> exists
sudo reboot 0 ---> works as serveroperator
sudo service apache2 restart ---> works as serveroperator



Lab 3
Create Working directory
mkdir 1520_lab3_jrmuraka
cd 1520_lab3_jrmuraka




1 .
sudo apt install openssl dhex

2.1 (no submission) “openssl enc <ciphertype> -e -in plain.txt -out cipher.bin -k <key_string> -iv <iv_string>”


2.2
Get IU image:
wget https://git.pluricorp.com/dfpena/jack/raw/master/iu.bmp
-aes-128-cbc
-aes-128-ecb



ls - l #3858054

head -c 54 iu.bmp > cbc.bmp
head -c 54 iu.bmp > ecb.bmp

openssl enc -aes-128-cbc -e -in iu.bmp -out cbc.bin -k jacks
openssl enc -aes-128-ecb -e -in iu.bmp -out ecb.bin -k jacks

tail -c 385000 cbc.bin >> cbc.bmp
tail -c 385000 ecb.bin >> ecb.bmp


sudo mv ecb.bmp /var/www/html/ecb.bmp
sudo mv cbc.bmp /var/www/html/cbc.bmp


CBC looks like white noise in the shape of the old image
EBC You can see the structure of the underlying image

2.3

openssl enc -aes-128-cbc -e -in test.txt -out cbc.data -k jacks
openssl enc -aes-128-ecb -e -in test.txt -out ecb.bin -k jacks
openssl enc -aes-128-ofb -e -in test.txt -out ofb.bin -k jacks



dhex cbc.bin
dhex ecb.bin
dhex ofb.bin

openssl enc -d -aes-128-cbc -in cbc.bin -out cbc.txt -k jacks
openssl enc -d -aes-128-ecb -in ecb.bin -out ecb.txt -k jacks
openssl enc -d -aes-128-ofb -in ofb.bin -out ofb.txt -k jacks


a. cbc added bytes to the corrupted byte but the information outside of the corrupted byte remained retrievable
ecb lost all of the information after the corrupted byte
ofb replaced the corrupted byte and all other data remained retrievable

b. ?

c. CBC is not tolerant to dropped or corrupted bytes and in any data transfer scenario CBC would significantly less fault tolerant even if redundant messages are sent. CBC encoding data can be easily recovered especially when multiple copies of encoded information are sent.


2.4
nano plain.txt

openssl genrsa
openssl rsa
openssl rsautl


openssl genrsa -aes128 -out private.pem
openssl rsa -pubout -in private.pem -out public.pem -outform pem
openssl rsa -in private.pem -out private1.pem -outform pem
openssl rand -base64 32 > key.bin
openssl enc -aes-256-cbc -salt -in plain.txt -out cipher.enc -pass file:./key.bin
openssl rsautl -encrypt -inkey public.pem -pubin -in key.bin -out key.bin.enc


openssl rsautl -decrypt -inkey private1.pem -in key.bin.enc -out key.dec.bin
openssl enc -d -aes-256-cbc -in cipher.enc -out plain.txt -pass file:./key.dec.bin

cd ..
zip -r 1520_lab3_jrmuraka




wget https://git.pluricorp.com/dfpena/jack/raw/master/lab1.sh
chmod +x lab1.sh
./lab1.sh
