Logo  

CS473 - Computer Networks

Description

Exercise #8a.

Your exercise if you choose this option is to construct ssh like client/server programs.

The client:

  • Should accept a host and optionally a port # from the command line. i.e.: Usage: sclient <host> [<port#>]

  • Should connect to the server using a streaming internet socket. All communication with the server should be "encrypted" using a simple stream cipher using the rand_r() or better the lrand48_r() PRNG's. The port number may be used as the secret key to the PRNG.

  • Your client should set the local terminal settings as per the pty.c example done in class.

  • Your client may handle the login/authorization phase and send the username and password to the server on connecting. Note however that typed passwords should not be visible.

The server:

  • Should start a "shell" (this should probably be a fake shell) via a pseudo terminal (the shell may or may not be started automatically on server startup -- it will award one bonus point if the shell is not started until someone has successfully connected and authenticated and the user is prompted to press enter to start the shell.)

  • However once launched the shell should remain running even if the client closes the connection. If the shell exits, then the client(s) may be prompted to press enter to launch a new shell.

  • Optionally should allow multiple incoming streaming internet client connections that are individually encrypted using the secret key via a PRNG. It may however be designed to fork off a process to handle a single connection if you so desire.

  • When a initial connection is made the server should enter into an authorization phase with the new client, first prompting for a user-name, then password and check the credentials against a user-name/password database file "./auth.db" (that is located in the current working directory of the server.)

  • The auth.db file should in the following format:

    user-name1:hashed-password1
    user-name2:hashed-password2
    ...

    The server should allow for more than one user-name and password. Note that the client will not echo keys typed, so for the user-name entry you must echo back the keys typed and not echo back keys typed for the password entry phase.