Skip to content

An SSH client/server using ptys which run in a Bash session in a remote server using pthreads (via thread pool) with epoll and timers to handle tardy clients.

License

Notifications You must be signed in to change notification settings

NekuraNeko/client-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iterative client-server Build Status

Background

Developed for Advanced C Programming (CS 591) in Fall 2017, each lab represents a step towards the "ultimate" client-server.

Description

The functionality revolves around creating an ssh client-server which sets bash up for a connecting client on the server. However, this can easily be swapped for any other function; such as a web server (nginx). The labs crescendo into a much more sophisticated implementation using epoll and a thread pool to handle all processing. It also handles DDOS attacks and malicious clients.

Additionally, each folder has a makefile which can be used to make each client and server. More details for each particular implementation can be found in the particular folder:

The code was written with Linux in mind and doesn't necessarily conform to POSIX standards. Verify code before reuse.

Features

Feature Lab 1 Lab 2 Lab 3 Lab 4 (ThrPool) Lab 5
Processes Created* 1 3 1 - 1
Threads Created 0 0 2 - 8 (Num_Cores)
Concurrent Server YES YES YES - YES
Three-way Handshake YES YES YES - YES
IO Type Blocking Blocking Blocking - Non-blocking
Debug Mode NO YES YES YES YES
Signal Handler NO YES YES NO YES
Handles Malicious Clients NO NO YES** - YES
Handles Partial Writes NO NO NO - YES
Thread Pool NO NO NO YES YES
Epoll NO NO YES - YES

*It is important to note that there will be at least 1 process created for bash.

**Lab 3 handles malicious clients by using timers whereas Lab5 uses timerfd with its own epoll unit.

Usage

First start by running the server:

./server

Then connect a client (or more) using the server IP:

./client 127.0.0.1

Auxiliary Scripts

The following scripts can be used to test or debug the server:

Future

I plan on implementing a logger to record and report what happens during server runtime such as:

  • Server creation
  • Client connection
  • Client destruction
  • Client errors
  • Server errors

About

An SSH client/server using ptys which run in a Bash session in a remote server using pthreads (via thread pool) with epoll and timers to handle tardy clients.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 85.4%
  • Shell 13.6%
  • Makefile 1.0%