Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
9f0487d1
Commit
9f0487d1
authored
Nov 15, 2004
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes to last revision; need to reorder operations a bit.
parent
0c267b15
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
14 deletions
+56
-14
db/GNUmakefile.in
db/GNUmakefile.in
+2
-0
db/elabinelab_bossinit.in
db/elabinelab_bossinit.in
+54
-14
No files found.
db/GNUmakefile.in
View file @
9f0487d1
...
...
@@ -41,6 +41,8 @@ post-install:
chmod u+s $(INSTALL_SBINDIR)/genelists
chown root $(INSTALL_SBINDIR)/dhcpd_makeconf
chmod u+s $(INSTALL_SBINDIR)/dhcpd_makeconf
chown root $(INSTALL_SBINDIR)/elabinelab_bossinit
chmod u+s $(INSTALL_SBINDIR)/elabinelab_bossinit
#
# Control node installation (okay, plastic)
...
...
db/elabinelab_bossinit.in
View file @
9f0487d1
#!/usr/bin/perl -w
#!/usr/bin/perl -w
T
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
...
...
@@ -25,6 +25,7 @@ my $debug = 0;
my
$TB
=
"
@prefix
@
";
my
$TBOPS
=
"
@TBOPSEMAIL
@
";
my
$ELABINELAB
=
@ELABINELAB@
;
my
$SAVEUID
=
$UID
;
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/usr/bin:/usr/sbin:/usr/local/bin
';
...
...
@@ -46,6 +47,13 @@ if (!TBAdmin($UID)) {
die
("
*** $0:
\n
"
.
"
Only TB administrators can run this script!
\n
");
}
#
# We don't want to run this script unless its the real version.
#
if
(
$EUID
!=
0
)
{
die
("
*** $0:
\n
"
.
"
Must be root! Maybe its a development version?
\n
");
}
#
# Parse command arguments. Once we return from getopts, all that should
...
...
@@ -64,40 +72,72 @@ usage()
my
$pid
=
shift
();
#
#
Build the project
.
#
Untaint the arguments
.
#
mysystem
("
$TB
/sbin/mkproj
$pid
");
if
(
$pid
=~
/^([-\w]+)$/
)
{
$pid
=
$
1
;
}
else
{
die
("
Tainted argument
$pid
!
\n
");
}
#
#
Get the list of subgroups in the project and create those group
s.
#
Shift to real user for these script
s.
#
my
$query_result
=
DBQueryFatal
("
select gid from groups where pid='
$pid
' and pid!=gid
");
while
(
my
(
$gid
)
=
$query_result
->
fetchrow_array
())
{
mysystem
("
$TB
/sbin/mkgroup
$pid
$gid
");
}
$EUID
=
$UID
;
#
# Build the project.
#
#mysystem("$TB/sbin/mkproj $pid");
#
# Get the list of users and admin status. Admin users get a real shell
# on boss. Create the users, and then set their groups.
# on boss. Create the users, and not that we have to do this before the
# groups are created (tbacct add does not do a setgroups).
#
$query
_result
=
my
$users
_result
=
DBQueryFatal
("
select distinct u.uid,u.admin from group_membership as m
"
.
"
left join users as u on u.uid=m.uid
"
.
"
where u.status='
"
.
USERSTATUS_ACTIVE
()
.
"
'
");
while
(
my
(
$uid
,
$admin
)
=
$query_result
->
fetchrow_array
())
{
while
(
my
(
$uid
,
$admin
)
=
$users_result
->
fetchrow_array
())
{
next
if
(
$uid
eq
"
elabman
");
mysystem
("
$TB
/sbin/tbacct add
$uid
");
if
(
$admin
)
{
# Add admin users to group wheel for convenience.
DBQueryFatal
("
insert
into unixgroup_membership
"
.
DBQueryFatal
("
replace
into unixgroup_membership
"
.
"
values ('
$uid
','wheel')
");
}
mysystem
("
$TB
/sbin/setgroups
$uid
");
if
(
$admin
)
{
# Flip back to root for pw command.
$EUID
=
0
;
mysystem
("
pw usermod -n
$uid
-s /bin/tcsh
");
$EUID
=
$UID
;
}
}
#
# Get the list of subgroups in the project and create those groups.
#
my
$query_result
=
DBQueryFatal
("
select gid from groups where pid='
$pid
' and pid!=gid
");
while
(
my
(
$gid
)
=
$query_result
->
fetchrow_array
())
{
mysystem
("
$TB
/sbin/mkgroup
$pid
$gid
");
}
#
# Now do a setgroups.
#
$users_result
->
dataseek
(
0
);
while
(
my
(
$uid
,
$admin
)
=
$users_result
->
fetchrow_array
())
{
next
if
(
$uid
eq
"
elabman
");
mysystem
("
$TB
/sbin/setgroups
$uid
");
}
#
# Run a command string.
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment