* Single user booting of DECStations and security
@ 1990-04-05 12:37 Alan Judge
1990-04-05 17:06 ` Roland Schemers III
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Alan Judge @ 1990-04-05 12:37 UTC (permalink / raw)
Has anybody come up with a satisfactory method of preventing users from
resetting DECStations and booting into single user mode?
What I am looking for is a system similar to Sun, where the root password is
required to come up single user.
I am thinking of implementing this by running a program from /.profile which
detects single user mode (somehow? getpid() == 3?), disables interrupts,
and demands the root password.
Has anyone got a better suggestion? (I'm sure we're not the first people to use
DS2100s in a student lab situation.)
Thanks in advance,
Alan.
--
Alan Judge, SysAdmin, Dept. of Maths, Trinity College, Dublin, Ireland.
ajudge@maths.tcd.ie a.k.a. amjudge@cs.tcd.ie
also, Distributed System Group, Dept. of Computer Science, TCD.
Newsgroups: comp.windows.x
Path: csaran!cjmchale
From: cjmchale@cs.tcd.ie (Ciaran McHale)
Subject: Re: scrolling (long)
Message-ID: <1990Apr5.133832.24268@cs.tcd.ie>
Reply-To: cjmchale@csaran.UUCP (Ciaran McHale)
Organization: DSG, Dept. of Comp.Sc., Trinity College, Dublin, Ireland.
References: <54424@bbn.COM>
Date: Thu, 5 Apr 90 13:38:32 GMT
In article <54424@bbn.COM> koolish@bbn.com (Dick Koolish) writes:
>Does X have any notion of scrolling? I would like to create
>a large image in memory but view a smaller part of it on the screen.
>To scroll the window over the image, the only ways I have found so far
>are to use either XCopyArea to put up a different part of a pixmap,
>or XPutImage to display a different part of an XImage. Both seem to
>be complete redisplay operations rather than scrolling operations.
>Is there any more appropriate way to do this?
Imagine that you create a window, win1, and a window within this window, win2.
Usually win2 will be smaller than, and will reside fully inside, it's parent
window as shown below.
------------------------
|win1 |
| |
| -------- |
| |win2 | |
| | | |
| | | |
| | | |
| -------- |
| |
| |
------------------------
Now imagine that win2 was moved---the XMoveWindow() function can be used to
do this---down a bit. The result would be something like:
------------------------
|win1 |
| |
| |
| |
| |
| |
| |
| -------- |
| |win2 | |
| | | |
------------------------
: :
........
where the dotted lines indicate that part of win2 lies outside win1. Since
a window is always "clipped" by it's parent window, only the part of win2 which
lies within win1 will de displayed (so the rectangular section marked with dots
would not be visible on the screen).
Now imagine that win2 happens to be bigger than win1 like shown below:
.....................................................
:win2 :
: ------------------------ :
: |win1 | :
: | | :
: | | :
: | | :
: | | :
: | | :
: | | :
: | | :
: | | :
: | | :
: ------------------------ :
: :
: :
: :
.....................................................
In this case win1 will show a small part of win2. The part of win2 which lies
outside win1 will not be displayed. Or to put it differently, only the part of
win2 which lies inside win1 will be visible (i.e. win2 is still "clipped" by
it's parent window). If win2 was moved then win1 will display a different part
of win2. This can be seen by the following diagrams which show some text in
win2.
.....................................................
:win2 :
: ------------------------ :
: |win1 | :
: | | :
: Once upon a time there|lived a princess who w|s :
: very pretty. However, |he was also very lonel|. :
: A handsome knight in s|ining armour married h|r :
: and they all lived hap|ily every after. | :
: | | :
: | | :
: | | :
: | | :
: ------------------------ :
: :
: :
: :
.....................................................
Move win2 right 3 character spaces using XMoveWindow() to get
.....................................................
:win2 :
: ------------------------ :
: |win1 | :
: | | :
: Once upon a time th|re lived a princess wh| was :
: very pretty. Howeve|, she was also very lo|ely. :
: A handsome knight i| shining armour marrie| her :
: and they all lived |appily every after. | :
: | | :
: | | :
: | | :
: | | :
: ------------------------ :
: :
: :
: :
.....................................................
Notice that win1 stayed in the same place on the screen. The effect is that
win2 has scrolled left. So to scroll win2 left we actually move it right!
Similarly to scroll up we move win2 down.
When you do the XMoveWindow(), X will, with a bit of luck, have the sense to
scroll what it can and it will only generate an expose event for the section
of the window that has become visible as a result of the XMoveWindow(). Thus,
for the above case, the rectanged specified in the expose event would be
as indicated below marked as "###"
.....................................................
:win2 :
: ------------------------ :
: |###1 | :
: |### | :
: Once upon a time th|###lived a princess wh| was :
: very pretty. Howeve|###he was also very lo|ely. :
: A handsome knight i|###ining armour marrie| her :
: and they all lived |###ily every after. | :
: |### | :
: |### | :
: |### | :
: |### | :
: ------------------------ :
: :
: :
: :
.....................................................
Your application would then have to repaint the exposed rectangle. If you're
using a pixmap to retain the picture then you can simply use XCopyArea() to do
the necessary.
That's the theory. If I got any of it wrong then I'm sure somebody on the net
will correct me.
Since this is something that is commonly needed, it has all been encapsulated
in various widget sets. In the Athena widget set, for example, win1 would be
a Viewport widget. The viewport would optionally have horizontal and/or
vertical scrollbars. When the user scrolls using a scrollbar, the viewport
will automatically execute the code necessary to move the inner widget. I've
used it once in an application and was very plesantly surprised just how easy
it all was. I'm sure that other toolkits provide something similar to Athena's
Viewport.
Hope that's of some help,
Ciaran.
-------
cjmchale@cs.tcd.ie
"3 out of 2 ain't bad"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-05 12:37 Single user booting of DECStations and security Alan Judge
@ 1990-04-05 17:06 ` Roland Schemers III
1990-04-17 12:27 ` Yedidya Israel
1990-04-17 19:59 ` Richard Wood
2 siblings, 0 replies; 10+ messages in thread
From: Roland Schemers III @ 1990-04-05 17:06 UTC (permalink / raw)
Hello! The following is a script and a C program that implements the
security you are talking about. It stops someone from booting in single
user mode as root. To boot single user, you have to give the root's
password. I modified to accept another password, just incase the
passwd file is corrupt, or you forget the root password!!!
-------------------------------------------------------------------------
/* Compile it as :
# cc -s -o /etc/chkpas chkpas.c
# chmod 700 /etc/chkpas
Author: Lucian S. Herscovici - DEC France
Description:
Checks password validity for the given user (argument #1). If no
argument is provided it defaults to ``root''
The return status is 1 if the password is valid 0 otherwise
Modified: Roland Schemers, Oakland University
Add check for SPECIAL password other than root's.
This might be needed if passwd file becomes corrupt..
*/
#include <pwd.h>
#include <strings.h>
#include <stdio.h>
#define SPECIAL "secret"
main(argc,argv)
int argc;
char *argv[];
{
static char prompt[80];
static char pwkey[3];
static char *user = "root";
char *pp, *getpass(), *crypt();
struct passwd *getpwnam(), *pw;
if (argc>1) user = argv[1];
sprintf(prompt,"Enter %s's password to continue : ",user);
if ((pp=getpass(prompt)) == NULL) exit(0);
if (strcmp(pp,SPECIAL)==0) exit(1);
if ((pw=getpwnam(user)) == NULL) exit(0);
strncpy(pwkey,pw->pw_passwd,2);
pwkey[2]=0;
if (strcmp(crypt(pp,pwkey),pw->pw_passwd)) exit(0);
exit(1);
}
-------------------------------------------------
# @(#).profile ULTRXI/ULTRIX WS
# Author : L. Herscovici DEC France
# Loop forever until a legal password is typed in
trap "" 2 0
while :
do
if /etc/chkpas
then
echo 'INCORRECT ** REPEAT PLEASE**'
else
echo 'CORRECT : Entering command mode'
break
fi
done
echo 'erase ^?, kill ^U, intr ^C'
stty dec prterase new
PATH=/usr/ucb:/bin:/usr/bin:/etc:/usr/local:/usr/new:/usr/hosts:.
export PATH
trap 2 0
--
Roland J. Schemers III Systems Programmer
schemers@vela.acs.oakland.edu (Ultrix) Oakland University
schemers@argo.acs.oakland.edu (VMS) Rochester, MI 48309-4401
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-05 12:37 Single user booting of DECStations and security Alan Judge
1990-04-05 17:06 ` Roland Schemers III
@ 1990-04-17 12:27 ` Yedidya Israel
1990-04-17 16:50 ` Ian! D. Allen [CGL]
` (3 more replies)
1990-04-17 19:59 ` Richard Wood
2 siblings, 4 replies; 10+ messages in thread
From: Yedidya Israel @ 1990-04-17 12:27 UTC (permalink / raw)
In article <1990Apr5.123703.2251@maths.tcd.ie> ajudge@maths.tcd.ie (Alan Judge) writes:
>Has anybody come up with a satisfactory method of preventing users from
>resetting DECStations and booting into single user mode?
>I am thinking of implementing this by running a program from /.profile which
>detects single user mode (somehow? getpid() == 3?), disables interrupts,
>and demands the root password.
I made the same on workstations, I don't think it differ on
decstations.
ASSUME that root uses csh (not sh!!!) when login, you would not have
to check for single user. /.profile will be executed only in single
user mode.
/bin/login is a symlink to /usr/bin/login, in single user /usr is not
always available and if not you will find yourself in trouble. So rm
the link and make a real copy of login in /bin. Csh must get the same
treatment,
Another point to remember is that on Ultrix workstations /etc/ttys is
usually configured to eliminate login on console (and enable ::0 - X
vitual terminal - instead). Keep it off but mark it as secure (if you
did not make it already).
Now include these lines in /.profile
echo -n "Single user "
login root
Test it before you trust it.
--
| Israel Yedidya, Math & CS Department, Bar-Ilan U, Ramat-Gan, ISRAEL. |
+----------------------------------------------------------------------+
| Bitnet: yedidya@bimacs |
| Internet: yedidya@bimacs.biu.ac.il |
| Arpa: yedidya%bimacs.bitnet@cunyvm.cuny.edu |
| Uucp: ...!uunet!mcvax!humus!bimacs!yedidya |
| Csnet: yedidya%bimacs.bitnet%cunyvm.cuny.edu@csnet-relay |
\----------------------------------------------------------------------/
\--- If someone proves there is no God, I'll stop being religious ---/
--------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-17 12:27 ` Yedidya Israel
@ 1990-04-17 16:50 ` Ian! D. Allen [CGL]
1990-04-18 12:48 ` Robert Macomber
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Ian! D. Allen [CGL] @ 1990-04-17 16:50 UTC (permalink / raw)
>Now include these lines in /.profile
>echo -n "Single user "
>login root
If sh is anything like csh, you can hit break to interrupt the reading
of the .profile/.cshrc/.login file and thus bypass the extra security.
--
-IAN! (Ian! D. Allen) idallen@watcgl.uwaterloo.ca idallen@watcgl.waterloo.edu
[129.97.128.64] Computer Graphics Lab/University of Waterloo/Ontario/Canada
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-05 12:37 Single user booting of DECStations and security Alan Judge
1990-04-05 17:06 ` Roland Schemers III
1990-04-17 12:27 ` Yedidya Israel
@ 1990-04-17 19:59 ` Richard Wood
1990-04-17 22:35 ` Eduardo Santiago
2 siblings, 1 reply; 10+ messages in thread
From: Richard Wood @ 1990-04-17 19:59 UTC (permalink / raw)
The DECstation 5000 has a security mode in the boot roms. Although this
doesn't help with previous workstations, (and tackles the problem in a
different way) it is mentioned as a point of reference.
I believe the relevant console commands is "passwd" with the "-s" and
"-c" option.
If you specify
>> passwd -s
You will be asked to specify a console password.
>> passwd -c
will clear the console password, and can only be invoked in "full"
console mode.
If the system is halted to console, or power-cycled, the prompt appears
as "S>" instead of ">>" and the only two commands that work are
"passwd", which asks for the password, and "boot". The "-s" (single
user) flag on "boot" is not available. So essentially all you can do is
boot (I haven't checked out all the other commands, such as
configuration checks).
One thing I haven't figured out yet is what you do if no one knows
either of the console or system passwords. I suspect calling field
service is the only option...
-- ---------------------------------------------------------------------
Richard Wood Corporate Worksystems Team Digital Equipment Corp.
========================================================================
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-17 19:59 ` Richard Wood
@ 1990-04-17 22:35 ` Eduardo Santiago
0 siblings, 0 replies; 10+ messages in thread
From: Eduardo Santiago @ 1990-04-17 22:35 UTC (permalink / raw)
rwood@dec.com (Richard Wood) writes:
>The DECstation 5000 has a security mode in the boot roms.
> [ ... ] The "-s" (single
>user) flag on "boot" is not available. So essentially all you can do is
>boot (I haven't checked out all the other commands, such as
>configuration checks).
Don't be lulled into thinking this is secure. You can still ^C Ultrix when
it's booting and be dumped into single user mode.
>One thing I haven't figured out yet is what you do if no one knows
>either of the console or system passwords. I suspect calling field
>service is the only option...
There is a pin on the system board which, when jumpered to ground,
makes the system clear all nonvolatile RAM (where the password is
stored) on a system reset or powerup. I believe this is discussed
in some of the documentation.
>-- ---------------------------------------------------------------------
>Richard Wood Corporate Worksystems Team Digital Equipment Corp.
>========================================================================
^Ed Santiago, 3MAX (aka DS5000) firmware person
Ed Santiago santiago@decwrl.dec.com
DEC Workstations Systems Engineering ..decwrl!santiago
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-17 12:27 ` Yedidya Israel
1990-04-17 16:50 ` Ian! D. Allen [CGL]
@ 1990-04-18 12:48 ` Robert Macomber
1990-04-19 12:08 ` Yedidya Israel
1990-04-20 22:23 ` Rob Burrowes
1990-04-28 5:03 ` Jason Heirtzler
3 siblings, 1 reply; 10+ messages in thread
From: Robert Macomber @ 1990-04-18 12:48 UTC (permalink / raw)
In article <1399@bimacs.BITNET>, yedidya@bimacs.BITNET (Yedidya Israel) writes:
> In article <1990Apr5.123703.2251@maths.tcd.ie> ajudge@maths.tcd.ie (Alan Judge) writes:
>
> Now include these lines in /.profile
>
> echo -n "Single user "
> login root
>
This disussion is really similar to one for SunOS 3.5 last year. That
discussion nixed this idea, because "login" would timeout & die after
a while & leave the user in single-user mode. Assuming that "login"
acts basically the same on pre-4.0 ULTRIX, here's a program that is
intended to be executed from /.profile. If the person booting the
machine in single-user mode can't give the regular root password, it
halts the machine.
---------------------------- Cut Here -----------------------------------
/* singleuser.c
* Christopher Lott 870924
* cml@cis.ohio-state.edu
* written for use in root's .profile
* requests the root passwd from the console; halts unix if it fails
* This program placed in the public domain by the author
*/
#include <pwd.h>
#include <stdio.h>
#include <signal.h>
#include <sys/reboot.h>
#define ROOT_UID 0
main ()
{
char *userword, *rootword, *result, salt[3];
struct passwd *pwentry;
char *crypt(), *getpass();
signal(SIGINT, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
pwentry = getpwuid(ROOT_UID); /* get passwd file entry */
rootword = pwentry->pw_passwd;
salt[0] = rootword[0]; /* grab the salt */
salt[1] = rootword[1];
salt[2] = NULL;
userword = getpass ("Password:"); /* get one from console */
result = crypt(userword, salt);
if ( !(strcmp (result, rootword)) ) {
printf ("hi, root person.\n");
exit (0);
}
else {
printf ("Sorry - halting Unix.\n");
sync();
reboot (RB_HALT);
}
}
---------------------------- Cut Here -----------------------------------
--
Robert L. Macomber
National Semiconductor
South Portland, Maine
macomber@thoreau.nsc.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-18 12:48 ` Robert Macomber
@ 1990-04-19 12:08 ` Yedidya Israel
0 siblings, 0 replies; 10+ messages in thread
From: Yedidya Israel @ 1990-04-19 12:08 UTC (permalink / raw)
In article <44@thoreau.nsc.com> macomber@thoreau.nsc.com (Robert Macomber) writes:
>In article <1399@bimacs.BITNET>, yedidya@bimacs.BITNET (Yedidya Israel) writes:
>> In article <1990Apr5.123703.2251@maths.tcd.ie> ajudge@maths.tcd.ie (Alan Judge) writes:
>>
>> Now include these lines in /.profile
>>
>> echo -n "Single user "
>> login root
>>
>
>This disussion is really similar to one for SunOS 3.5 last year. That
>discussion nixed this idea, because "login" would timeout & die after
>a while & leave the user in single-user mode.
It won't but you can use "exec login root" if you do not trust.
As for ^Cing before the check, I tried it on vs2000 as fast as I could
and did not manage to break it. Of caurse you can catch the interrupt
and ignore it.
--
| Israel Yedidya, Math & CS Department, Bar-Ilan U, Ramat-Gan, ISRAEL. |
+----------------------------------------------------------------------+
| Bitnet: yedidya@bimacs |
| Internet: yedidya@bimacs.biu.ac.il |
| Arpa: yedidya%bimacs.bitnet@cunyvm.cuny.edu |
| Uucp: ...!uunet!mcvax!humus!bimacs!yedidya |
| Csnet: yedidya%bimacs.bitnet%cunyvm.cuny.edu@csnet-relay |
\----------------------------------------------------------------------/
\--- If someone proves there is no God, I'll stop being religious ---/
--------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-17 12:27 ` Yedidya Israel
1990-04-17 16:50 ` Ian! D. Allen [CGL]
1990-04-18 12:48 ` Robert Macomber
@ 1990-04-20 22:23 ` Rob Burrowes
1990-04-28 5:03 ` Jason Heirtzler
3 siblings, 0 replies; 10+ messages in thread
From: Rob Burrowes @ 1990-04-20 22:23 UTC (permalink / raw)
Dec should have a prompt for a passwd in init before it goes single user.
I have solved this problem by patching init to use /etc/sh rather than /bin/sh
/etc/sh.c
----------------------------
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <pwd.h>
main(argc,argv,envp)
char ** argv, **envp;
{
if( isatty(0)
&& isatty(1)
&& *argv[0] == '-' )
{
struct passwd *pwd, *getpwnam();
register char *namep;
char *pp;
char *getpass(), *crypt() ;
signal(SIGTERM, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGALRM, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGSTOP, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
if ((pwd = getpwnam("root")) != NULL)
{
do
{
pp = getpass("Password:");
namep = crypt(pp, pwd->pw_passwd);
} while(strcmp(namep, pwd->pw_passwd));
}
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_DFL);
signal(SIGALRM, SIG_DFL);
signal(SIGTSTP, SIG_IGN);
}
execve("/bin/sh", argv, envp);
exit(0);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Single user booting of DECStations and security
1990-04-17 12:27 ` Yedidya Israel
` (2 preceding siblings ...)
1990-04-20 22:23 ` Rob Burrowes
@ 1990-04-28 5:03 ` Jason Heirtzler
3 siblings, 0 replies; 10+ messages in thread
From: Jason Heirtzler @ 1990-04-28 5:03 UTC (permalink / raw)
We have (or rather had) the same problem here. My solution was
to drop in 4.3 init with the sunos 4.x code to demand the root
pw if "secure" is set in /etc/ttys (ttytab for sunos)
Here's what our ttys looks like:
:0 "/usr/bin/login -P /usr/bin/Xprompter -C /usr/bin/dxsession" none on
window=/usr/bin/Xcfb"
Or if the console is in a "secure" location:
:0 "/usr/bin/login -P /usr/bin/Xprompter -C /usr/bin/dxsession" none on
secure window=/usr/bin/Xcfb"
Now replacing an init that has unknown (to me) features isn't something
that I'd recommend, I'm willing to give out the binary with disclaimers
(ie be careful and make sure you know what you're doing.)
jdh
-------------------------------------------------------------------
Jason Heirtzler (617) 353-2780 jdh@bu-pub.bu.edu
Information Technology Boston University ..!bu.edu!bu-pub!jdh
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~1990-04-28 5:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1990-04-05 12:37 Single user booting of DECStations and security Alan Judge
1990-04-05 17:06 ` Roland Schemers III
1990-04-17 12:27 ` Yedidya Israel
1990-04-17 16:50 ` Ian! D. Allen [CGL]
1990-04-18 12:48 ` Robert Macomber
1990-04-19 12:08 ` Yedidya Israel
1990-04-20 22:23 ` Rob Burrowes
1990-04-28 5:03 ` Jason Heirtzler
1990-04-17 19:59 ` Richard Wood
1990-04-17 22:35 ` Eduardo Santiago
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox