...
This is the web page for Operation Systems Theory at the University of Oklahoma.
In this course, you will get experience facilitating several machine communicate with eachother. Several issues arise while managing communication between nodes. For phase 1, you will build a system to demonstrate client-server communication.
Your task is to set up three nodes — two clients and one server. Have each client send an “encrypted message” to the server and have the server print out the unencrypted message.
You may choose your own encryption scheme for your message. Messages may be numbers, bytes, or strings. We will use docker-compose, protocol buffers, and gRPC for setting up nodes and managing networking and communication. You may use any compatible programming language to write your code. As of today, docker and docker-compose are not available on the computer lab machines. You may install it on any laptop or inside of a virtual machine.
In a readme
file, you should describe your encryption message and the message that will be sent between systems.
To demonstrate the working system, record a video or annimated .gif
clearly show messages being sent and received across the systems.
COLLABORATORS
fileThis file should contain a comma separated list describing who you worked with and text description describing the nature of the collaboration. This information should be listed in three fields as in the example is below:
Katherine Johnson, kj@nasa.gov, Helped me understand calculations
Dorothy Vaughan, doro@dod.gov, Helped me with multiplexed time management
http://examples.com/my-specific-example1, helpe be debug error
http://examples.com/my-specific-example2, helpe be architect classes
Submit all source code to a private github repository.
Additionally, upload all source code to the canvas assignment.
Code must be in both locations to receive any credit.
The video/annotated .gif
should also be uploaded.
This is project may not be done in groups.
Any code copying is subject to the university’s academic dishonesty policy.
Any websites or discussion should be added to a COLLABORATORS
file.
readme
file 20%Errors or shortcomings in categories above will result in a reduction of percentage points removed.
Assuming you have one python file called node.py
that runs everything here is a template code you can use.
To run the code
docker-compose up --build
To tear down the machine
docker-compose down
To inspect a container called client1
docker exec -it client1 /bin/bash
FROM ubuntu:rolling
MAINTAINER cgrant@ou.edu
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
RUN apt-get update && apt-get upgrade -y && apt-get install -y python3-pip ipython3
RUN apt-get install -y vim nmap iputils-ping ssh netcat htop slurm net-tools
ENV GRPC_PYTHON_VERSION 1.15.0
RUN apt-get install -y libprotoc-dev protobuf-compiler
RUN python3 -m pip install --upgrade pip && python3 -m pip install click grpcio grpcio-tools
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Build python stuff
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
# Create the protobuf files
# RUN protoc --python_out=. rsa.proto # Code below works similarly
RUN python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. rsa.proto
EXPOSE 22
EXPOSE 80
EXPOSE 50050-50100
# Unbuffer to see logs with docker logs <containername>
ENV PYTHONUNBUFFERED=1
# Run the node
CMD ["python3", "node.py"]
syntax = "proto3";
package ousystems;
service SecureMessaging {
// Requests and returns the Public Key
rpc GetPublicKey (NullMsg) returns (PublicKey) {}
// Receives an Encrypt a message
rpc SendEncryptedMessage (EncryptedMessage) returns (MsgAck) {}
}
message PublicKey {
int32 n = 1;
int32 e = 2;
}
message EncryptedMessage {
// Integer representing encrypted message
int32 message = 1;
string src = 2;
string dst = 3;
}
// Return this acknowledging the receipt of a message
message MsgAck {
int32 status = 1;
string src = 2;
string dst = 3;
}
// Empty Message Type
message NullMsg {
int32 status = 1;
}
version: '3.7'
services:
server:
build: .
hostname: server
container_name: server
networks:
- default
client1:
build: .
hostname: client1
container_name: client1
networks:
- default
client2:
build: .
hostname: client2
container_name: client2
networks:
- default
networks:
default:
driver: bridge
logging.basicConfig(format='%(asctime)s %(levelname)s:%(name)s %(message)s', level=logging.DEBUG)
import time
and use the method time.sleep(seconds)
to sleep for a particular.Back to CS5113