Software Architecture 10. Remote Terminal and Electric Mail

Software Architecture 10. Remote Terminal and Electric Mail

1 SOFTWARE ARCHITECTURE 10. REMOTE TERMINAL AND ELECTRIC MAIL Tatsuya Hagino [email protected] lecture URL https://vu5.sfc.keio.ac.jp/slide/ 2 Terminal to Use Host Computer • Before personal computer age • Connect a terminal to a host computer with a serial line or a telephone line. • A terminal is a kind of type writer but key inputs go to the serial line and characters received from the serial line are printed. • Character terminal, graphical terminal, etc. input serial line output terminal host computer • Personal computer age • PC terminal emulator • Connected with a serial line or a telephone line through a modem. • Internet age • Virtual terminal emulator • Use Internet to connect to a remote computer. 3 Terminal Connection in UNIX Host • First, `getty' program waits for each line for a new connection init from a terminal. • getty = get tty getty getty getty • Hand to a `login' program does user authentication by asking a user name login user name and a password. password • Invoke a shell • The shell will handle all the execute csh interaction from then on. commands 4 Telnet Protocol remote terminal • Implement a virtual terminal for Internet computer port 23 • Use internet instead of a serial line. • TCP connection (with session and reliability) • port 23 • Simple protocol • All the characters input from a terminal are sent to the remote computer. • All the output form the remote computer are output to the terminal. • Replace the serial line, but no authentication of user is handled. • Options are negotiated between the terminal and the remote computer. • DO or DON'T • WILL or WON'T 5 Option Negotiation • Enable X at the sender side WILL X • sender: WILL X sender receiver • receiver: DO X or DON'T X accept DO X deny DON'T X • Enable X at the receiver side DO X • sender: DO X sender receiver • receiver: WILL X or WON'T X accept WILL X deny WON'T X • Disable X at the sender side WON'T X • sender: WON'T X sender receiver • receiver: DON'T X accept DON'T X • Disable X at the receiver side DON'T X • sender: DON'T X sender receiver • receiver: WON'T X accept WON'T X 6 Example of Option Negotiation terminal host echo(0x01) WON'T(0xfc) IAC(0xff) echo(0x01) IAC(0xff) DON'T(0xfe) TERM TYPE (0x18) WILL(0xfb) IAC(0xff) TERM TYPE DO(0xfd) IAC(0xff) (0x18) SE(0xf0) TERM TYPE SEND(0x01) IAC(0xff) SB(0xfa) IAC(0xff) (0x18) 0 0 TERM TYPE 1 t v IS(0x00) SB(0xfa) (0x18) IAC(0xff) SE(0xf0) IAC(0xff) IAC: Interpret As Command SB~SE: Sub negotiation 7 Telnet Control Command • Are You There • IAC, 0xf6 • Erase a character • IAC, 0xf7 • Erase a line • IAC, 0xf8 • Terminate process (ctrl-C) • IAC, 0xf4 • Stop output • IAC, 0xf5 • Synchronize (TCP urgent message) • IAC, 0xf2 8 Extension of Telnet • Problem of Telnet • Security problem. • User name and password are sent without any encryption. • Rlogin (remote login) • Easy for UNIX systems • Introduced in UNIX BSD 4 • Trust computers listed in ~/.rhosts without password • Not much used for security reason • SSH (Secure Shell) • protocol 1, 2 • authentication: password, challenge-response, RSA, DSA • Remote desktop • Windows version of remote terminal 9 User Authentication, Encryption and Hash • User authentication • Check whether the user is a correct (authorized) user or not. • password authentication correct user • one time password • challenge response authentication • RSA (Rivest Shamir Adleman) authentication server • DSA (Digital Signature Algorithm) authentication wrong user • Encryption • Encrypt data so that others cannot understand encryption decryption • common key cryptography hello ifmmp hello • the key should be secret from others encrypted date • public key cryptography • use public key and private key pair • Hash • Make sure data is not tampered. Internet • checksum ? • cryptographic hash function (MD5, SHA-1, SHA-2) tampered? 10 User Authentication • Password authentication • Send the registered password to the server. • One time password • Send a password generated by a password generator and send it to the server. • Example: a number calculated from the current time. • Challenge Response authentication • Receive a random number (= challenge) from the server. • Calculate a number form the challenge and the user's password. • Send the calculated number (= response) to the server. • The server does the same calculation to check the response. • RSA authentication • Use RSA (Rivest Shamir Adleman) public key cryptography • Generate a public key and private key pair. • Register the public key to the server. • Decrypt the random number sent from the server using the private key. • Calculate the hash and send it to the server. • The server checks whether the hash is correct or not. 11 RSA Authentication User Server registration Generate a public and Register the public key Bind the public key and the private key pair P user P S P Send user name Generate a login random P number Send the encrypted number Encrypt using Calculate Encrypt S the public key the hash the private key Decrypt using the using private key a pass phrase Calculate the Send the hash hash Compare the hash agree disagree authenticated 12 SSH Overview Message ID Value SSH_MSG_DISCONNECT 1 SSH_MSG_IGNORE 2 • Secure communication protocol between terminal SSH_MSG_UNIMPLEMENTED 3 and host computer SSH_MSG_DEBUG 4 • TCP port 22 SSH_MSG_SERVICE_REQUEST 5 SSH_MSG_SERVICE_ACCEPT 6 • Communication data SSH_MSG_KEXINIT 20 • Messages are exchanged between server and client SSH_MSG_NEWKEYS 21 • Messages are put into a packet and the packet is SSH_MSG_USERAUTH_REQUEST 50 encrypted. SSH_MSG_USERAUTH_FAILURE 51 • Multiple channel for multiple communication on a single SSH_MSG_USERAUTH_SUCCESS 52 connection. SSH_MSG_USERAUTH_BANNER 53 SSH_MSG_GLOBAL_REQUEST 80 メッセージ SSH_MSG_REQUEST_SUCCESS 81 SSH_MSG_REQUEST_FAILURE 82 message ID data for the message SSH_MSG_CHANNEL_OPEN 90 (1byte) SSH_MSG_CHANNEL_OPEN_CONFIRMATION 91 パケット SSH_MSG_CHANNEL_OPEN_FAILURE 92 SSH_MSG_CHANNEL_WINDOW_ADJUST 93 SSH_MSG_CHANNEL_DATA 94 packet length padding size (4byte) (1byte) SSH_MSG_CHANNEL_EXTENDED_DATA 95 encrypted SSH_MSG_CHANNEL_EOF 96 data (message) random padding SSH_MSG_CHANNEL_CLOSE 97 SSH_MSG_CHANNEL_REQUEST 98 MAC message authentication code SSH_MSG_CHANNEL_SUCCESS 99 SSH_MSG_CHANNEL_FAILURE 100 13 SSH Sequence (1) • When connected, exchange key to establish a secure communication. http://www.cisco.com/c/en/us/about/press/internet-protocol-journal/back-issues/table-contents-46/124-ssh.html 14 SSH Sequence (2) • Create multiple channels: • execution of shell • execution of command • port forwarding • X11 forwarding http://www.cisco.com/c/en/us/about/press/internet-protocol-journal/back-issues/table-contents-46/124-ssh.html 15 Summary of Remote Terminal • Telnet • One of the oldest TCP protocol • Simply implement virtual terminal on internet • Security issues • SSH • Secure communication channel • Multiple user authentication mechanism supported • Multiple channels for one connection 16 ELECTRIC MAIL 17 Electric Mail Components • MUA (Mail User Agent) • Mail client software • Sending and receiving mails • MTA (Mail Transfer Agent) • Sending mails to destination • MDA (Mail Deliver Agent) • MTA uses this to write mails to mail boxes. • MRA (Mail Retrieval Agent) • Retrieving mails from remote mail box. sending receiving mail software mail server mail server MDA MUA SMTP MTA SMTP MTA MRA mail box IMAP POP 18 SMTP • Simple Mail Transfer Protocol • MUA uses this to send mails to MTA • MTA uses this to forward mails to other MTA SMTP SMTP SMTP MUA MTA MTA MTA • Specification • RFC821(1982) is the first spec. • Various extensions are added later covered by multiple RFCs. • ESMTP (Extended SMTP) • TCP connection • port 25 19 SMTP Server Mandatory Commands • HELO • RSET • Specify the sending host. • Reset the server • MAIL • NOOP • Specify the sender • No effect • RCPT • QUIT • Specify the receiver • Terminate the connection • DATA • Mail message 20 Example of Sending Mail • Connect to the server → 220 smtp.sfc.keio.ac.jp SMPT • DATA → 354 Enter mail, end with "." on • HELO ninna.tom.sfc.keio.ac.jp a line by itself → 250 ninna.tom.sfc.keio.ac.jp Hello From: [email protected] • MAIL FROM: [email protected] To: [email protected] → 250 [email protected] Cc: [email protected] Sender ok Subject: Hello • RCPT TO: [email protected] Dear Nobuo and Tim, → 250 [email protected] (mail body) Recipient ok . • RCPT TO: [email protected] → 250 0AA06460 Message accepted for delivery → 220 [email protected] No such user • RCPT TO: [email protected] • QUIT → 250 [email protected] Recipient ok → 221 smtp.sfc.keio.ac.jp closing connection 21 Mail Address and Mail Server Tatsuya Hagino <[email protected]> display name local part domain part • A mail address consists of local part and domain part. • Use DNS domain name and the part is case insensitive • The local part is officially case sensitive, but a lot of systems ignore case. • Mail server • Find the mail server from the domain part. • Use MX (Mail Exchange) of DNS to specify the mail server for the domain. MX mail-gw2.sfc.keio.ac.jp sfc.keio.ac.jp mail-gw1.sfc.keio.ac.jp 22 SMTP Security sender? • Anybody can send mail with any name. [email protected] • Can easily create impersonate mails. impersonate mail [email protected] • Spam • Limit MUA to connect MTE From: [email protected] • POP before SMTP To: [email protected] • SMTP AUTH [email protected] • Prohibit using outside MTA • Outbound port 25 blocking at firewall • MSA (Message Submission Agent) 589 25 MUA MSA MTA Firewall • Encrypt message body • SMTP over SSL 23 Mail Server

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    32 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us