lecture
in color
web, group web.
web
or group web.
web or
group web.
root.
/etc/csh.people).
web.
web:*:615:couch,web
web, group inheritance
bit set, unreadable to other.
conbrio{couch}105: cd /var/local/g/150NET
conbrio{couch}106: ls -l
total 140
drwxrws--- 2 couch web 512 Feb 10 13:30 DB
-rw-r--r-- 1 couch web 250 Feb 3 10:56 NOTES
drwx------ 2 couch web 512 Feb 10 13:29 OLD
drwxrws--- 3 couch web 1024 Feb 3 09:15 Provide
-rwxr-x--- 1 couch web 8375 Feb 9 08:57 annex.cgi
drwxr-s--- 2 couch web 512 Feb 7 18:25 bin
drwxrwsrwx 2 couch web 512 Feb 10 13:03 locks
-rwxr-x--- 1 couch web 4552 Feb 3 09:15 register.cgi
-rw-rw---- 1 couch web 50198 Feb 10 00:25 register.txt
conbrio{couch}107: ls -l DB
total 22
-rw-rw---- 1 couch web 10576 Feb 10 13:03 students.db
conbrio{couch}108: ls -l bin
total 2
-rwsr-xr-x 1 root faculty 515 Feb 7 18:42 getpass
getpass:
-rwsr-xr-x 1 root faculty 515 Feb 7 18:42 getpassthat does this:
contents of net-old/getpass...
#! /local/bin/perl
# this setuid root script gives out passwords to processes
# with real uid root, couch, or web and dies silently otherwise.
exit 0 if $< != 0 and $< != 30 and $< != 13141;
$ENV{'PATH'} = "/usr/sbin:/usr/bin"; # protect against hackers
$uid = $ARGV[0]; &untaint($uid); # get user id to check
# run nismatch as ROOT to get password.
open(FILE,"/usr/bin/nismatch uid=$uid passwd.org_dir|") or exit 0;
$line = <FILE>; close FILE; chomp $line;
# extract password
($name,$passwd,$uid,$gid,$comment,$dir,$shell) = split(/:/,$line);
# return to calling program
print "$passwd\n";
sub untaint { $_[0] =~ /^(.*)$/; $_[0] = $1; }
...end of net-old/getpass
So if you type
getpass 30it prints my encrypted password.
contents of net-old/validate.pl...
# start with $login: login name
# $password: plaintext password
# get user id for user
($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell)=getpwnam($login);
if (! defined $uid) {
print "You did not give a valid username.\n";
} else {
$uid = $pw[2]; #user id is third field in /etc/password
# get password from setuid program
open(FILE,"/var/local/g/150NET/bin/getpass $uid|")
or die "can't get password: $!";
my $encrypted = <FILE>; close FILE; chomp $encrypted;
# validate password with 'crypt' function
# if the plaintext encrypted with the FIRST TWO
# characters of the encrypted password is the
# encrypted password, we're golden!
$salt = substr($encrypted, 0, 2);
if (crypt($password, $salt) eq $encrypted) {
print "Your password is correct.\n";
} else {
print "Your password is incorrect.\n";
}
}
...end of net-old/validate.pl
and knows whether you've typed your real password or not!
web
(for 'simplicity').
ftp to conbrio, and if they know
where things are, can read scripts and modify databases!
+---------------------+ | Application Layer | how devices agree on the meaning of data +---------------------+ mayor | Presentation Layer | how devices agree on the format of data +---------------------+ town meetings | Session Layer | how neighboring devices establish channels of info +---------------------+ community cable | Transport Layer | how to avoid communication errors between devices +---------------------+ libel suits/lawyers | Network Layer | how non-neighboring devices communicate +---------------------+ gossip | Data Link Layer | how neighboring devices communicate +---------------------+ talking over the fence | Physical Layer | how devices are physically connected +---------------------+ back fences
+---------------------+ | Political Layer | how devices agree on what to spend. +---------------------+ | Financial Layer | how devices agree on what to buy. +---------------------+ | Application Layer | how devices agree on the meaning of data +---------------------+ | Presentation Layer | how devices agree on the format of data +---------------------+ | Session Layer | how neighboring devices establish channels of info +---------------------+ | Transport Layer | how to avoid communication errors between devices +---------------------+ | Network Layer | how non-neighboring devices communicate +---------------------+ | Data Link Layer | how neighboring devices communicate +---------------------+ | Physical Layer | how devices are physically connected +---------------------+
+---------------------+ | Application Layer | +---------------------+ | Presentation Layer | gateways +---------------------+ | Session Layer | +---------------------+ | Transport Layer | +---------------------+ routers (first to know about global address) | Network Layer | +---------------------+ switches (MAC (local) address layer) | Data Link Layer | hubs, repeaters +---------------------+ | Physical Layer | transceivers +---------------------+
+---------------------+ +---------------------+ | Application Layer | v ^ | Application Layer | +---------------------+ | | +---------------------+ | Presentation Layer | | | | Presentation Layer | +---------------------+ | | +---------------------+ | Session Layer | | | | Session Layer | +---------------------+ | | +---------------------+ | Transport Layer | | | | Transport Layer | +---------------------+ | | +---------------------+ | Network Layer | | | | Network Layer | +---------------------+ | | +---------------------+ | Data Link Layer | | | | Data Link Layer | +---------------------+ | | +---------------------+ | Physical Layer | +---------------------+ | Physical Layer | +---------------------+ +---------------------+
host repeater router host [ App ]> [ App ] [ App ] >[ App ] [ Pre ]| [ Pre ] [ Pre ] |[ Pre ] [ Ses ]| [ Ses ] [ Ses ] |[ Ses ] [ Trn ]| [ Trn ] +[ Trn ]+ |[ Trn ] [ Net ]| [ Net ] |[ Net ]| |[ Net ] [ Lnk ]| +[ Lnk ]+ |[ Lnk ]| |[ Lnk ] [ Phy ]+-->+[ Phy ]+-->|[ Phy ]+-->+[ Phy ]
[ App ] DATA [ Pre ] PreH DATA PreT [ Ses ] SesH PreH DATA PreT SesT [ Trn ] TrnH SesH PreH DATA PreT SesT TrnT [ Net ] NetH TrnH SesH PreH DATA PreT SesT TrnT NetT [ Lnk ] LnkH NetH TrnH SesH PreH DATA PreT SesT TrnT NetT LnkT [ Phy ]
[ ? ] Data [ Net ] [IP Addresses] Data [no IP trailer] [ Lnk ] [MAC Addresses] [IP Addresses] Data [no IP trailer] [no MAC trailer] [ Phy ]
OSI TCP/IP TCP UDP Application Application stream message Session/Transport Transport segment packet Network Internet datagram datagram Network Network frame frame
mach. room 10/T
switch ----------- [hub] -----------------[hub]-------tcp (master server)
/ | \ / | \
e11 e12 e13 .. e01 e02 e03
---------+------------+----------+-----------+----------
| |
machine 1 machine 2
[[[[[[[[[ is a packet.
-----------[[[[[[[[[------------------[[[[[[[[------------------ M1
+ -----------------------[[[[[[[[[[[------------------------------ M2
+ ---------------------------------------------------[[[[[[[[----- M3
= -----------[[[[[[[[[---[[[[[[[[[[[----[[[[[[[[-----[[[[[[[[----- result
DTE mapping: on the back of a workstation 1 TX+ [ Transmit pair 2 TX- [ 3 RX+ [ Receive pair 4 UNUSED 5 UNUSED 6 RX- [ 7 UNUSED 8 UNUSED DCE mapping: on the back of a hub or concentrator 1 RX+ [ Receive pair 2 RX- [ 3 TX+ [ Transmit pair 4 UNUSED 5 UNUSED 6 TX- [ 7 UNUSED 8 UNUSED
1 ----- 3 (transmit to receive, receive to transmit) 2 ----- 6 3 ----- 1 6 ----- 2
-----------[[[[[[[[[------------------[[[[[[[[------------------ M1
+ ------------[[[[[[[[[------------------------------------------- M2
= -----------[XXXXXXXX[-----------------[[[[[[[[------------------ result
^^^^^^^^ collision between two packets. both packets lost
-----[[[[[[[[---------[[[[[[[[----------------------------------
------[[[[[[[[------------........------------------------------
^^^^^^^^ sends too close for collision avoidance: oops!
^^^^^^^^^ here machine 1 gets the wire
^^^^^^^^ machine 2 checks the wire, loses the race
computer <------> modem <-------> modem <-------> computer
DTE DCE phone DCE DTE
line
DCE pin map: (most common signals) direction of signal
1 chassis ground (shield for cable). ..
2 TXD transmit data ->
3 RXD receive data <-
4 RTS request to send ->
(1 when terminal ready to send data)
5 CTS clear to send <-
(1 when ok to send it)
'hardware flow control'
7 signal ground
8 DCD data carrier detect ->
(1 when modem connected to another)
20 DTR data terminal ready <-
(1 when terminal ready)
DTE pin map: (most common signals) direction of signal
1 chassis ground (shield for cable). ..
2 RXD receive data <-
3 TXD transmit data ->
5 RTS request to send ->
4 CTS clear to send <-
7 signal ground
8 DTR data terminal ready <-
20 DCD data carrier detect ->
1 -------- 1
TXD 2 -------- 3 RXD
RXD 3 -------- 2 TXD
RTS 4 -------- 5 CTS
CTS 5 -------- 4 RTS
7 -------- 7
DCD 8 -------- 20 DTR
DTR 20 -------- 8 DCD
101101101
^ stop bit
^^^^^^^ data bits
^ start bit
lecture
in color