Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • alex_orange/emulab-devel
  • hakasapl/emulab-devel
  • cecchet/emulab-devel
  • srirams/emulab-devel
  • chuck/emulab-devel
  • crd/emulab-devel
  • kwebb/emulab-devel
  • moate/emulab-devel
  • grubb/emulab-devel
  • nasir/emulab-devel
  • asydney/emulab-devel
  • kdownie/emulab-devel
  • wvdemeer/emulab-devel
  • anilmr/emulab-devel
  • bvermeul/emulab-devel
  • emulab/emulab-devel
16 results
Show changes
Commits on Source (21526)
VERSION export-subst
# Files that already had DOS-style line endings and those
# that require them should be added to the list below.
clientside/sensors/slothd/idlemon.vbs -crlf
clientside/tmcc/cygwinseven/SetupComplete.cmd -crlf
clientside/tmcc/cygwinseven/unattend-x86.xml.in -crlf
clientside/tmcc/cygwinxp/cygwin-tcsh.bat -crlf
clientside/tmcc/cygwinxp/resolv.conf -crlf
clientside/tmcc/cygwinxp/site-lisp/cygwin-mount.el -crlf
clientside/tmcc/cygwinxp/site-lisp/site-start.el -crlf
clientside/tmcc/cygwinxp/sysprep.inf -crlf
delay/linux/iptables_mods/iptables-1.3.6-imq.diff -crlf
hyperviewer/hv.dsp -crlf
hyperviewer/hv.dsw -crlf
hyperviewer/hypview.bat -crlf
hyperviewer/hypviewer/examples/mfc/h3.cpp -crlf
hyperviewer/hypviewer/examples/mfc/h3Doc.cpp -crlf
hyperviewer/hypviewer/examples/mfc/h3Doc.h -crlf
hyperviewer/hypviewer/examples/mfc/h3.dsp -crlf
hyperviewer/hypviewer/examples/mfc/h3.dsw -crlf
hyperviewer/hypviewer/examples/mfc/h3.h -crlf
hyperviewer/hypviewer/examples/mfc/h3.rc -crlf
hyperviewer/hypviewer/examples/mfc/H3View.cpp -crlf
hyperviewer/hypviewer/examples/mfc/H3View.h -crlf
hyperviewer/hypviewer/examples/mfc/main.cpp -crlf
hyperviewer/hypviewer/examples/mfc/MainFrm.cpp -crlf
hyperviewer/hypviewer/examples/mfc/MainFrm.h -crlf
hyperviewer/hypviewer/examples/mfc/main.h -crlf
hyperviewer/hypviewer/examples/mfc/res/h3.rc2 -crlf
hyperviewer/hypviewer/examples/mfc/Resource.h -crlf
hyperviewer/hypviewer/examples/mfc/StdAfx.cpp -crlf
hyperviewer/hypviewer/examples/mfc/StdAfx.h -crlf
hyperviewer/win32/sets.py -crlf
image-test/tests/linkdelay/nsfile.ns -crlf
image-test/tests/traffic-gen/nsfile.ns -crlf
mote/powermon/powerMeasure/exceptions.cpp -crlf
mote/powermon/powerMeasure/exceptions.h -crlf
mote/powermon/powerMeasure/main.cpp -crlf
mote/powermon/powerMeasure/Makefile -crlf
mote/powermon/powerMeasure/powerMeasure.cpp -crlf
mote/powermon/powerMeasure/powerMeasure.h -crlf
pelab/magent/Command.h -crlf
pelab/magent/CommandInput.h -crlf
pelab/magent/CommandOutput.h -crlf
pelab/magent/Connection.cc -crlf
pelab/magent/KernelTcp.cc -crlf
pelab/magent/lib.cc -crlf
pelab/magent/main.cc -crlf
pelab/magent/SensorList.h -crlf
pelab/stub/lookup.cc -crlf
pelab/stub/stub.h -crlf
protogeni/demo/speed-test/Main.as -crlf
protogeni/demo/speed-test.php -crlf
protogeni/demo/src/AbstractNodes.as -crlf
protogeni/demo/src/ActiveNodes.as -crlf
protogeni/demo/src/AddLinkClip.as -crlf
protogeni/demo/src/com/mattism/http/xmlrpc/MethodFault.as -crlf
protogeni/demo/src/ComponentView.as -crlf
protogeni/demo/src/Console.as -crlf
protogeni/demo/src/CustomCellRenderer.as -crlf
protogeni/demo/src/Link.as -crlf
protogeni/demo/src/ListItem.as -crlf
protogeni/demo/src/Node.as -crlf
protogeni/demo/src/Queue.as -crlf
protogeni/demo/src/QueueNode.as -crlf
protogeni/demo/src/RemoveLinkClip.as -crlf
protogeni/demo/src/RequestReleaseTicket.as -crlf
protogeni/demo/src/RequestSliceEmbedding.as -crlf
protogeni/demo/src/RequestSliverCreate.as -crlf
protogeni/demo/src/RequestSliverDestroy.as -crlf
protogeni/demo/src/RequestSliverStart.as -crlf
protogeni/demo/src/RequestSliverUpdate.as -crlf
protogeni/demo/src/SimpleNodeClip.as -crlf
protogeni/demo/src/SliceWait.as -crlf
tbsetup/ipassign/dre/prepass/pistream.h -crlf
tbsetup/ipassign/dre/prepass/postream.h -crlf
tbsetup/ipassign/etc/autocheck.conf -crlf
tbsetup/plab/libdslice/xmlrpcserver.py -crlf
www/csshover.htc -crlf
www/cssmenu.css -crlf
www/cssmenu-new.css -crlf
www/emulab-mime-winxp.reg -crlf
www/hardware-cmuemlab.html -crlf
www/js/mootools-core.js -crlf
www/js/mootools-tips.js -crlf
www/js/treemap.js -crlf
www/rdp-mime-winxp.c -crlf
www/rdp-mime-winxp.pl -crlf
www/ssh-mime-windows.pl -crlf
www/ssh-mime-winxp.c -crlf
www/ssh-mime-winxp.pl -crlf
www/style.css -crlf
www/style-new.css -crlf
.merge-build
clientside/tmcc/cygwinseven/unattend-7pro-x86.xml.in
extendCMV
\ No newline at end of file
[submodule "protogeni/rspec-geni"]
path = protogeni/rspec-geni
url = git://git-public.flux.utah.edu/geni-rspec.git
......@@ -2,10 +2,24 @@ configure
autoconf/config.guess
autoconf/config.sub
autoconf/install.sh
clientside/configure
clientside/autoconf/config.guess
clientside/autoconf/config.sub
clientside/autoconf/install.sh
clientside/os/imagezip/fat
clientside/os/imagezip/ntfs/liblocale
clientside/lib/event/event_wrap*
clientside/tmcc/cygwinxp/site-lisp
clientside/tmcc/freebsd/init
clientside/tmcc/plab
os/shd
www/cvsweb
robots/vmcd/camera_data/output_camera*
event/lib/event_wrap*
robots/mezzanine
robots/mtp/*.java
robots/mtp/xdr_sizeof.c
robots/vmcd/etc
lib/event_wrap*
doc/ChangeLog
tmcd/cygwinxp/site-lisp
tmcd/plab
......@@ -27,3 +41,17 @@ tool/svn/svn_load_dirs.pl
copyrights
hyperviewer/hypviewer
www/sec-check
www/tutorial
sql
doc
www/doc
GPL-COPYING
LGPL-COPYING
AGPL-COPYING
TODO.plab
MOVED-TO-WIKI
VERSION
protogeni/flack/js/forge
protogeni/flack/src/com/hurlant
protogeni/flack/src/com/mattism
protogeni/protogeniflash/src/com/mattism
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
[This file is absolutely not up to date and is no longer maintained.]
*** cvsupd. - Sep 17 2001 - Fixed by Mike on Sep 24 2001
The old version of cvsupd had the billenium bug, whereby number of
seconds since the epoc is greater than 1billion, and thus breaking
cvsupd. Upgrading was a disaster on Linux. It appears the new version
was trashing the boot block in Linux, and so nodes were not booting
after a cvsupd run.
*** mountd/exports - Sep 17 2001 - Needs to be fixed
Reported by Matt on Sep 17 2001, but actually a known bug with the
exports_setup script and the current mountd/kernel impl, which wipes
out all mounts before installing the new set. This causes transient
failures in NFS access from the testbed nodes since the mounts become
momentarily invalid.
*** Batch Mode Nits - Sep 18 2001 - Fixed by LBS on Sep 25 2001
Reported by Mike.
Nit: experiment create date in Experiment Info "header" is not set.
Is this field meaningless or just not filled in correctly?
Nit: there are two "header" tables shown
I assume this is bacause the batch code prints out a header and then calls
the regular experiment info script to do the rest. Anyway, the second table
is missing lots of date info as well.
Nit: web page for expr takes forever to show the nodes that were allocated.
For a regular experiment, the allocated nodes show up almost immediately,
presumably as soon as assign is done. For a batch experiment, it seems to
take minutes. I can go out and look at assign.log and see that nodes have
been assigned almost right away, they just doesn't wind up in the report
(the DB?) for awhile.
*** Shell experiments - Sep 18 2001 - Needs to be fixed
Reported by Rob.
Perhaps a feature instead of a bug. Shell experiments remain in the
"new" state, and are thus not cleaned up (nodes frees) when the
experiment is terminating. I view that as intended behaviour, but its
easy to change, so we should.
*** Broken lilo.conf - Sep 17 2001 - Partially fixed by LBS on Sep 24 2001
Reported by Matt (and then Rob).
According to Matt, our lilo.conf file is broken. In the next version
of the disk image, we should fix it. Matt sent a fixed version to
testbed-ops on Sep. 17 that we could use as a base.
Partially fixed means I hardwired some assembly code to the serial
line at 115200. A bug was causing it to go to the VGA all the time,
and the higher speeds are just a mess in lilo and I did not want to
mess with the assembly language. Too much of a time sink.
*** IPOD support - Sep 17 2001 - Needs to be fixed.
Reported by Rob.
Our Linux kernel needs to be rebuilt with ping of death support.
*** DummyNet support - Sept 19 2001 - Needs to be fixed.
Reported by Jay.
We need to pass through more DummyNet pipe configuration parameters
for delay nodes. It basically needs some front end parser work (not
too hard), and some changes to the DB where we store that stuff (a few
tables, not too hard), the tmcd to return the additional stuff (not
too hard), and the client delay configuration to use the additional
stuff when configuring the pipes (not too hard).
*** Multiple batch/reload daemons. - Sept 24 2001 - Needs to be fixed.
It is possible to start multiple batch and reload daemons (and many
other TB daemons). Can really mess things up!
*** No text box in approve user page - Sept 24 2001 - Needs to be fixed.
Reported by Mac.
We need to add a text box for sending a message to the applicant, just
like we have in the project approval page.
*** Cleanup of batch experiments - Sep 26 2001 - Needs to be fixed.
Reported by LBS.
Batch experiment system was created before Chris' big rework of the
tb system. At this point, it would be cleaner to combine the batch
experiment table into the normal experiment table (would result in a
couple of extra slots). The two tables make for consistency and
locking problems. What I do like about the current batch system is
that it is more scriptable cause most stuff is done in the backend
script; the web interface does just a bit of checking and then passes
the whole thing off. The normal experiment creation path should look
like this too, since splitting stuff between the web interface and the
perl scripts is messy, and the PHP DB interface is not as nice or
robust as the perl interface.
*** LastLogin info in web page - Sep 27 2001 - Done by LBS on Oct 1 2001.
From: Jay Lepreau <lepreau@cs.utah.edu>
To: "Leigh B. Stoller" <stoller@moab.cs.utah.edu>
Cc: testbed@fast.cs.utah.edu
Subject: Re: cvs commit: testbed/www showproject_list.php3
Date: Wed, 26 Sep 2001 19:11:11 MDT
If it were pretty easy to get wtmp info from plastic
into the database, and displayed in a separate column
on this page, that would be great.
It's the info we need to know who's really active and who's inactive,
which is not only interesting but affects who we ask to free up nodes.
LBS Comment: Probably want last web login info too. This would be
easy to add with a last_login DB table that would be updated in
DOLOGIN in the web server.
*** Need to install ssh on Linux - Sep 27 2001 - Needs to be done.
Suggested by Jay.
I think we should install xinetd and rsh by default. (But not turn on
rsh.) For one thing, many computational cluster users will want MPI.
RPMS: /proj/parmc/rpms/xinetd-2.1.8.9pre14-6.i386.rpm
/proj/parmc/rpms/rsh-server-0.17-2.5.i386.rpm
*** Needs web page to change proj trust - Oct 3 2001 - Needs to be fixed.
Reported by James Griffioen.
No way to change the trust level for a user in a project. Need to
provide a web page for it.
*** Paperbag/plasticwrap bug - Oct 5 2001 -- Fixed by Rob.
Reported by magnus.
magnus@ops ~> os_load -i UTAHPC-FBSD+LINUX -w pc121 pc122 pc123 pc124
pc125 pc126 pc127
Sorry, you used a forbidden character
**********
SSH failed. You may need to run the following commands:
mkdir -m 0755 /users/magnus/.ssh
ssh-keygen -P '' -f /users/magnus/.ssh/identity
cp /users/magnus/.ssh/identity.pub /users/magnus/.ssh/authorized_keys
chmod 600 /users/magnus/.ssh/authorized_keys
**********
*** Inconsistent exit in scripts. Oct 3 2001 - Needs to be fixed
When going to background we should a __DIE__ hook to make sure that
the log file gets emailed off. Generally, the fatal error amd email
stuff is very inconsistent. Normal users should get warm fuzzies.
Informational stuff should go to us.
*** Per User info change - Oct 8 2001 - Needs to be fixed
From: Jay Lepreau <lepreau@cs.utah.edu>
To: Leigh Stoller <stoller@fast.cs.utah.edu>
Subject: Re: Feature Request
Date: Mon, 08 Oct 2001 06:14:43 MDT
After I sent that, I just checked it out. Realized that you
(logically) display the info on the general user info page. What I
was originally wanting was more accurate and precise data for the
general project info page. That would take a bunch of processing: for
each proj, go thru its users, find the minimum time for each type of
login and display that.
Don't need it right now, but eventually we're going to need the kind
of info to move projects to 'inactive'.
The same info is what we'll need to deschedule experiments, or arm twist
their users. But for expts we have the creator, who will usually
be the one using the machines.
*** Node control changes lost on swapin/out - Oct 30 2001 - Fixed by LBS
> From: Mac Newbold <newbold@cs.utah.edu>
> Subject: Re: swapin/out anomoly
> Date: Tue, 30 Oct 2001 15:53:45 -0700 (MST)
>
> Sometimes when we update settings, we update only the physical, and not
> the virtual, and the virtual is all that persists between swaps. IMHO, I
> think what we need to do is evaluate which things make sense to keep
> between swaps, which things don't, and which things should offer a
> choice. This affects OSs, delay params, and potentially other things
> too. Perhaps there's even a unified solution we can implement as part of
> the swapout process.
Its probably a good idea to take the nodecontrol web page and remove the
stuff that changes the DB. Instead, lets use a backend perl script that
will update the DB appropriately (and can be used from the command line
too). Basically, I'm not happy about doing that much DB munging in the web
interface, especially virt_nodes and virt_lans (since it would be nice to
present a web interface to change the delay params at some point).
*** Frisbee sucks up CPU - Nov 10 2001 - Needs to be fixed
Frisbee is sucking up 15% of the CPU. Needs to be profiled.
*** Add virtual name to node control for. - Nov 12 2001 -
Fixed by Leigh on Nov 28 2001.
Requested by Dave.
*** Add quotas on /users. - Nov 12 2001 - Needs to be done.
Need to build and install a kernel on ops with quotas configured in.
*** Have Linux kernel source available - Nov 12 2001 - Needs to be done.
Requested by Jay.
*** Use switch port for 10MBs - Nov 28 2001 - Needs to be done.
LBS - Nov 28th: I worked on this. Turns out the switches do not
like it when the nodes force their ports into 10MB full duplex,
and the switch disables the port.
*** Add "Must Change Password" state. - Dec 3rd 2001 - Needs to be done.
Suggested by Mac. When we change the password and email it, we
should require that user changes his password next time he logs
in.
*** Mysterious TCP drop problem - Nov 21 2001 - Needs to be fixed.
From: Tian Bu <tbu@cs.umass.edu>
To: Mike Hibler <mike@fast.cs.utah.edu>
cc: <testbed-ops@fast.cs.utah.edu>
Subject: News on packet drop
Date: Thu, 29 Nov 2001 14:52:04 -0500 (EST)
After spending sometime on investigating why the packet drop occur
between a pair of linux nodes, I found that this problem is not
related to the OS. Instead, the mysterious packet drop only occurs
between a pair of nodes where one end is PC850 and the other end
is PC600. The settting I first saw the drop was a link between
a PC850 and a PC600. I did report that the drop does not appear
between a pair of freeBSD nodes. That is misleading because it was
measured on a different setting where the pair of nodes I reserved happen
to be both PC850. :-). Today I start another experiment where there are
a pair of PC850 running Linux and observe no mysterious packet drop
between them. I guess there may be some incompatible features between
either the interfaces installed on these two different types of machines.
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
# Copyright (c) 2000-2021 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
# Testbed Makefile
#
......@@ -11,7 +28,11 @@ SUBDIR =
TESTBED_SRCDIR = @top_srcdir@
DISTCLEAN_FILES = @DISTCLEAN_FILES@
EVENTSYS = @EVENTSYS@
PELABSUPPORT = @PELABSUPPORT@
PGENISUPPORT = @PROTOGENI_SUPPORT@
ISMAINSITE = @TBMAINSITE@
SPEWFROMOPS = @SPEWFROMOPS@
MOBILESUPPORT = @MOBILESUPPORT@
SYSTEM := $(shell uname -s)
include Makeconf
......@@ -24,33 +45,78 @@ include Makeconf
# @optional_subdirs@ (has event)
# ipod os security sensors
# Then things that only depend on stuff we've done:
# pxe tbsetup tmcd utils www tip capture vis
# pxe tbsetup tmcd utils backend www tip vis
# Then things that depend on stuff we just did:
#
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
pxe tbsetup account tmcd utils tip capture ipod vis \
sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
tools/svn wiki bugdb collab
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
SUBDIRS = \
clientside/lib \
db assign www @optional_subdirs@ clientside ipod security sensors \
pxe tbsetup account tmcd utils wbstore backend ipod vis \
sensors os xmlrpc autofs install/newnode_sshkeys \
tools/svn collab/exp-vis node_usage install
ifeq ($(ISMAINSITE),1)
SUBDIRS += tools/whol
endif
ifeq ($(PGENISUPPORT),1)
SUBDIRS += protogeni apt powder
endif
else
SUBDIRS = db tbsetup account protogeni
endif
all: all-subdirs
all: all-subdirs just-builddirs
#
# We used to statically link our event agents. We no longer do this, but
# if you want "old style" agents, use this target.
#
all-static:
@LDSTATIC=-static $(MAKE) all
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install:
@echo "Choose either boss-install, ops-install or fs-install"
@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
@echo "Choose tipserv-install for dedicated tip server machines."
else
install: clrhouse-install
endif
#
# For installation on boss node
#
boss-install: install-schemacheck install-sitevarscheck install-dbfillcheck \
install-subdirs install-mkdirs install-setbuildinfo
@echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT"
boss-install: install-checks \
install-subdirs install-mkdirs \
install-setbuildinfo
@echo "Boss node installed!"
#
# Same target, with the install-schemacheck dependency omitted
#
# Same target, with the checks omitted
boss-install-force: install-subdirs install-mkdirs install-setbuildinfo
@echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT"
@echo "Boss node installed!"
# Skip only the schema checks, but do the other checks.
boss-install-noschemacheck: install-updatecheck \
install-sitevarscheck install-dbfillcheck \
install-genischemacheck install-subdirs install-mkdirs \
install-setbuildinfo
# Skip the update check.
boss-install-noupdatecheck: install-schemacheck \
install-sitevarscheck install-dbfillcheck \
install-genischemacheck install-subdirs install-mkdirs \
install-setbuildinfo
# Only the checks:
install-checks: \
install-updatecheck \
install-schemacheck \
install-sitevarscheck \
install-dbfillcheck install-genischemacheck
@echo "Installation checks completed!"
clrhouse-install: install-subdirs install-mkdirs
@echo "CleaingHouse code installed!"
post-install:
@$(MAKE) -C db post-install
......@@ -63,12 +129,15 @@ post-install:
ifeq ($(EVENTSYS),1)
@$(MAKE) -C event post-install
endif
@$(MAKE) -C mote post-install
ifeq ($(MOBILESUPPORT),1)
@$(MAKE) -C mobile
endif
@$(MAKE) -C tools post-install
@$(MAKE) -C wiki post-install
@$(MAKE) -C bugdb post-install
@$(MAKE) -C collab post-install
@$(MAKE) -C utils post-install
ifeq ($(NODE_USAGE_SUPPORT),1)
@$(MAKE) -C node_usage post-install
endif
#
# For installation on the 'ops' or 'users' node (okay, plastic)
......@@ -77,39 +146,48 @@ ops-install:
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/log/mysql
-chmod 770 $(INSTALL_TOPDIR)/log/mysql
-chown mysql.mysql $(INSTALL_TOPDIR)/log/mysql
-chown mysql $(INSTALL_TOPDIR)/log/mysql
-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
-mkdir -p $(INSTALL_TOPDIR)/log/logfiles
-chmod 777 $(INSTALL_TOPDIR)/log/logfiles
@$(MAKE) -C rc.d control-install
@$(MAKE) -C tbsetup control-install
@$(MAKE) -C security control-install
@$(MAKE) -C tip control-install
# @$(MAKE) -C os control-install
@$(MAKE) -C db control-install
@$(MAKE) -C tbsetup control-install
@$(MAKE) -C utils control-install
@$(MAKE) -C lib control-install
@$(MAKE) -C clientside control-install
ifeq ($(EVENTSYS),1)
@$(MAKE) -C event control-install
endif
@$(MAKE) -C sensors control-install
@$(MAKE) -C xmlrpc control-install
@$(MAKE) -C tmcd control-install
@$(MAKE) -C account control-install
ifeq ($(PELABSUPPORT),1)
@$(MAKE) -C pelab control-install
endif
fs-install:
@$(MAKE) -C rc.d fs-install
@$(MAKE) -C tbsetup fs-install
@$(MAKE) -C clientside fs-install
@$(MAKE) -C sensors fs-install
opsfs-install: ops-install fs-install
@echo "Combined ops/fs install done."
install-mkdirs:
-mkdir -p $(INSTALL_TOPDIR)/opsdir
-mkdir -p $(INSTALL_TOPDIR)/db
-mkdir -p $(INSTALL_TOPDIR)/locks
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/log/mysql
-mkdir -p $(INSTALL_TOPDIR)/etc
-mkdir -p $(INSTALL_TOPDIR)/www
-mkdir -p $(INSTALL_TOPDIR)/suidbin
-mkdir -p $(INSTALL_TOPDIR)/ssl
-chmod 770 $(INSTALL_TOPDIR)/ssl
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
-mkdir -p $(INSTALL_TOPDIR)/opsdir
-mkdir -p $(INSTALL_TOPDIR)/log/exports
-mkdir -p $(INSTALL_TOPDIR)/lists
-mkdir -p $(INSTALL_TOPDIR)/backup
-mkdir -p $(INSTALL_TOPDIR)/etc
-mkdir -p $(INSTALL_TOPDIR)/expwork
-mkdir -p $(INSTALL_TOPDIR)/batch
-chmod 777 $(INSTALL_TOPDIR)/batch
......@@ -121,15 +199,18 @@ install-mkdirs:
-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
-mkdir -p $(INSTALL_TOPDIR)/images
-chmod 775 $(INSTALL_TOPDIR)/images
-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
-mkdir -p $(INSTALL_TOPDIR)/ssl
-chmod 770 $(INSTALL_TOPDIR)/ssl
-ln -sf /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
endif
just-builddirs:
@$(MAKE) -C rc.d all
@$(MAKE) -C apache all
tipserv-install:
-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
-mkdir -p $(INSTALL_TOPDIR)/etc
@$(MAKE) -C tip tipserv-install
@$(MAKE) -C capture tipserv-install
@$(MAKE) -C clientside/tip tipserv-install
@$(MAKE) -C clientside/os/capture tipserv-install
@$(MAKE) -C tbsetup tipserv-install
client-mkdirs:
......@@ -137,48 +218,48 @@ client-mkdirs:
-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
client:
@$(MAKE) -C lib/libtb client
ifeq ($(EVENTSYS),1)
@$(MAKE) -C event client
endif
@$(MAKE) -C clientside client
@$(MAKE) -C os client
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
@$(MAKE) -C capture client
@$(MAKE) -C tip client
@$(MAKE) -C tools client
endif
@$(MAKE) -C sensors client
@$(MAKE) -C tmcd client
client-install: client client-mkdirs
ifeq ($(EVENTSYS),1)
@$(MAKE) -C event client-install
endif
@$(MAKE) -C clientside client-install
@$(MAKE) -C os client-install
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
@$(MAKE) -C capture client-install
@$(MAKE) -C tip client-install
@$(MAKE) -C tools client-install
endif
@$(MAKE) -C sensors client-install
@$(MAKE) -C tmcd client-install
subboss:
@$(MAKE) -C clientside subboss
@$(MAKE) -C tbsetup subboss
@$(MAKE) -C db subboss
@$(MAKE) -C os subboss
@$(MAKE) -C utils subboss
subboss-install: subboss
@$(MAKE) -C clientside subboss-install
@$(MAKE) -C tbsetup subboss-install
@$(MAKE) -C os subboss-install
@$(MAKE) -C utils subboss-install
@$(MAKE) -C db subboss-install
@$(MAKE) -C rc.d subboss-install
@$(MAKE) -C dhcpd subboss-install
# Hack: this should probably be done by a subboss-install
# script, but there isn't a huge need for that yet
@rm -f $(INSTALL_RCDIR)/isc-dhcpd
TARBALLDESTDIR = /var/tmp/emulab-client
client-tarball:
@if [ `id -u` -ne 0 ]; then \
echo '*** Must run as root!'; \
false; \
fi
@if [ -d "$(TARBALLDESTDIR)" ]; then \
echo "$(TARBALLDESTDIR) already exists."; \
echo "Remove it and try again."; \
false; \
fi
echo "Building and installing client-side in $(TARBALLDESTDIR)..."
DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
echo "Creating tarball..."
tar czf emulab-client.tar.gz -C $(TARBALLDESTDIR) .
@$(MAKE) -C clientside client-tarball
client-src-tarball:
@rm -f emulab-client-src.tar.gz
tar clzf emulab-client-src.tar.gz -C clientside
# This is not finished yet.
client-shadow-rpm:
-$(RM) -rf rpmbuild
mkdir -p rpmbuild/SOURCES rpmbuild/SRPMS
$(CP) emulab-client-src.tar.gz rpmbuild/SOURCES
$(RPM) -v -bs --nodeps --define='_topdir $(TOPDIR)/rpmbuild' \
clientside/shadow.spec
destdircheck:
@if [ -z "$(DESTDIR)" ]; then \
......@@ -192,34 +273,102 @@ destdircheck:
mfsoscheck:
@if [ `uname -s` != "FreeBSD" ]; then \
echo "Must build MFS files on a FreeBSD system!"; \
echo "Must build CDROM/MFS files on a FreeBSD system!"; \
false; \
fi
mfs: mfsoscheck
@$(MAKE) -C os mfs
@$(MAKE) -C sensors mfs
@$(MAKE) -C tmcd mfs
@$(MAKE) -C clientside mfs
mfs-nostatic: mfsoscheck
@NOSTATIC=1 $(MAKE) -C clientside mfs
mfs-install: destdircheck mfs client-mkdirs
@$(MAKE) -C os mfs-install
@$(MAKE) -C sensors mfs-install
@$(MAKE) -C tmcd mfs-install
@$(MAKE) -C clientside mfs-install
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
@$(MAKE) -C clientside mfs-install
frisbee-mfs: mfsoscheck
@$(MAKE) -C cdrom/groklilo client
@$(MAKE) -C os frisbee-mfs
@$(MAKE) -C tmcd frisbee-mfs
@$(MAKE) -C clientside frisbee-mfs
frisbee-mfs-nostatic: mfsoscheck
@NOSTATIC=1 $(MAKE) -C clientside frisbee-mfs
frisbee-mfs-install: destdircheck frisbee-mfs
@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
@$(MAKE) -C clientside frisbee-mfs-install
frisbee-mfs-nostatic-install: destdircheck frisbee-mfs-nostatic
@$(MAKE) -C clientside frisbee-mfs-install
newnode-mfs: mfsoscheck
@$(MAKE) -C clientside newnode-mfs
newnode-mfs-nostatic: mfsoscheck
@NOSTATIC=1 $(MAKE) -C clientside newnode-mfs
newnode-mfs-install: destdircheck newnode-mfs client-mkdirs
@$(MAKE) -C clientside newnode-mfs-install
newnode-mfs-nostatic-install: destdircheck newnode-mfs-nostatic client-mkdirs
@$(MAKE) -C clientside newnode-mfs-install
cdboot: mfsoscheck client
@echo "CD/Dongle files built"
cdboot-install: destdircheck cdboot
@$(MAKE) -C cdrom client-install
@$(MAKE) -C clientside/tmcc/freebsd6 cdboot-install
flashboot: mfsoscheck client
@echo "Flash dongle files built"
flashboot-install: destdircheck flashboot
@$(MAKE) -C clientside/tmcc/freebsd6 cdboot-install
@$(MAKE) -C os frisbee-mfs-install
@$(MAKE) -C tmcd frisbee-mfs-install
@$(MAKE) -C flash client-install
@$(MAKE) -C clientside frisbee-mfs-install
#
# A check to see if this is a 'real' install. Kinda hacky, but as far as I can
# tell, you can't put ifeq()'s inside of targets
#
ifeq ($(TBROOT),/usr/testbed)
UPDATETESTBED= @cd $(OBJDIR)/install && perl update-testbed
else
UPDATETESTBED= @echo "Skipping update check, since prefix isn't /usr/testbed"
endif
ifeq ($(ISMAINSITE),1)
update-testbed: update-testbed-nostop
else
update-testbed: update-testbed-install
endif
update-testbed-install:
@echo "Updating the testbed ..."
$(UPDATETESTBED) -i -s
update-testbed-noinstall:
@echo "Updating the testbed ..."
$(UPDATETESTBED)
update-testbed-nostop:
@echo "Updating the testbed ..."
$(UPDATETESTBED) -i
update-testbed-force:
@echo "Updating the testbed in force mode ..."
$(UPDATETESTBED) -f
ifeq ($(TBROOT),/usr/testbed)
UPDATECHECK= @cd $(OBJDIR)/install && perl update-testbed -v
else
UPDATECHECK= @echo "Skipping update checks, since prefix isn't /usr/testbed"
endif
install-updatecheck:
@echo "Checking to see if updates need to be run"
$(UPDATECHECK)
ifeq ($(TBROOT),/usr/testbed)
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
else
......@@ -256,15 +405,97 @@ install-setbuildinfo:
@echo "Setting the Build and Version info"
$(SETBUILDINFO)
install-genischemacheck:
ifeq ($(PGENISUPPORT),1)
@$(MAKE) -C protogeni install-genischemacheck
endif
@echo "Done"
BRANCHCHECK=
BRANCHECHO= @echo "Skipping branch check since not the Mothership"
ifeq ($(ISMAINSITE),1)
ifeq ($(TBROOT),/usr/testbed)
BRANCHCHECK= cd $(SRCDIR) && \
git status --porcelain -s -b | head -1 | grep -q -s current
BRANCHECHO= @echo "Checking to make sure you are on the mothership branch"
endif
endif
install-branchcheck:
$(BRANCHECHO)
$(BRANCHCHECK)
# We use separate src and obj trees in Emulab, so the traditional distclean to
# clean "made" files from a mingled source-and-obj tree is unnecessary.
# However, this may be useful if you mistakenly configure and make a src tree.
clean: clean-subdirs
distclean: distclean-subdirs
rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
rm -f $(DISTCLEAN_FILES)
elabinelab:
#
# Be careful, do not run these unless you are updating your installation
# with a new IP subnet or domain name.
#
boss-updateip-clean: clean
@$(MAKE) -C rc.d clean
@$(MAKE) -C apache clean
@$(MAKE) -C named clean
@$(MAKE) -C dhcpd clean
ops-updateip-clean: clean
@$(MAKE) -C rc.d clean
@$(MAKE) -C apache clean
update-rcd:
@$(MAKE) -C rc.d all
@$(MAKE) -C rc.d install
#
# Here's a different approch to recover from just configure problems. It cleans
# all files from an obj tree that have a corresponding .in file in the src tree.
undo-configure:
find $SRCDIR -name '*.in' -a -not -name configure.in | \
sed -e "s;$SRCDIR;$OBJDIR;" -e 's;[.]in$;;' | xargs rm -f
#
# XXX a "temporary" hack for scripts that were evolving fast.
# We didn't want to have to remake the client image whenever we changed these.
# They are copied over to the embryonic boss and ops during setup.
#
elabinelab-scripts:
mkdir -p $(INSTALL_TOPDIR)/etc
cp -f $(SRCDIR)/clientside/tmcc/freebsd/mkextrafs.pl $(INSTALL_TOPDIR)/etc/
cp -f $(SRCDIR)/clientside/tmcc/common/config/rc.mkelab $(INSTALL_TOPDIR)/etc/
ifeq ($(SPEWFROMOPS),1)
elabinelab-nogit: elabinelab-scripts
-mkdir -p /share/emulab
rm -f /share/emulab/emulab-src.tar.gz
tar czf /share/emulab/emulab-src.tar.gz -C $(SRCDIR) --exclude=.git .
elabinelab-git: elabinelab-scripts
-mkdir -p /share/emulab
rm -f /share/emulab/emulab-src.tar.gz
(cd $(SRCDIR); \
git archive HEAD > /share/emulab/emulab-src.tar)
tar rf /share/emulab/emulab-src.tar -C $(SRCDIR) \
--exclude=.git protogeni/rspec-geni
gzip /share/emulab/emulab-src.tar
else
elabinelab-nogit: elabinelab-scripts
-mkdir -p $(INSTALL_TOPDIR)/src
rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
tar czf $(INSTALL_TOPDIR)/src/emulab-src.tar.gz -C $(SRCDIR) .
tar czf $(INSTALL_TOPDIR)/src/emulab-src.tar.gz -C $(SRCDIR) --exclude=.git .
elabinelab-git: elabinelab-scripts
-mkdir -p $(INSTALL_TOPDIR)/src
rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
(cd $(SRCDIR); \
git archive HEAD > $(INSTALL_TOPDIR)/src/emulab-src.tar)
tar rf $(INSTALL_TOPDIR)/src/emulab-src.tar -C $(SRCDIR) \
--exclude=.git protogeni/rspec-geni
gzip $(INSTALL_TOPDIR)/src/emulab-src.tar
endif
# How to recursively descend into subdirectories to make general
# targets such as `all'.
......@@ -275,7 +506,10 @@ elabinelab:
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
.PHONY: post-install install-mkdirs
.PHONY: post-install install-mkdirs clrhouse-install install \
boss-install-noupdatecheck boss-install-noschemacheck \
boss-install-force update-testbed update-testbed-install \
update-testbed-noinstall update-testbed-nostop
# Get rid of a bunch of nasty built-in implicit rules.
.SUFFIXES:
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
# Copyright (c) 2000-2012, 2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
# Get rid of a bunch of nasty built-in implicit rules,
# to avoid bogus circular dependencies and make things go faster.
......@@ -36,29 +53,76 @@ $(INSTALL_ETCDIR)/%: %
-mkdir -p $(INSTALL_ETCDIR)
$(INSTALL_DATA) $< $@
$(addprefix $(INSTALL_SBINDIR)/, $(SETUID_SBIN_SCRIPTS)): $(INSTALL_SBINDIR)/%: %
$(addprefix $(INSTALL_SBINDIR)/, $(SETUID_SBIN_PROGS)): $(INSTALL_SBINDIR)/%: %
echo "Installing (setuid) $<"
-mkdir -p $(INSTALL_SBINDIR)
$(SUDO) $(INSTALL) -o root -m 4755 $< $@
$(addprefix $(INSTALL_BINDIR)/, $(SETUID_BIN_SCRIPTS)): $(INSTALL_BINDIR)/%: %
$(addprefix $(INSTALL_BINDIR)/, $(SETUID_BIN_PROGS)): $(INSTALL_BINDIR)/%: %
echo "Installing (setuid) $<"
-mkdir -p $(INSTALL_BINDIR)
$(SUDO) $(INSTALL) -o root -m 4755 $< $@
$(addprefix $(INSTALL_LIBEXECDIR)/, $(SETUID_LIBX_SCRIPTS)): $(INSTALL_LIBEXECDIR)/%: %
$(addprefix $(INSTALL_LIBEXECDIR)/, $(SETUID_LIBX_PROGS)): $(INSTALL_LIBEXECDIR)/%: %
echo "Installing (setuid) $<"
-mkdir -p $(INSTALL_LIBEXECDIR)
$(SUDO) $(INSTALL) -o root -m 4755 $< $@
$(addprefix $(INSTALL_SBINDIR)/, $(SETUID_SBIN_SCRIPTS)): $(INSTALL_SBINDIR)/%: % $(INSTALL_SUIDDIR)/%
echo "Installing (link to wrapper) $<"
-mkdir -p $(INSTALL_SBINDIR)
-rm -f $@
ln -s $(INSTALL_LIBEXECDIR)/runsuid $@
$(addprefix $(INSTALL_BINDIR)/, $(SETUID_BIN_SCRIPTS)): $(INSTALL_BINDIR)/%: % $(INSTALL_SUIDDIR)/%
echo "Installing (link to wrapper) $<"
-mkdir -p $(INSTALL_BINDIR)
-rm -f $@
ln -s $(INSTALL_LIBEXECDIR)/runsuid $@
$(addprefix $(INSTALL_LIBEXECDIR)/, $(SETUID_LIBX_SCRIPTS)): $(INSTALL_LIBEXECDIR)/%: % $(INSTALL_SUIDDIR)/%
echo "Installing (link to wrapper) $<"
-mkdir -p $(INSTALL_LIBEXECDIR)
-rm -f $@
ln -s $(INSTALL_LIBEXECDIR)/runsuid $@
# Special libexec rule for scripts invoked by suexec (cannot be a symlink)
$(addprefix $(INSTALL_LIBEXECDIR)/, $(SETUID_SUEXEC_SCRIPTS)): $(INSTALL_LIBEXECDIR)/%: % $(INSTALL_SUIDDIR)/%
echo "Installing (hard link to wrapper) $<"
-mkdir -p $(INSTALL_LIBEXECDIR)
-rm -f $@
ln $(INSTALL_LIBEXECDIR)/runsuid $@
$(INSTALL_SUIDDIR)/%: %
echo "Installing (real script) $<"
-mkdir -p $(INSTALL_SUIDDIR)
$(SUDO) $(INSTALL_PROGRAM) $< $@
CFLAGS += $(LOCALCFLAGS)
clean:
distclean: clean
# This is to avoid warnings about duplicate targets.
distclean: default-clean
default-clean:
rm -f GNUmakefile
# This is to avoid warnings about duplicate targets.
default-install-notusing:
ifeq ($(ISMAINSITE),1)
ifeq ($(TBROOT),/usr/testbed)
(cd $(SRCDIR) ; \
git status --porcelain -s -b | head -1 | grep -q -s current)
else
/usr/bin/true
endif
else
/usr/bin/true
endif
#install: default-install
#
# Where to find source files.
# Using specific patterns instead of the catch-all VPATH variable
......@@ -97,7 +161,7 @@ vpath % $(SRCDIR) $(MOSTLY_SRCDIRS)
#
# Rules to regen configure written files.
#
%: %.in
%: %.in $(OBJDIR)/config.status
@echo "Regenerating $@"
cd $(OBJDIR) && CONFIG_FILES=$(SUBDIR)/$@ ./config.status
......@@ -117,3 +181,25 @@ check: $(TESTS)
fi \
done
endif
ifeq ($(MERGE_BUILD),1)
.PRECIOUS: ${SRCDIR}/*
#
# I really want to say something like:
# ${TESTBED_SRCDIR}/.merged: $(wildcard ${OBJDIR}/${MERGE_BUILD_SANDBOX}/${SUBDIR}/*)
# but that causes problems if one the prereq. has a rule for it (such
# as when both GNUmakefile and GNUmakefile.in exist in the source tree),
# thus I do the equivalent manually
#
newest=$(shell ls -rtd "${OBJDIR}/${MERGE_BUILD_SANDBOX}/${SUBDIR}/"* "${TESTBED_SRCDIR}/.merged" | tail -n 1)
ifneq ($(newest),${TESTBED_SRCDIR}/.merged)
${TESTBED_SRCDIR}/.merged:
cd ${TESTBED_SRCDIR} && utils/merge-build sync
.PHONY: ${TESTBED_SRCDIR}/.merged
else
${TESTBED_SRCDIR}/.merged:
endif
${SRCDIR}/*: ${TESTBED_SRCDIR}/.merged
endif
EMULAB SOFTWARE SNAPSHOT LICENSE TERMS
Except for any files marked with the GNU General Public License, or that
bear non-Utah copyrights and are unchanged from the original (e.g., cracklib
and healthd), this Emulab code snapshot comes with RESTRICTED RIGHTS.
Permission to use, copy, and modify this software is hereby
granted provided that the following conditions are met.
This snapshot of the Emulab/Netbed code:
-is for use only for research and education, by you and by those
who use services that you provide using this software,
-cannot be used for commercial purposes, and
-cannot be redistributed outside your research group.
By accepting this software, you agree
-to retain this notice and all included copyright and credit notices,
-that in order to improve the common platform, to return improvements to
the University of Utah under terms that allow us, without charge, to
use and redistribute them under this license,
-to prominently give appropriate credit to "Emulab" and the University of
Utah in the primary user interface(s) to systems that use this
software, and in talks and all written and promotional material that
mention features or use of this software. In the Web interface this
includes maintaining the portion of the page header banner which
links to Utah's site and says "Built with Emulab" or, at our discretion,
a subsequent version which includes a reference to "Utah."
-to take reasonable steps to ensure these conditions are met (e.g.,
make your group's members aware of these terms, limit source access
to your group's members, and ensure your users are non-commercial).
We request that you ask your users to cite the Emulab/Netbed OSDI 2002 paper
in papers containing results obtained from services based on this software.
It is the University of Utah's intention to provide you future improvements
it makes to the software. The University cannot commit to any support.
THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND
FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
Contact emulab-dist@flux.utah.edu or 801-585-3271 if you wish to
explore alternate license terms. The terms may become more liberal in
a future formal release.
November 4, 2004
Flux Research Group
School of Computing
University of Utah
50 S. Central Campus Dr. Rm. 3190
Salt Lake City, UT 84112
# The following documentation files are now available on the WIKI at
# at http://users.emulab.net/trac/emulab/wiki/<PAGE>
#
FILE WIKI PAGE
doc/arch-hier.txt ArchHeir
doc/arch.txt Arch
doc/boot-scaling-issues.txt BootScalingIssues
doc/care-and-feeding.txt CareAndFeeding
doc/cisco-voodoo.txt CiscoVoodoo
doc/client-selfconfig.txt ClientSelfConfig
doc/create-generic-image.txt CreateGenericImage
doc/cross-compiling.txt CrossCompiling
doc/customize-image.txt CustomizeImage
doc/customize-mfs.txt CustomizeMfs
doc/dbtoir.txt dbtoir
doc/delay-implementation.txt DelayImplementation
doc/errorcodes.txt ErrorCodes
doc/hardware-mail.mbox HardwareMail
doc/ip-assumptions.txt IP Assumptions
doc/kernel-patches.txt KernelPatches
doc/linux-kernel.txt LinuxKernel
doc/multiplexed-links.txt MultiplexedLinks
doc/newimage.txt NewImage
doc/newnode-from-admin.txt NewnodeFromAdmin
doc/overview.txt Overview
doc/package-building.txt PackageBuilding
doc/port2-serial-console.txt Port2SerialConsole
doc/security.txt SecurityNotes
doc/setup-elabinelab.txt SetupElabinelab
doc/setup-plc.txt SetupPLC
doc/shellonboss.txt ShellOnBoss
doc/snmpit-internals.txt SnmpitInternals
doc/tftpboot-setup.txt TftpbootSetup
doc/tim-stack.nits TimStackNits
doc/uk-image.txt UK Image
doc/ulsshxmlrpcpp.txt ulsshxmlrpcpp
doc/update-mfs.txt UpdateMFS
doc/update-node.txt UpdateNode
doc/updating-RHL/ UpdatingRHL
doc/vnode-impl.txt VnodeImpl
doc/vnode-setup.txt VnodeSetup
doc/webglimpse.txt WebGlimpse
event/linktest/linktest.html linktest
www/auth.html Auth
www/doc.php3 .
www/doc/emotes.html emotes
www/doc/exclasses.html Classes
www/doc/hw-recommend.html HWRecommend
www/doc/jail.html jail
www/doc/linkdelays.html linkdelays
www/doc/netbuilddoc.html netbuilddoc
www/doc/pc2000.html pc2000
www/doc/pc3000.html pc3000
www/doc/plab.html plab
www/doc/windows.html Windows
www/groups.html Groups
www/hardware-emulab.net.html UtahHardware
www/otheremulabs.html OtherEmulabs
www/policies.html AdminPolicies
www/rdp-mime.html rdp_mime
www/security.html SecReqs
www/software.html software
www/ssh-mime.html ssh_mine
www/swapping.html Swapping
www/tutorial/advanced.html AdvancedExample
www/tutorial/behindthescenes.html behindthescenes
www/tutorial/elabinelab.php3 elabinelab
www/tutorial/eventsystem.html eventsystem
www/tutorial/firewall.html firewall
www/tutorial/gnuradio.html gnuradio
www/tutorial/ixp.html ixp
www/tutorial/netfpga.html netfpga
www/tutorial/nscommands.html nscommands
www/tutorial/nse.html nse
www/tutorial/routing.html routing
www/tutorial/secure.html secure
www/tutorial/tutorial.html Tutorial
www/tutorial/tutorial.php3 Tutorial
www/tutorial/vnodes.html vnodes
www/tutorial/widearea.html widearea
www/tutorial/wireless.html wireless
www/widearea.html wideareaAUP
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
# Most of the configure-substitution magic is done here.
# All the other makefiles in the NodeOS include
......@@ -27,7 +44,9 @@ export JAR = @JAR@
prefix = @prefix@
exec_prefix = @exec_prefix@
ISMAINSITE = @TBMAINSITE@
TBROOT = @prefix@
TBDEFS = @TBDEFS@
TBDBNAME = @TBDBNAME@
TBADMINGROUP = @TBADMINGROUP@
TBOPSEMAIL = @TBOPSEMAIL@
......@@ -37,6 +56,7 @@ TBAUDITEMAIL = @TBAUDITEMAIL@
TBACTIVEARCHIVE = @TBACTIVEARCHIVE@
TBUSERSARCHIVE = @TBUSERSARCHIVE@
TBERRORSEMAIL = @TBERRORSEMAIL@
TBAPPROVALEMAIL = @TBAPPROVALEMAIL@
BOSSNODE = @BOSSNODE@
USERNODE = @USERNODE@
FSNODE = @FSNODE@
......@@ -60,6 +80,7 @@ INSTALL_LIBEXECDIR = @libexecdir@
INSTALL_ETCDIR = @sysconfdir@
INSTALL_INCDIR = @includedir@
INSTALL_WWWDIR = @exec_prefix@/www
INSTALL_SUIDDIR = @exec_prefix@/suidbin
INSTALL_RCDIR = @INSTALL_RCDIR@
INSTALL_APACHE_CONFIG = @INSTALL_APACHE_CONFIG@
......@@ -77,10 +98,27 @@ CLIENT_MANDIR = @CLIENT_MANDIR@
LOG_TESTBED = @LOG_TESTBED@
EVENTSYS = @EVENTSYS@
ELVIN_COMPAT = @ELVIN_COMPAT@
HAVE_MEZZANINE = @HAVE_MEZZANINE@
GTK_CONFIG = @GTK_CONFIG@
BRAINSTEM_DIR = @BRAINSTEM_DIR@
WITH_EMULAB = @WITH_EMULAB@
OPSVM_ENABLE = @OPSVM_ENABLE@
OPSVM_MOUNTPOINT= @OPSVM_MOUNTPOINT@
APACHE_VERSION = @APACHE_VERSION@
APACHE_START_COMMAND = @APACHE_START_COMMAND@
host_cpu = @host_cpu@
HAVE_ULXMLRPCPP = @HAVE_ULXMLRPCPP@
STANDALONE_CLEARINGHOUSE = @STANDALONE_CLEARINGHOUSE@
NODE_USAGE_SUPPORT = @NODE_USAGE_SUPPORT@
MERGE_BUILD = @MERGE_BUILD@
MERGE_BUILD_SANDBOX = @MERGE_BUILD_SANDBOX@
EXP_VIS_SUPPORT = @EXP_VIS_SUPPORT@
TESTBED_LIBSRCDIR = ${TESTBED_SRCDIR}/clientside/lib
TESTBED_LIBOBJDIR = ${OBJDIR}/clientside/lib
TESTBED_IMAGEZIPSRCDIR = ${TESTBED_SRCDIR}/clientside/os/imagezip
This is a snapshot of the current source code for the software that runs
Netbed (Emulab++) at the University of Utah, as well as testbeds at other
sites:
http://www.emulab.net/
Welcome to Emulab!
This is a snapshot of a rapidly-evolving system, rather than an engineered
release. It contains all Netbed source required to build a running testbed, but
interaction with Utah will almost certainly be required to get things up and
running.
This is the "official" source code for the software that runs the Emulab
network testbed at the University of Utah, as well as dozens of testbeds at
other sites around the world.
Netbed is being actively developed, so there will be features on deployed
Netbeds that are not included in this snapshot. Contact us (contact info at the
bottom of this file) if you are interested in receiving an updated version of
this source.
http://www.emulab.net/
This is a snapshot of a rapidly evolving system. It contains all Emulab
source required to build a running testbed, but interaction with Emulab
admins at Utah and elsewhere will likely be required to get things up
and running.
IMPORTANT NOTE
See the file LICENSE for restrictions on this snapshot.
In summary, you can't redistribute it, use it for commercial
purposes, must give appropriate credit to Utah and Emulab,
and return improvements to us. These terms may become more
liberal in a future formal release.
Emulab is being actively developed, so there may be features in deployed
Emulabs (in particular, Utah's) that are not included in this release.
Emulab is also a research project, and is rapidly evolving to satisfy the
needs of both our research needs and external researchers. For that reason,
you might find bugs! We hope you will tell us about them (nicely) and maybe
even help us to fix them. More on this below.
HOW TO SETUP
Copy and localize the 'defs-example' file for your environment
and run "./configure". See doc/setup.txt for details.
HOW TO SETUP AN EMULAB
The Emulab installation documentation is located on the Utah Emulab Wiki:
https://users.emulab.net/trac/emulab/wiki/InstallRoot
This source currently only builds on FreeBSD, and requires several packages;
the dependencies can be found in the Makefile for our 'meta-port' in
install/ports/emulab-boss .
HOW TO UPDATE
Start by looking at doc/update-testbed.txt.
HOW TO UPDATE AN EMULAB
Updating your existing Emulab is a bit harder than a fresh install, but is
mostly automated. A process that we hope will work for most sites is
located on the Utah Emulab Wiki:
http://users.emulab.net/trac/emulab/wiki/InstallRoot
under "Upgrade Documentation."
TRACKING THE EMULAB SOURCE CODE
We encourage you to track the Emulab source code in real time and stay
current with our stable versions. More info on how to access the
Emulab source code repository is here:
http://users.emulab.net/trac/emulab/wiki/GitRepository
MAILING LISTS
If you are bringing up an Emulab, be sure to join the mailing list:
emulab-admins@googlegroups.com
http://groups.google.com/group/emulab-admins
which has open archives.
Users of your Emulab should join the Emulab users group, which is intended
for all users of Emulabs anywhere, to help each other:
emulab-users@googlegroups.com
http://groups.google.com/group/emulab-users
HELP/CONTACT INFORMATION
For help and to report bugs and problems, mail to
emulab-admins@googlegroups.com
Don't be shy! In most cases, you will have the same questions other people
have. Search the archives, too! There is lots of good information there.
COPYRIGHT, LICENSE, AND DISTRIBUTION
Emulab is copyrighted by the Flux Research Group and the University of Utah.
This release of the Emulab software is distributed under the terms of the GNU
Affero General Public License, version 3 (AGPLv3). The AGPLv3 is a popular
open source license; see the file AGPL-COPYING for licensing conditions. The
AGPLv3 consists of the GNU General Public License version 3 (GPLv3) with a
single short addition (Section 13), which requires that the source be freely
available to all users who interact with the software through a network.
The Emulab source tree contains various third-party, open-source packages that
are used by Emulab. These third-party packages are copyrighted and licensed as
described in their source files.
The development of Emulab has been supported by numerous organizations
including NSF, DARPA, Intel, HP, Microsoft, Novell, Nortel, and the University
of Utah. We thank all of these organizations for making Emulab possible.
The following statement is required by DARPA and pertains to DARPA's support
for portions of the Emulab software:
DoD Distribution Statement A: Approved for public release; distribution is
unlimited.
DOCUMENTATION
This is a snapshot, not a formal distribution, so don't expect
great documentation.
doc/* contains documentation for developers.
www/*.html and www/doc/*.html contain end-user documentation.
Good places to start would include:
- The doc/papers directory, which contains papers published about Netbed
- The user tutorial (www/tutorial/tutorial.html)
- The user FAQ (www/faq.html)
- The user authorization document (www/auth.html)
- Some powerpoint slides on Emulab internals, found at:
http://www.cs.utah.edu/flux/testbed-doc/internals/
These include two files especially useful for setting up your own
testbed: "build-operate.ppt" and the first part of "security-all.ppt".
- Software architecture preliminary diagram (doc/arch-diagram.ps)
- Notes on the source tree and architecture (doc/arch.txt)
- Overview of some major systems (doc/overview.txt)
- Diagrams and brief explanations of the state machines used in the
system (www/doc/states.html and www/doc/*.gif)
- The instructions for building a running system from scratch (doc/setup*.txt)
- Mail we have exchanged with others about hardware recommendations
(doc/hardware-mail.mbox)
All of the Emulab documentation is available from the Utah Emulab site:
http://users.emulab.net/trac/emulab/wiki
QUICK TOUR
- The Database maintains most testbed state.
- LibDB (db/libdb.pm.in) is the main DB interface for testbed software.
- sql/database-create.sql contains the DB schema.
- The Web Interface (www/*) is the primary means of managing the system.
We encourage people to help us improve our documentation. If you want to
make changes, please apply for an account at Utah; anyone with an account
at the Utah Emulab is allowed to edit the Wiki pages.
Other good places to start would include:
- The search box at www.emulab.net
- The Emulab Wiki (http://users.emulab.net/trac/emulab/wiki)
- Getting Started document (http://users.emulab.net/trac/emulab/wiki/Auth)
- The user tutorial (http://users.emulab.net/trac/emulab/wiki/Tutorial)
- The user FAQ (http://users.emulab.net/trac/emulab/wiki/FAQ)
- Papers and talks about Emulab (http://www.emulab.net/pubs.php3)
- Papers using Emulab (http://www.emulab.net/expubs.php)
- startexp (tbsetup/startexp.in) is the backend for experiment creation;
Important scripts it calls include tbprerun (tbsetup/tbprerun.in)
and tbswap (tbsetup/tbswap.in).
- ns2ir (tbsetup/ns2ir/*) converts NS files to DB state (via TCL).
QUICK TOUR
- The database maintains most testbed state.
* Assorted modules (db/*.pm.in) are the main DB interface for testbed
software.
* sql/database-create.sql contains the DB schema.
- The Web interface (www/*) is the primary means of managing and
interfacing with the system. There is also an experimental
standalone GUI that uses this interface.
- The tbsetup and backend directories contain the bulk of the server-side
experiment setup and management code.
* startexp (tbsetup/startexp.in) is the back end for experiment creation.
Important scripts it calls include tbprerun (tbsetup/tbprerun.in)
and tbswap (tbsetup/tbswap.in).
* ns2ir (tbsetup/ns2ir/*) converts NS files to DB state (via TCL and XML).
* snmpit (tbsetup/snmpit.in) configures VLANs on switch hardware.
- assign (assign/*) maps experiments to available hardware.
- snmpit (tbsetup/snmpit.in) configures VLANs on switch hardware.
- frisbee (os/frisbee.redux/*) uses multicast to rapidly deploy disk images.
- tmcd (tmcd/*) is contacted by nodes as they boot up, to get configuration.
- The frisbee subsystem (os/frisbee.redux, os/imagezip) is used for the
creation and rapid deployment of disk images.
- The client-driven node configuration is handled by scripts on the client
which communicate with the server via a custom configuration protocol.
The server- and client-side of this mechanism is in the tmcd subdir.
- capture and console (capture/*, tip/*) provide serial line access to nodes.
- dynamic node and experiment control is provided via the Emulab event
system and its assorted agents (event/*).
SOURCE TREE ORGANIZATION
account - Account creation and management
apache - Apache HTTPD configuration
assign - Resource allocation software
backend - Server-side of the Emulab XML-RPC interface
bugdb - Optional per-project bug database
capture - Node serial line server software
cdrom - Software related to CD-booting local and remote machines
db - Variety of interfaces to testbed state
collab - Optional per-project "collaboration" tools: CVS, jabber, mailman
db - Variety of interfaces to testbed state
delay - RHL9 patches for supporting "end-node" traffic shaping
dhcpd - DHCPD configuration
doc - Documentation (mainly internal)
event - Event System
hyperviewer - 3D experiment visualization tool
firewall - Code and notes for per-experiment control net firewalls
flash - Software related to flash-dongle-booting local and remote machines
hyperviewer - 3D experiment visualization tool (not used)
image-test - Test framework for auto-testing of new OS images
install - Site installation scripts
ipod - "Ping of Death" software
ir - NS-to-database interpreter (in TCL)
ipod - "Ping of Death" software/patches
lib - C/C++ interface libraries
mote - Initial testbed support for Berkeley/Crossbow motes
named - BIND configuration files
os - Client-side software (disk loading, route calculation, etc.)
patches - Patches needed to compile standard software packages
pelab - Preliminary support for "Flexlab," an Emulab/PlanetLab hybrid
(see http://www.cs.utah.edu/flux/flexlab/)
protogeni - Evolving software for a prototype GENI system based on Emulab
(see http://www.protogeni.net/)
pxe - Software related to PXE-booting machines
rc.d - Server-side startup scripts
robots - Support for mobile wireless (Garcia robots)
security - Tools for secure boss node access
sensors - Node monitoring daemons
sql - Database schema and initialization
......@@ -106,20 +176,12 @@ tbsetup - Experiment creation and manipulation
testsuite - Automated testing suite
tip - Node serial line client software
tmcd - Testbed master control daemon and client (for node configuration)
tools - Misc. infrastructure tools
utils - Testbed configuration and maintenence tools
tools - Miscellaneous infrastructure tools
utils - Testbed configuration and maintenance tools
vis - Experiment visualization
wiki - Support for per-project Wikis
www - Web Interface / User Documentation
xmlrpc - Programatic XML-RPC interface to testbed
HELP/CONTACT INFORMATION
For help and to report bugs and problems, mail
testbed-ops@flux.utah.edu
Don't be shy!
We are happy to get on the phone with you, too,
for "big picture" issues and problems.
Jay Lepreau, lepreau@cs.utah.edu, 801-581-4285, and the Utah testbed crew.
February 1, 2004
]
Good luck!
The Emulab Team
Version: $Format:%H %ci$
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use English;
#
# This gets invoked from the Web interface. Simply a wrapper ...
# Automatically generated from the template in the toplevel dir.
#
#
# Configure variables
#
my $PROG = "@PROGTOINVOKE@";
#
# Run the real thing, and never return.
#
exec $PROG, @ARGV;
die("Could not exec $PROG: $!");
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
# Copyright (c) 2000-2024 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
SRCDIR = @srcdir@
......@@ -12,27 +29,53 @@ UNIFIED = @UNIFIED_BOSS_AND_OPS@
include $(OBJDIR)/Makeconf
SBIN_STUFF = tbacct addsfskey addpubkey mkusercert quotamail genpubkeys
LIBEXEC_STUFF = webtbacct webaddsfskey webaddpubkey webmkusercert
SBIN_STUFF = tbacct addsfskey addpubkey mkusercert quotamail genpubkeys \
newuser newproj mksyscert spewcert dumpuser dumpproject \
manageremote regencerts
LIBEXEC_STUFF = webtbacct webaddsfskey webaddpubkey webmkusercert \
webnewuser webnewproj webspewcert webmanageremote
CTRLSBIN_STUFF = adduserhook accountsetup
# These scripts installed setuid, with sudo.
SETUID_BIN_SCRIPTS =
SETUID_SBIN_SCRIPTS = tbacct addpubkey mkusercert
SETUID_SBIN_SCRIPTS = tbacct addpubkey mkusercert mksyscert
SETUID_LIBX_SCRIPTS =
ifeq ($(PROTOGENI_SUPPORT),1)
SBIN_STUFF += manageremote
SETUID_SBIN_SCRIPTS += manageremote
endif
#
# Targets
#
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
TARGETS = $(SBIN_STUFF) $(LIBEXEC_STUFF) $(CTRLSBIN_STUFF)
else
TARGETS = mksyscert
SETUID_SBIN_SCRIPTS = mksyscert
endif
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(SBIN_STUFF) $(LIBEXEC_STUFF)
all: $(TARGETS)
include $(TESTBED_SRCDIR)/GNUmakerules
install: all script-install
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install: boss-install
else
install: clrhouse-install
endif
boss-install: all script-install
@echo "Don't forget to do a post-install as root"
script-install: $(addprefix $(INSTALL_SBINDIR)/, $(SBIN_STUFF)) \
$(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_STUFF))
$(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_STUFF)) \
$(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(CTRLSBIN_STUFF))
post-install:
chmod 775 $(INSTALL_BINDIR)
......@@ -46,8 +89,28 @@ post-install:
chown root $(INSTALL_SBINDIR)/mkusercert
chmod u+s $(INSTALL_SBINDIR)/mkusercert
control-install: $(addprefix $(INSTALL_SBINDIR)/, $(SBIN_STUFF))
control-install:
hook-install: $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(CTRLSBIN_STUFF))
# Clearinghouse install.
clrhouse-install: $(INSTALL_SBINDIR)/mksyscert
# This rule says what web* script depends on which installed binary directory.
$(LIBEXEC_STUFF): $(INSTALL_SBINDIR)
# Just in case the dirs are not yet created,
$(INSTALL_SBINDIR):
# And then how to turn the template into the actual script.
$(LIBEXEC_STUFF): $(TESTBED_SRCDIR)/WEBtemplate.in
@echo "Generating $@"
cat $< | sed -e 's,@PROGTOINVOKE@,$(word 2,$^)/$(subst web,,$@),' > $@
clean:
rm -f *.o core
$(INSTALL_DIR)/opsdir/sbin/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/sbin
$(INSTALL) $< $@
#!/usr/bin/perl -w
#
# Copyright (c) 2010-2022 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
# GENI Public License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Work, and to permit persons to whom the Work
# is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Work.
#
# THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
# IN THE WORK.
#
# }}}
#
use strict;
use English;
use Getopt::Std;
use Data::Dumper;
use Fcntl;
#
# Setup accounts/projects/group stuff on ops/fs. This is installed on
# op/fs and invoked from boss by tbacct and the proj/group scripts.
#
sub usage()
{
print "Usage: accountsetup adduser ...\n";
print " accountsetup deluser ...\n";
print " accountsetup moduser ...\n";
print " accountsetup setgroups ...\n";
print " accountsetup chpass ...\n";
print " accountsetup addproject ...\n";
print " accountsetup addgroup ...\n";
print " accountsetup delproject ...\n";
print " accountsetup delgroup ...\n";
print " accountsetup checkdotfiles ...\n";
print " accountsetup createsshkey ...\n";
print " accountsetup dropfile ...\n";
print " accountsetup deactivateuser ...\n";
print " accountsetup reactivateuser ...\n";
exit(1);
}
my $optlist = "dnf";
my $debug = 0;
my $force = 0;
my $impotent = 0;
# XXX make this a sitevar
my $RENAMEDIRS = 1;
#
# Configure variables
#
my $TB = "@prefix@";
my $USERPATH = "$TB/bin";
my $WITHZFS = @WITHZFS@;
my $ZFS_NOEXPORT = @ZFS_NOEXPORT@;
my $OPSVM_ENABLE = @OPSVM_ENABLE@;
my $OURDOMAIN = "@OURDOMAIN@";
my $ZFS_ROOT = "@ZFS_ROOT@";
my $ZFS_QUOTA_USER = "@ZFS_QUOTA_USER@";
my $ZFS_QUOTA_PROJECT = "@ZFS_QUOTA_PROJECT@";
my $ZFS_QUOTA_GROUP = "@ZFS_QUOTA_GROUP@";
my $ZFS_QUOTA_USER_X = "@ZFS_QUOTA_USER_X@";
my $ZFS_QUOTA_PROJECT_X = "@ZFS_QUOTA_PROJECT_X@";
my $ZFS_QUOTA_GROUP_X = "@ZFS_QUOTA_GROUP_X@";
my $PW = "/usr/sbin/pw";
my $USERADD = "/usr/sbin/pw useradd";
my $USERDEL = "/usr/sbin/pw userdel";
my $USERMOD = "/usr/sbin/pw usermod";
my $GROUPADD = "/usr/sbin/pw groupadd";
my $GROUPDEL = "/usr/sbin/pw groupdel";
my $CHPASS = "/usr/bin/chpass";
my $CHOWN = "/usr/sbin/chown";
my $CHMOD = "/bin/chmod";
my $MKDIR = "/bin/mkdir";
my $CHFLAGS = "/bin/chflags";
my $NOLOGIN = "/sbin/nologin";
my $MV = "/bin/mv";
my $ZFS = "/sbin/zfs";
my $KEYGEN = "/usr/bin/ssh-keygen";
my $SKEL = "/usr/share/skel";
my $PIDFILE = "/var/run/mountd.pid";
my $TSFILE = "/var/run/mountd.ts";
my $DISABLEFLAGS = @DISABLE_FSNODE_CHFLAGS@;
my $USEFLAGS = 0;
# XXX
my $NOSUCHUSER = 67;
my $USEREXISTS = 65;
# We use flags to prevent deletion of certain dirs, on FreeBSD 10 or greater.
# Note that when OPSVM_ENABLE=1, the file systems are actually back over
# on boss, so cannot do the chflags here. Hmm.
if (!$OPSVM_ENABLE) {
if (`uname -r` =~ /^(\d+)\.(\d+)/) {
if ($1 >= 10) {
$USEFLAGS = 1 unless ($DISABLEFLAGS);
}
}
}
#
# Testbed Support libraries
#
use lib "@prefix@/lib";
use libtestbed;
# Generic (mounted) names for filesystems
my $USERROOT = USERROOT();
my $PROJROOT = PROJROOT();
my $GROUPROOT = GROUPROOT();
my $SCRATCHROOT = SCRATCHROOT();
# XXX we need the real fs mountpoints too
my $FSUSERROOT = "@FSDIR_USERS@";
my $FSPROJROOT = "@FSDIR_PROJ@";
my $FSGROUPROOT = "@FSDIR_GROUPS@";
my $FSSCRATCHROOT = "@FSDIR_SCRATCH@";
# These are duplicated in db/Project.pm.in ...
# Project subdir list
my @DIRLIST = ("exp", "images", "logs", "deltas", "tarfiles", "rpms",
"groups", "tiplogs", "images/sigs", "templates");
# Groups subdir list
my @GDIRLIST = ("exp", "images", "logs", "tarfiles", "rpms", "tiplogs");
#
# Function prototypes
#
sub AddUser();
sub DeleteUser();
sub SetGroups();
sub ModifyUser();
sub ChangePassword();
sub AddProject();
sub AddGroup();
sub DelProject();
sub DelGroup();
sub DropFile();
sub CheckDotFiles();
sub CreateSSHKey();
sub ReactivateUser();
sub DeactivateUser();
sub fatal($);
sub SetDotGroup($$);
sub ZFSexists($);
sub MakeDir($$);
sub WhackDir($$);
sub mysystem($);
sub runBusyLoop($);
sub SetNoDelete($);
sub ClearNoDelete($);
#
# Check args.
#
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"f"})) {
$force = 1;
}
if (defined($options{"n"})) {
$impotent = 1;
}
usage()
if (@ARGV < 1);
my $cmd = shift(@ARGV);
#
# Now dispatch operation.
#
SWITCH: for ($cmd) {
/^adduser$/ && do {
AddUser();
last SWITCH;
};
/^deluser$/ && do {
DeleteUser();
last SWITCH;
};
/^moduser$/ && do {
ModifyUser();
last SWITCH;
};
/^setgroups$/ && do {
SetGroups();
last SWITCH;
};
/^chpass$/ && do {
ChangePassword();
last SWITCH;
};
/^addproject$/ && do {
AddProject();
last SWITCH;
};
/^addgroup$/ && do {
AddGroup();
last SWITCH;
};
/^delproject$/ && do {
DelProject();
last SWITCH;
};
/^delgroup$/ && do {
DelGroup();
last SWITCH;
};
/^dropfile$/ && do {
DropFile();
last SWITCH;
};
/^checkdotfiles$/ && do {
CheckDotFiles();
last SWITCH;
};
/^createsshkey$/ && do {
CreateSSHKey();
last SWITCH;
};
/^deactivateuser$/ && do {
DeactivateUser();
last SWITCH;
};
/^reactivateuser$/ && do {
ReactivateUser();
last SWITCH;
};
# Default
usage();
}
exit(0);
#
# Usage: adduser username unix_uid full_name homedir unix_gid shell [ phash ]
#
sub AddUser()
{
if (@ARGV < 6) {
fatal("adduser: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $uid = shift(@ARGV);
my $name = shift(@ARGV);
my $hdir = shift(@ARGV);
my $gid = shift(@ARGV);
my $shell = shift(@ARGV);
if (! -d "$hdir") {
# XXX we only handle homedirs of the form /users/$user here...
if ($hdir ne "$USERROOT/$user" || MakeDir($USERROOT, $user)) {
fatal("Could not create $user homedir $hdir");
}
}
if (mysystem("egrep -q -s '^${user}:' /etc/passwd") &&
runBusyLoop("$USERADD $user -u $uid -c \"$name\" ".
"-k $SKEL -h - -d $hdir -g $gid -s $shell")) {
if (($? >> 8) != $USEREXISTS) {
fatal("$USERADD: could not add account");
}
}
#
# Since we do not populate the new homedir with the useradd call,
# we need to copy the skeleton files over.
#
if (! -e "$hdir/.cshrc") {
opendir(DIR, "$SKEL") or
fatal("Unable to open skeleton directory");
while (my $file = readdir(DIR)) {
if ($file =~ /^dot(.*)$/) {
mysystem("/bin/cp -fp $SKEL/$file $hdir/$1") == 0
or fatal("Could not copy $SKEL/$file to $hdir/$1");
}
}
#
# And set the owner and group right on everything
#
mysystem("/usr/sbin/chown -R $user:$gid $hdir") == 0
or fatal("Could not chown $hdir");
}
#
# Some directories we need, with proper owner/group/mode
#
foreach my $dir (".ssl", ".ssh") {
if (! -e "$hdir/$dir" &&
!mkdir("$hdir/$dir", 0700)) {
fatal("Could not make directory '$hdir/$dir': $!");
}
mysystem("$CHOWN -R $user:$gid $hdir/$dir") == 0
or fatal("Could not chown $hdir/$dir to $user:$gid");
chmod(0700, "$hdir/$dir")
or fatal("Could not chmod '$hdir/$dir' to 0700: $!");
}
return 0;
}
#
# Usage: deluser username homedir
#
sub DeleteUser()
{
if (@ARGV != 2) {
fatal("deluser: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $hdir = shift(@ARGV);
#
# Note that this does NOT remove the user's homedir.
# We remove/rename it below...
#
if (runBusyLoop("$USERDEL $user")) {
if (($? >> 8) != $NOSUCHUSER) {
fatal("Could not remove user $user");
}
}
# XXX we only handle homedirs of the form /users/$user here...
if ($hdir ne "$USERROOT/$user" ||
(-e $hdir && WhackDir($USERROOT, $user))) {
fatal("Could not destroy $user homedir $hdir");
}
return 0;
}
#
# Usage: moduser username shell full_name
#
sub ModifyUser()
{
if (@ARGV != 3) {
fatal("moduser: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $shell = shift(@ARGV);
my $name = shift(@ARGV);
if (runBusyLoop("$USERMOD $user -c \"$name\" -s $shell")) {
fatal("$USERMOD: could not modify account");
}
return 0;
}
#
# Usage: username group1 [ group2 ... groupN ]
# XXX this is specific to what is required by setgroups.
#
sub SetGroups()
{
if (@ARGV < 2) {
fatal("setgroups: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $pgroup = shift(@ARGV);
my $grouplist = "''";
if (@ARGV > 0) {
$grouplist = "-G '" . join(',', @ARGV) . "'";
}
if (runBusyLoop("$USERMOD $user -g $pgroup $grouplist")) {
fatal("Could not modify user $user to add groups!\n");
}
SetDotGroup($user, $pgroup);
return 0;
}
sub ChangePassword()
{
if (@ARGV != 2) {
fatal("chpass: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $hash = shift(@ARGV);
if (runBusyLoop("$CHPASS -p '$hash' $user")) {
fatal("Could not change password");
}
return 0;
}
#
# Usage: deactivate username
#
sub DeactivateUser()
{
if (@ARGV != 1) {
fatal("deactivateuser: Wrong number of arguments");
}
my $user = shift(@ARGV);
if ($WITHZFS) {
my $zfsdir = $ZFS_ROOT . USERROOT() . "/$user";
if (ZFSexists($zfsdir) &&
mysystem("$ZFS set mountpoint=none $zfsdir")) {
fatal("Could not set ZFS dir $zfsdir to mountpoint=none");
}
}
if (runBusyLoop("$USERMOD $user -d /var/empty -s $NOLOGIN")) {
fatal("Could not set shell to $NOLOGIN");
}
return 0;
}
#
# Usage: reactivate username
#
# The shell is changed via ModifyUser (we do not know the correct
# shell here), this is just for ZFS.
#
sub ReactivateUser()
{
if (@ARGV != 1) {
fatal("reactivateuser: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $hdir = USERROOT() . "/$user";
if ($WITHZFS) {
my $zfsdir = $ZFS_ROOT . USERROOT() . "/$user";
if (ZFSexists($zfsdir) &&
mysystem("$ZFS set mountpoint=$hdir $zfsdir")) {
fatal("Could not set ZFS dir $zfsdir to mountpoint=$hdir");
}
}
if (runBusyLoop("$USERMOD $user -d $hdir")) {
fatal("Could not set home directory back to $hdir");
}
#
# Make dot files are in the right group, since while the user was
# inactive, we skipped doing that cause the home dir was unmounted
# (ZFS). Need the current default group for that.
#
my (undef,undef,undef,$gid) = getpwnam($user);
if (!defined($gid)) {
fatal("Could not get gid for $user");
}
SetDotGroup($user,$gid);
return 0;
}
#
# Usage: addproject projname unix_gname unix_gid unix_uid
#
sub AddProject()
{
if (@ARGV != 4) {
fatal("addproject: Wrong number of arguments");
}
my $name = shift(@ARGV);
my $unix_name = shift(@ARGV);
my $unix_gid = shift(@ARGV);
my $unix_uid = shift(@ARGV);
# Create the project unix group
if (system("egrep -q -s '^${unix_name}:' /etc/group")) {
print "Adding group $unix_name ...\n";
if (runBusyLoop("$GROUPADD $unix_name -g $unix_gid")) {
fatal("Could not add group $unix_name ($unix_gid)!\n");
}
}
# Create the /proj directory
my $path = "$PROJROOT/$name";
if (! -d "$path" && MakeDir($PROJROOT, $name)) {
fatal("Could not make directory '$path'");
}
if (! chmod(0770, "$path")) {
fatal("Could not chmod '$path' to 0770: $!");
}
if (! chown($unix_uid, $unix_gid, "$path")) {
fatal("Could not chown '$path' to $unix_uid/$unix_gid: $!");
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
# Create required /proj subdirs
foreach my $dir (@DIRLIST) {
$path = "$PROJROOT/$name/$dir";
if (! -d "$path" && !mkdir("$path", 0770)) {
fatal("Could not make directory '$path': $!");
}
if (! chmod(0770, "$path")) {
fatal("Could not chmod '$path' to 0770: $!");
}
if (! chown($unix_uid, $unix_gid, "$path")) {
fatal("Could not chown '$path' to $unix_uid/$unix_gid: $!");
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
}
# Create the /groups directory
$path = "$GROUPROOT/$name";
if (! -d "$path" && MakeDir($GROUPROOT, $name)) {
fatal("Could not make directory '$path'");
}
if (! chmod(0770, "$path")) {
fatal("Could not chmod '$path' to 0770: $!");
}
if (! chown($unix_uid, $unix_gid, "$path")) {
fatal("Could not chown '$path' to $unix_uid/$unix_gid: $!");
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
# Create a symlink for the default group
$path = "$GROUPROOT/$name/$name";
if (! -e "$path") {
if (mysystem("ln -s $PROJROOT/$name $path")) {
fatal("Could not symlink $PROJROOT/$name to $path");
}
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
# Finally, create /scratch dir if supported
if ($SCRATCHROOT) {
$path = "$SCRATCHROOT/$name";
if (! -d "$path" && MakeDir($SCRATCHROOT, $name)) {
fatal("Could not make directory '$path'");
}
if (! chmod(0770, "$path")) {
fatal("Could not chmod '$path' to 0770: $!");
}
if (! chown($unix_uid, $unix_gid, "$path")) {
fatal("Could not chown '$path' to $unix_uid/$unix_gid: $!");
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
}
return 0;
}
#
# Usage: addgroup groupname unix_gname unix_gid unix_uid projname
#
sub AddGroup()
{
if (@ARGV != 5) {
fatal("addgroup: Wrong number of arguments");
}
my $name = shift(@ARGV);
my $unix_name = shift(@ARGV);
my $unix_gid = shift(@ARGV);
my $unix_uid = shift(@ARGV);
my $projname = shift(@ARGV);
# Create the group unix group
if (system("egrep -q -s '^${unix_name}:' /etc/group")) {
print "Adding group $unix_name ...\n";
if (runBusyLoop("$GROUPADD $unix_name -g $unix_gid")) {
fatal("Could not add group $unix_name ($unix_gid)!\n");
}
}
# Create the /groups/gid directory
my $path = "$GROUPROOT/$projname/$name";
# XXX note that this is always a regular directory, not a filesystem
if (! -d "$path" && !mkdir("$path", 0770)) {
fatal("Could not make directory '$path': $!");
}
if (! chmod(0770, "$path")) {
fatal("Could not chmod '$path' to 0770: $!");
}
if (! chown($unix_uid, $unix_gid, "$path")) {
fatal("Could not chown '$path' to $unix_uid/$unix_gid: $!");
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
# Create required /groups/gid subdirs
foreach my $dir (@GDIRLIST) {
$path = "$GROUPROOT/$projname/$name/$dir";
if (! -d "$path" && !mkdir("$path", 0770)) {
fatal("Could not make directory '$path': $!");
}
if (! chmod(0770, "$path")) {
fatal("Could not chmod '$path' to 0770: $!");
}
if (! chown($unix_uid, $unix_gid, "$path")) {
fatal("Could not chown '$path' to $unix_uid/$unix_gid: $!");
}
if (SetNoDelete($path)) {
fatal("Could not set no delete on '$path'!\n");
}
}
return 0;
}
#
# Usage: delproject projname unix_gname
#
sub DelProject()
{
if (@ARGV != 2) {
fatal("delproject: Wrong number of arguments");
}
my $name = shift(@ARGV);
my $unix_name = shift(@ARGV);
if ((-d "$PROJROOT/$name" && WhackDir($PROJROOT, $name)) ||
(-d "$GROUPROOT/$name" && WhackDir($GROUPROOT, $name)) ||
($SCRATCHROOT && -d "$SCRATCHROOT/$name" &&
WhackDir($SCRATCHROOT, $name))) {
fatal("Could not destroy project '$name' related directories");
}
if (mysystem("egrep -q -s '^${unix_name}:' /etc/group") == 0) {
print "Deleting project $unix_name ...\n";
if (runBusyLoop("$GROUPDEL $unix_name")) {
fatal("Could not delete group $unix_name!\n");
}
}
return 0;
}
#
# Usage: delgroup groupname unix_gname projname
#
sub DelGroup()
{
if (@ARGV != 3) {
fatal("delgroup: Wrong number of arguments");
}
my $name = shift(@ARGV);
my $unix_name = shift(@ARGV);
my $projname = shift(@ARGV);
#
# XXX groups are different because they are a subdirectory under
# /groups/<pid>/.
#
if (-d "$GROUPROOT/$projname/$name" &&
WhackDir($GROUPROOT, "$projname/$name")) {
fatal("Could not destroy project group '$name' related directories");
}
if (mysystem("egrep -q -s '^${unix_name}:' /etc/group") == 0) {
print "Deleting group $unix_name ...\n";
if (runBusyLoop("$GROUPDEL $unix_name")) {
fatal("Could not delete group $unix_name!\n");
}
}
return 0;
}
#
# Drop a file into place. The file is piped into STDIN from boss.
#
sub DropFile()
{
if (@ARGV != 5) {
fatal("dropfile: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $gid = shift(@ARGV);
my $mode = shift(@ARGV);
my $dir = shift(@ARGV);
my $fname = shift(@ARGV);
my $file = "$dir/$fname";
# Default the directory creation to 770. Might need to specify this too.
if (! -d "$dir" && mysystem("$MKDIR -m 770 -p $dir")) {
fatal("Could not make directory '$dir'");
}
#
# We want the file to have the proper mode before we try to write it,
# to avoid a race that allows someone to see the contents.
#
if (-e $file && mysystem("$MV -f $file ${file}.save")) {
fatal("Could not rename $file to ${file}.save");
}
sysopen(HANDLE, $file, O_WRONLY|O_CREAT|O_EXCL, 0600)
or fatal("sysopen $file: $!");
while (<STDIN>) {
print HANDLE $_;
}
close(HANDLE);
mysystem("$CHOWN $user:$gid $file") == 0
or fatal("Could not chown $file to $user:$gid");
mysystem("$CHMOD $mode $file") == 0
or fatal("Could not chmod '$file' to $mode");
return 0;
}
#
# Check the dot files.
#
sub CheckDotFiles()
{
if (@ARGV != 3) {
fatal("checkdotfiles: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $gid = shift(@ARGV);
my $email = shift(@ARGV);
my $forward = "$USERROOT/$user/.forward";
my $cshrc = "$USERROOT/$user/.cshrc";
my $profile = "$USERROOT/$user/.profile";
# Just in case we got called before account created.
return 0
if (! -d "$USERROOT/$user");
#
# Set up a .forward file so that any email to them gets forwarded off.
#
print "Setting up .forward file for $user.\n";
sysopen(HANDLE, $forward, O_WRONLY|O_CREAT|O_TRUNC, 0600)
or fatal("sysopen $forward: $!");
print HANDLE "$email\n";
close(HANDLE);
mysystem("$CHOWN $user:$gid $forward") == 0
or fatal("Could not chown $forward to $user:$gid");
mysystem("$CHMOD 644 $forward") == 0
or fatal("Could not chmod '$forward' to 644");
#
# Add testbed path to .cshrc and .profile.
# Plus a conditional Cygwin section for the Windows system path.
#
my $cpathstr = "set path = ($USERPATH \$path)\n" .
'if ( `uname -s` =~ CYGWIN* ) then' . "\n" .
' setenv PATH "${PATH}:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS"' . "\n" .
'endif';
if (-e $cshrc && system("egrep -q -s '$USERPATH' $cshrc")) {
system("echo '$cpathstr' >> $cshrc");
}
my $spathstr = "PATH=$USERPATH:\$PATH\n" .
'if [[ `uname -s` == CYGWIN* ]]; then' . "\n" .
' PATH="$PATH":/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS' . "\n" .
'fi';
if (-e $profile && system("egrep -q -s '$USERPATH' $profile")) {
system("echo '$spathstr' >> $profile");
}
return 0;
}
#
# Create ssh keys for user, sending back the pub part. This is a little
# incovenient since we generate two keys (V1 and V2) but can send back
# just one at a time via STDOUT (do not want to parse anything).
#
sub CreateSSHKey()
{
if (@ARGV != 3) {
fatal("createsshkey: Wrong number of arguments");
}
my $user = shift(@ARGV);
my $gid = shift(@ARGV);
my $type = shift(@ARGV);
my $sshdir = "$USERROOT/$user/.ssh";
my $sshkey = "$sshdir/";
if ($type eq "rsa1") {
$sshkey .= "identity";
}
elsif ($type eq "rsa") {
$sshkey .= "id_rsa";
}
else {
fatal("Bad key type: $type");
}
unlink($sshkey)
if (-e $sshkey);
#
# Since we send the key back via STDOUT, make sure all output
# goes to STDERR.
#
mysystem("$KEYGEN -t $type -P '' -f $sshkey ".
"-C '${type}" . "\@" . ${OURDOMAIN} . "' 1>&2") == 0
or fatal("Failure in ssh-keygen!");
mysystem("$CHOWN $user:$gid $sshkey ${sshkey}.pub") == 0
or fatal("Could not chown $sshkey to $user:$gid");
# Return the key via STDOUT to boss.
my $ident = `cat ${sshkey}.pub`;
print STDOUT $ident;
return 0;
}
#
# Make sure the users dot files and other critical files/dirs
# are in the correct group. I looked at the source code to
# chown, and it does not do anything to files that are already
# set correctly. Thank you chown.
#
sub SetDotGroup($$)
{
my ($user, $gid) = @_;
my @dots = (".login", ".profile", ".cshrc", ".ssl", ".ssh");
my $homedir = USERROOT() . "/$user";
if (! -e $homedir) {
print STDERR "$homedir does not exist, skipping dots chown\n";
return 0;
}
print "Changing dot files group for $user to $gid\n";
mysystem("$CHOWN $user:$gid $homedir") == 0
or fatal("Could not chown home dir to $user:$gid");
foreach my $dot (@dots) {
if (-e "$homedir/$dot") {
mysystem("$CHOWN -R $user:$gid $homedir/$dot") == 0
or fatal("Could not chown $homedir/$dot to $user:$gid");
}
}
}
#
# Check for ZFS existence.
#
sub ZFSexists($)
{
my ($path) = @_;
mysystem("$ZFS list $path >/dev/null 2>&1");
return ($? ? 0 : 1);
}
sub MakeDir($$)
{
my ($fs,$dir) = @_;
my ($cmd,$cmdarg,$path);
# XXX right now we assume that WITHZFS means per-user/proj FSes
if ($WITHZFS) {
$cmd = "$ZFS create";
$path = "${ZFS_ROOT}${fs}/$dir";
# XXX quotas
my ($refquota,$mult);
if ($fs eq $USERROOT) {
$refquota = $ZFS_QUOTA_USER;
$mult = $ZFS_QUOTA_USER_X;
} elsif ($fs eq $PROJROOT) {
$refquota = $ZFS_QUOTA_PROJECT;
$mult = $ZFS_QUOTA_PROJECT_X;
} elsif ($fs eq $GROUPROOT) {
$refquota = $ZFS_QUOTA_GROUP;
$mult = $ZFS_QUOTA_GROUP_X;
}
if (defined($refquota) && $refquota =~ /^(\d+(?:\.\d+)?)([MGT]?)$/) {
my ($num,$unit) = ($1,$2);
$unit = "" if (!defined($unit));
$num = sprintf "%.1f", $num * $mult;
$cmdarg = "-o refquota=$refquota -o quota=$num$unit";
} else {
$cmdarg = "";
}
} else {
$cmd = "mkdir";
$cmdarg = "";
$path = "$fs/$dir";
}
#
# If we are relying on ZFS to HUP mountd (!ZFS_NOEXPORT), then we have to
# give mountd a chance to finish its work before we return. This is because
# it is likely that our caller (on boss) will try to access the directory
# via NFS after we return and if mountd is not done, that will fail.
# If ZFS_NOEXPORT is set, then our caller will do the HUPing and waiting.
#
my $waitforit = 0;
if ($WITHZFS && !$ZFS_NOEXPORT) {
#
# Note that "waiting for mountd" involves a Utah hack to mountd to
# make it record a timestamp in a file when it is done. If there is
# no timestamp file, assume we are not running the hacked mountd and
# don't sleep. If the file exists, remove it and wait for it to
# reappear as a sign mountd is done.
#
# XXX since we cannot guarantee that mountd gets HUP'ed when we
# call zfs (i.e., the command fails or the nfsshare attribute is
# not set correctly) we save the old timestamp and put it back
# on failures. Otherwise, the next call to us or exports_setup will
# not properly wait for mountd.
#
if (-e "$TSFILE" && rename("$TSFILE", "$TSFILE.bak") != 0) {
$waitforit = 1;
}
}
if (mysystem("$cmd $cmdarg $path")) {
my $stat = $?;
if ($waitforit && !rename("$TSFILE.bak", "$TSFILE")) {
print STDERR "accountsetup: could not replace $TSFILE;".
" You must HUP mountd\n";
}
return $stat;
}
if ($waitforit) {
# With potentially thousands of mount points, this can take 15 seconds!
my $wtime = 15;
my $i;
for ($i = 0; $i < $wtime; $i++) {
if (-e "$TSFILE") {
print "accountsetup: mountd done.\n"
if ($i > 0);
last;
}
print "accountsetup: waiting for mountd to finish ($i)...\n";
sleep(1);
}
if ($i == $wtime) {
print STDERR "accountsetup: mountd not finished after $i seconds;".
"Perhaps ZFS sharenfs attribute not set on $path?\n";
if (!rename("$TSFILE.bak", "$TSFILE")) {
print STDERR "accountsetup: could not replace $TSFILE;".
" You must HUP mountd\n";
}
} else {
unlink("$TSFILE.bak");
}
}
# should we be setting permissions or ownership here?
return 0;
}
sub WhackDir($$)
{
my ($fs,$dir) = @_;
my $zfsfs = "";
if (ClearNoDelete("$fs/$dir")) {
fatal("Could not clear no delete on '$fs/$dir'!\n");
}
if ($WITHZFS) {
my $path = "${ZFS_ROOT}${fs}/$dir";
$zfsfs = $path
if (ZFSexists($path));
}
if ($RENAMEDIRS) {
my ($cmd, $path, $npath);
my $suffix = "-D" . time();
if ($zfsfs) {
$cmd = "$ZFS rename";
$path = $zfsfs;
$npath = "${ZFS_ROOT}${fs}/$dir$suffix";
} else {
$cmd = "mv";
$path = "$fs/$dir";
$npath = "$fs/$dir$suffix";
}
if (mysystem("$cmd $path $npath")) {
return $?;
}
# Since we reuse uid/gids let's make the dir root/0700
$path = "$fs/$dir$suffix";
if (!chown(0, 0, $path) || !chmod(0700, $path)) {
print STDERR "WARNING: could not chown/chmod '$path': $!\n";
}
#
# And then unmount, we do not need it around. The empty subdir
# will still be there, so we have some clue ... maybe we should
# drop a file into the empty dir?
#
if ($zfsfs && mysystem("$ZFS set mountpoint=none $npath")) {
print STDERR "Could not set ZFS dir $npath to mountpoint=none\n";
}
}
#
# XXX maybe we should do this in the background since it could
# take a really long time!
#
else {
my ($cmd, $path);
if ($zfsfs) {
$cmd = "$ZFS destroy -f";
$path = $zfsfs;
} else {
$cmd = "rm -rf";
$path = "$fs/$dir";
}
if (mysystem("$cmd $path")) {
return $?;
}
}
return 0;
}
#
# HUP Mountd after changes to ZFS volumes. Not used, Mike says we
# can do "zfs share -a" instead, but I will leave this code here
# for now.
#
sub HUPMountd()
{
if (! -e $PIDFILE) {
fatal("$PIDFILE does not exist. Is mountd running?");
}
my $daemonpid = `cat $PIDFILE`;
chomp($daemonpid);
# untaint
if ($daemonpid =~ /^([-\@\w.]+)$/) {
$daemonpid = $1;
}
if (kill('HUP', $daemonpid) == 0) {
fatal("Could not kill(HUP) process $daemonpid (mountd): $!");
}
# Give mountd time to react.
sleep(1);
}
# XXX temporary while debugging
sub mysystem($)
{
my $cmd = shift;
print STDERR "accountsetup: '$cmd'\n";
if (open(FD, ">>/usr/testbed/log/accountsetup.log")) {
my $tstamp = POSIX::strftime("%b %e %H:%M:%S", localtime());
print FD "$tstamp: $cmd\n";
close(FD);
}
return system($cmd);
}
#
# Run pw/chpass, checking for a locked passwd/group file. The pw routines
# exit with non specific error code 1 for everything, so there is no way
# to tell that its a busy file except by looking at the error message. Then
# wait for a bit and try again. Silly.
#
sub runBusyLoop($)
{
my $command = shift;
my $maxtries = 20;
my $stime = time();
print STDERR "accountsetup: '$command'\n";
if (open(FD, ">>/usr/testbed/log/accountsetup.log")) {
my $tstamp = POSIX::strftime("%b %e %H:%M:%S", localtime($stime));
print FD "$tstamp: $command\n";
close(FD);
}
while ($maxtries--) {
my $output = "";
#
# This open implicitly forks a child, which goes on to execute the
# command. The parent is going to sit in this loop and capture the
# output of the child. We do this so that we have better control
# over the descriptors.
#
my $pid = open(PIPE, "-|");
if (!defined($pid)) {
print STDERR "runBusyLoop; popen failed!\n";
return -1;
}
if ($pid) {
while (<PIPE>) {
$output .= $_;
}
close(PIPE);
print $output;
if (!$?) {
if ($command =~ /^$PW .*/) {
if (open(FD, ">>/usr/testbed/log/accountsetup.log")) {
my $etime = time();
my $tstamp = POSIX::strftime("%b %e %H:%M:%S",
localtime($etime));
$etime -= $stime;
print FD "$tstamp: $PW done in $etime seconds\n";
close(FD);
}
}
return 0
}
if ($output =~ /(group|db) file is busy/m) {
print "runBusyLoop; waiting a few seconds before trying again\n";
sleep(3);
}
}
else {
open(STDERR, ">&STDOUT");
exec($command);
}
}
return -1;
}
sub fatal($) {
my ($msg) = @_;
print STDERR "$msg\n";
exit(-1);
}
#
# Use chflags on certain directories to prevent users from deleting things.
# Just a bandaid on the real problem.
#
sub SetNoDelete($)
{
my ($filename) = @_;
return 0
if (!$USEFLAGS);
system("$CHFLAGS sunlink $filename");
return ($? ? -1 : 0);
}
sub ClearNoDelete($)
{
my ($filename) = @_;
return 0
if (!$USEFLAGS);
# Do a recursive change here since we tend to do deletions on the
# top level directories.
system("$CHFLAGS -R nosunlink $filename");
return ($? ? -1 : 0);
}
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
# Copyright (c) 2000-2020 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use English;
use Getopt::Std;
use XML::Simple;
use File::Temp qw(tempfile :POSIX );
#
# Parse ssh public keys and enter into the DB. The default format is
......@@ -16,18 +35,21 @@ use Getopt::Std;
#
sub usage()
{
print "Usage: addpubkeys [-k | -f] [-n | -u <user>] [<keyfile> | <key>]\n";
print " addpubkeys [-i [-r] | -w] <user>\n";
print "Usage: addpubkeys [-d] [-k | -f] [-n | -u <user>] [<keyfile> | <key>]\n";
print " addpubkeys [-d] -X <xmlfile>\n";
print " addpubkeys [-d] [-i [-r] | -w] <user>\n";
print "Options:\n";
print " -d Turn on debugging\n";
print " -k Indicates that key was passed in on the command line\n";
print " -f Indicates that key was passed in as a filename\n";
print " -n Verify key format only; do not enter into into DB\n";
print " -X Get args from an XML file: verify, user, keyfile.\n";
print " -w Generate new authkeys (protocol 1 and 2) file for user\n";
print " -i Initialize mode; generate initial key for user\n";
print " -r Force a regenerate of initial key for user\n";
exit(-1);
}
my $optlist = "kniwfu:r";
my $optlist = "dkniwfu:rX:sRNC:S:Ia";
my $iskey = 0;
my $verify = 0;
my $initmode = 0;
......@@ -35,6 +57,12 @@ my $force = 0;
my $genmode = 0;
my $nobody = 0;
my $noemail = 0;
my $remove = 0;
my $nodelete = 0;
my $internal = 0;
my $isaptkey = 0;
my $Comment;
my $xmlfile;
#
# Configure variables
......@@ -43,17 +71,27 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $TBAUDIT = "@TBAUDITEMAIL@";
my $OURDOMAIN = "@OURDOMAIN@";
my $CONTROL = "@USERNODE@";
my $KEYGEN = "/usr/bin/ssh-keygen";
my $ACCOUNTPROXY= "$TB/sbin/accountsetup";
my $SSH = "$TB/bin/sshtb";
my $SAVEUID = $UID;
my $USERUID;
# Locals
my $user;
my $this_user;
my $target_user;
my $keyfile;
my $keyline;
my $key;
my $comment;
my $user_name;
my $user_email;
my $user_dbid;
my $user_uid;
my $user_gid;
my $debug = 0;
#
# Testbed Support libraries
......@@ -62,6 +100,10 @@ use lib "@prefix@/lib";
use libaudit;
use libdb;
use libtestbed;
use User;
if (@PROTOGENI_SUPPORT@) {
require APT_Utility;
}
#
# Function prototypes
......@@ -69,10 +111,23 @@ use libtestbed;
sub ParseKey($);
sub InitUser();
sub GenerateKeyFile();
sub ParseXmlArgs($$$$$$);
sub fatal($);
my $HOMEDIR = USERROOT();
#
# These are the fields that we allow to come in from the XMLfile.
#
my $SLOT_OPTIONAL = 0x1; # The field is not required.
my $SLOT_REQUIRED = 0x2; # The field is required and must be non-null.
my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
my %xmlfields =
# XML Field Name DB slot name Flags Default
("verify" => ["verify", $SLOT_OPTIONAL, 0],
"user" => ["user", $SLOT_OPTIONAL],
"keyfile" => ["keyfile", $SLOT_REQUIRED]);
#
# Turn off line buffering on output
#
......@@ -108,6 +163,12 @@ if ($UID == 0) {
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"a"})) {
$isaptkey = 1;
}
if (defined($options{"k"})) {
$iskey = 1;
}
......@@ -120,15 +181,51 @@ if (defined($options{"n"})) {
if (defined($options{"i"})) {
$initmode = 1;
}
if (defined($options{"N"})) {
$nodelete = 1;
}
if (defined($options{"I"})) {
$internal = 1;
}
if (defined($options{"r"})) {
$force = 1;
}
if (defined($options{"R"})) {
$remove = 1;
}
if (defined($options{"s"})) {
$noemail = 1;
}
if (defined($options{"w"})) {
$genmode = 1;
}
if (defined($options{"u"})) {
$user = $options{"u"};
}
if (defined($options{"C"})) {
$Comment = $options{"C"};
}
if (defined($options{"X"})) {
$xmlfile = $options{"X"};
my %xmlargs = ();
my %errors = ();
ParseXmlArgs($xmlfile, "user_pubkeys", \%xmlfields, $debug,
\%xmlargs, \%errors);
if (keys(%errors)) {
foreach my $key (keys(%errors)) {
my $val = $errors{$key};
print "${key}: $val\n";
}
fatal("XML arg error");
}
$verify = $xmlargs{"verify"};
$user = $xmlargs{"user"}
if (exists($xmlargs{"user"}));
$ARGV[0] = $xmlargs{"keyfile"};
}
if ($verify && $genmode) {
usage();
}
......@@ -151,39 +248,70 @@ else {
# Untaint the arguments.
#
if (defined($user)) {
if ($user =~ /^([-\w_]+)$/i) {
if ($user =~ /^([-\w]+)$/i) {
$user = $1;
}
else {
fatal("Tainted username: $user");
}
# Map user to object.
$target_user = User->Lookup($user);
if (! defined($target_user)) {
fatal("$user does not exist!")
}
$user_name = $target_user->name();
$user_email = $target_user->email();
$user_dbid = $target_user->dbid();
$user_uid = $target_user->uid();
$USERUID = $target_user->unix_uid();
my $firstproject;
if ($target_user->FirstApprovedProject(\$firstproject) < 0) {
fatal("Could not determine first approved project");
}
if (defined($firstproject)) {
$user_gid = $firstproject->unix_gid();
}
else {
$user_gid = "guest";
}
}
#
# If invoked as "nobody" its for a user with no actual account.
# If invoked as "nobody" we came from the web interface. We have to have
# a credential in the environment, unless its just a key verification
# operation, which anyone can do.
#
if (getpwuid($UID) eq "nobody") {
if ($initmode || $genmode) {
fatal("Bad usage as 'nobody'");
$this_user = User->ImpliedUser();
if (($initmode || $genmode || !$verify) && !defined($this_user)) {
fatal("Bad usage from web interface");
}
$nobody = 1;
}
else {
$USERUID = getpwnam($user);
# From the command line; map invoking user to object.
$this_user = User->ThisUser();
if (! defined($this_user)) {
fatal("You ($UID) do not exist!");
}
}
#
# Initmode or genmode, do it and exit.
#
if ($initmode) {
# Drop root privs, switch to target user.
$EUID = $USERUID;
exit InitUser();
}
if ($genmode) {
# Drop root privs, switch to target user.
$EUID = $USERUID;
exit GenerateKeyFile();
if ($initmode || $genmode) {
if ($initmode) {
exit(InitUser());
}
if ($genmode) {
exit(GenerateKeyFile());
}
exit(1);
}
# Else, key parse mode ...
......@@ -206,41 +334,40 @@ else {
if (! -e $keyfile) {
fatal("No such file: $keyfile\n");
}
$keyline = `head -1 $keyfile`;
open(KEY, "$keyfile")
or fatal("Could not open $keyfile to read");
#
# Ick, look at first line to see if it looks like an openssh key,
# and if so we want to remove the embedded newlines.
#
$keyline = <KEY>;
my $chompit = 0;
if ($keyline =~ /^ssh/ || $keyline =~ /^\d+\s+\d+/) {
$chompit = 1;
}
while (<KEY>) {
chomp($_) if ($chompit);
$keyline .= $_;
}
close(KEY);
}
#
# Check user
#
if (!$verify) {
# If its the user himself, then we can generate a new authkeys file.
if (!$nobody && getpwuid($UID) ne "$user" && !TBAdmin($UID)) {
fatal("You are not allowed to set pubkeys for $user.\n");
}
if (-d "$HOMEDIR/$user/.ssh") {
# If its the user himself, then we can generate a new authkeys file.
# Assume nodelete option comes from internal script, so do not worry.
if (!$target_user->SameUser($this_user) && !$this_user->IsAdmin() &&
!$nodelete) {
fatal("You are not allowed to set pubkeys for $target_user\n");
}
if ($target_user->SameUser($this_user) && $this_user->active()) {
# Drop root privs, switch to target user.
$EUID = $UID = $USERUID;
$genmode = 1;
}
#
# This script is audited when not in verify mode. Since all keys are first
# checked with verify mode, this should not cause any extra email from bad
# keys.
#
AuditStart(0);
if (! UserDBInfo($user, \$user_name, \$user_email)) {
if ($nobody) {
$noemail = 1;
}
else {
fatal("No DB info for $user!");
}
}
}
# Drop root privs, switching to user.
if (!$nobody) {
$EUID = $USERUID;
}
#
......@@ -271,6 +398,11 @@ exit 1;
sub ParseKey($) {
my ($keyline) = @_;
# Remove trailing newlines which screws the patterns below.
# First convert dos newlines since many people upload from windoze.
$keyline =~ s/\r/\n/g;
$keyline =~ s/\n//g;
# Enforce a reasonable length on the key.
if (length($keyline) > 4096) {
print "Key is too long!\n";
......@@ -278,7 +410,7 @@ sub ParseKey($) {
return 0;
}
if ($keyline =~ /^(\d*\s\d*\s[0-9a-zA-Z]*) ([-\w\@\.\ ]*)\s*$/) {
if ($keyline =~ /^(\d*\s\d*\s[0-9a-zA-Z]*) ([-\\\w\@\.:\ ]*)\s*$/) {
# Protocol 1
$type = "ssh-rsa1";
$key = $1;
......@@ -290,21 +422,20 @@ sub ParseKey($) {
$key = $1;
}
elsif ($keyline =~
/^(ssh-rsa|ssh-dss) ([-\w\.\@\+\/\=]*) ([-\w\@\.\ ]*)$/) {
/^(ssh-rsa|ssh-ed25519) ([-\w\.\@\+\/\=]*) ([-\\\w\@\.:\ ]*)$/) {
# Protocol 2
$type = $1;
$key = "$1 $2";
$comment = $3;
}
elsif ($keyline =~ /^(ssh-rsa|ssh-dss) ([-\w\.\@\+\/\=]*)$/) {
elsif ($keyline =~ /^(ssh-rsa|ssh-ed25519) ([-\w\.\@\+\/\=:]*)$/) {
# Protocol 2 but no comment field
$type = $1;
$key = "$1 $2";
}
if (!defined($key)) {
print "Key cannot be parsed!\n";
print "Key: $keyline\n";
print STDERR "Key cannot be parsed, we accept rsa and ed25519 only!\n";
return 0;
}
......@@ -318,18 +449,34 @@ sub ParseKey($) {
# Make up a comment field for the DB.
#
if (!defined($comment)) {
$comment = "$type-${user_email}";
$comment = (defined($Comment) ? $Comment : "$type-${user_email}");
}
$key = "$key $comment";
my $safe_key = DBQuoteSpecial($key);
my $safe_comment = DBQuoteSpecial($comment);
DBQueryFatal("replace into user_pubkeys ".
"values ('$user', 0, '$key', now(), '$comment')");
if ($remove) {
DBQueryFatal("delete from user_pubkeys ".
"where uid_idx='$user_dbid' and comment=$safe_comment");
}
# Only one APT key allowed
if ($isaptkey) {
DBQueryFatal("delete from user_pubkeys ".
"where uid_idx='$user_dbid' and isaptkey=1");
}
DBQueryFatal("replace into user_pubkeys set ".
" uid='$user_uid', uid_idx='$user_dbid', ".
" internal='$internal', nodelete='$nodelete', ".
" isaptkey='$isaptkey',idx=NULL, stamp=now(), ".
" pubkey=$safe_key, comment=$safe_comment");
#
# Mark user record as modified so nodes are updated.
#
TBNodeUpdateAccountsByUID($user);
TBNodeUpdateAccountsByUID($user_uid);
if (@PROTOGENI_SUPPORT@) {
APT_Utility::UpdateInstancesByUser($target_user);
}
my $chunked = "";
while (length($key)) {
......@@ -348,11 +495,11 @@ sub ParseKey($) {
if (! $noemail) {
SENDMAIL("$user_name <$user_email>",
"SSH Public Key for '$user' Added",
"SSH Public Key for '$user' added:\n".
"SSH Public Key for '$user_uid' Added",
"SSH Public Key for '$user_uid' added:\n".
"\n".
"$chunked\n",
"$TBOPS");
"$TBOPS", "Bcc: $TBAUDIT");
}
return 1;
}
......@@ -364,100 +511,47 @@ sub ParseKey($) {
#
sub InitUser()
{
my $sshdir = "$HOMEDIR/$user/.ssh";
#
# Set up the ssh key, but only if not done so already.
# Want to delete existing keys from DB, but not the sslcert key.
#
if (! -e "$sshdir") {
mkdir("$sshdir", 0700) or
fatal("Could not mkdir $sshdir: $!");
}
if (! -e "$sshdir/identity" || $force) {
print "Creating ssh protocol 1 key for $user.\n";
#
# Want to delete existing key from DB.
#
if (-e "$sshdir/identity") {
my $ident = `cat $sshdir/identity.pub`;
if ($ident =~ /(\d*\s\d*\s[0-9a-zA-Z]*)\s([-\w\@\.]*)/) {
DBQueryFatal("delete from user_pubkeys ".
"where uid='$user' and pubkey='$1 $2'");
}
unlink("$sshdir/identity");
}
# Hmm, need to use -C option so comment field makes sense.
DBQueryFatal("delete from user_pubkeys ".
"where uid_idx='$user_dbid' and ".
" (internal=1 or comment like '%\@${OURDOMAIN}' or ".
" comment like '%\@boss.${OURDOMAIN}') and ".
" isaptkey=0 and comment not like 'sslcert:%'");
# Redirect pub key to file, redirect STDERR to STDIN for display.
my $outfile = tmpnam();
my $command = "$ACCOUNTPROXY createsshkey $user_uid $user_gid ";
$UID = 0;
open ERR, "$SSH -host $CONTROL '$command rsa' 2>&1 > $outfile |";
$UID = $SAVEUID;
$errs = "";
while (<ERR>) {
$errs .= $_;
}
close(ERR);
print STDERR $errs;
if ($?) {
unlink($outfile);
fatal("Could not create rsa key");
}
$pubkey = `cat $outfile`;
chomp($pubkey);
$safe_pubkey = DBQuoteSpecial($pubkey);
$comment = "rsa\@${OURDOMAIN}";
if (system("$KEYGEN -t rsa1 -P '' ".
"-C '${user}" . "\@" . ${OURDOMAIN} . "' ".
"-f $sshdir/identity")) {
fatal("Failure in ssh-keygen!");
}
#
# Grab a copy for the DB.
#
my $ident = `cat $sshdir/identity.pub`;
if ($ident =~ /(\d*\s\d*\s[0-9a-zA-Z]*)\s([-\w\@\.]*)/) {
DBQueryFatal("replace into user_pubkeys ".
"values ('$user', 0, '$1 $2', now(), '$2')");
}
else {
fatal("Bad protocol 1 public key: $ident\n");
}
}
#
# Moving to V2 keys ...
#
if (! -e "$sshdir/id_rsa" || $force) {
print "Creating ssh protocol 2 key for $user.\n";
#
# Want to delete existing key from DB.
#
if (-e "$sshdir/id_rsa") {
my $ident = `cat $sshdir/id_rsa.pub`;
if ($ident =~
/^(ssh-rsa [-\w\.\@\+\/\=]*) ([-\w\@\.\ ]*)$/) {
DBQueryFatal("delete from user_pubkeys ".
"where uid='$user' and pubkey='$1 $2'");
}
unlink("$sshdir/id_rsa");
}
# Hmm, need to use -C option so comment field makes sense.
if (system("$KEYGEN -t rsa -P '' ".
"-C '${user}" . "\@" . ${OURDOMAIN} . "' ".
"-f $sshdir/id_rsa")) {
fatal("Failure in ssh-keygen!");
}
#
# Grab a copy for the DB.
#
my $ident = `cat $sshdir/id_rsa.pub`;
if ($ident =~
/^(ssh-rsa [-\w\.\@\+\/\=]*) ([-\w\@\.\ ]*)$/) {
DBQueryFatal("replace into user_pubkeys ".
"values ('$user', 0, '$1 $2', now(), '$2')");
#
# Backwards compat. Remove later.
#
DBQueryFatal("update users set emulab_pubkey='$1 $2' ".
"where uid='$user'");
}
else {
fatal("Bad protocol 2 public key: $ident\n");
}
}
if (! DBQueryWarn("replace into user_pubkeys set ".
" uid='$user_uid', uid_idx='$user_dbid', ".
" internal='1', nodelete='1', idx=NULL, stamp=now(), ".
" pubkey=$safe_pubkey, comment='$comment'")) {
unlink($outfile);
fatal("Could not add rsa key to database");
}
unlink($outfile);
return GenerateKeyFile();
}
......@@ -468,31 +562,25 @@ sub InitUser()
sub GenerateKeyFile()
{
my @pkeys = ();
my $sshdir = "$HOMEDIR/$user/.ssh";
my $keyfile = "$sshdir/authorized_keys";
if (! -e $sshdir) {
if (! mkdir($sshdir, 0700)) {
warn("*** WARNING: Could not mkdir $sshdir: $!\n");
return -1;
}
}
my $outfile = tmpnam();
my $sshdir = "$HOMEDIR/$user_uid/.ssh";
my $query_result =
DBQueryFatal("select pubkey from user_pubkeys where uid='$user'");
DBQueryFatal("select pubkey from user_pubkeys ".
"where uid_idx='$user_dbid'");
while (my ($key) = $query_result->fetchrow_array()) {
push(@pkeys, $key);
}
print "Generating $keyfile ...\n";
if (!open(AUTHKEYS, "> ${keyfile}.new")) {
warn("*** WARNING: Could not open ${keyfile}.new: $!\n");
print "Generating authorized_keys ...\n";
if (!open(AUTHKEYS, "> $outfile")) {
warn("*** WARNING: Could not open $outfile: $!\n");
return -1;
}
print AUTHKEYS "#\n";
print AUTHKEYS "# DO NOT EDIT! This file auto generated by ".
"Emulab.Net account software.\n";
"Emulab account software.\n";
print AUTHKEYS "#\n";
print AUTHKEYS "# Please use the web interface to edit your ".
"public key list.\n";
......@@ -503,29 +591,108 @@ sub GenerateKeyFile()
}
close(AUTHKEYS);
if (!chmod(0600, "${keyfile}.new")) {
warn("*** WARNING: Could not chmod ${keyfile}.new: $!\n");
return -1;
$EUID = $UID = 0;
system("$SSH -host $CONTROL ".
"'$ACCOUNTPROXY dropfile $user_uid $user_gid 0600 $sshdir ".
"authorized_keys' < $outfile");
$EUID = $UID = $SAVEUID;
if ($?) {
unlink($outfile);
fatal("Could not copy authorized_keys file to $CONTROL");
}
if (-e "${keyfile}") {
if (system("cp -p -f ${keyfile} ${keyfile}.old")) {
warn("*** Could not save off ${keyfile}: $!\n");
return -1;
}
if (!chmod(0600, "${keyfile}.old")) {
warn("*** Could not chmod ${keyfile}.old: $!\n");
}
unlink($outfile);
return 0;
}
sub ParseXmlArgs($$$$$$) {
my ($xmlfile, $table_name, $fields_ref, $debug,
$args_ref, $errs_ref) = @_;
#
# Input args:
# $xmlfile - XML file path.
# $table_name - table_regex table_name for low-level checking patterns.
# $fields_ref - xmlfields specification (hash reference.)
# $debug
#
# Output args:
# $args_ref - Parsed argument values (hash reference.)
# $errs_ref - Error messages on failure (hash reference.)
$debug = 0;
#
# Must wrap the parser in eval since it exits on error.
#
my $xmlparse = eval { XMLin($xmlfile,
VarAttr => 'name',
ContentKey => '-content',
SuppressEmpty => undef); };
if ($@) {
$errs_ref->{"XML Parse Error"} = "Return code $@";
return;
}
if (system("mv -f ${keyfile}.new ${keyfile}")) {
warn("*** Could not mv ${keyfile} to ${keyfile}.new: $!\n");
#
# Make sure all the required arguments were provided.
#
my $key;
foreach $key (keys(%{ $fields_ref })) {
my (undef, $required, undef) = @{$fields_ref->{$key}};
$errs_ref->{$key} = "Required value not provided"
if ($required & $SLOT_REQUIRED &&
! exists($xmlparse->{'attribute'}->{"$key"}));
}
elsif (-e "$sshdir/authorized_keys2") {
#
# Save to remove deprecated authorized_keys2 file at this point.
#
unlink("$sshdir/authorized_keys2");
return
if (keys(%{ $errs_ref }));
foreach $key (keys(%{ $xmlparse->{'attribute'} })) {
my $value = $xmlparse->{'attribute'}->{"$key"}->{'value'};
if (!defined($value)) { # Empty string comes from XML as an undef value.
$xmlparse->{'attribute'}->{"$key"}->{'value'} = $value = "";
}
if ($debug) {
print STDERR "User attribute: '$key' -> '$value'\n";
}
$errs_ref->{$key} = "Unknown attribute"
if (!exists($fields_ref->{$key}));
my ($dbslot, $required, $default) = @{$fields_ref->{$key}};
if ($required & $SLOT_REQUIRED) {
# A slot that must be provided, so do not allow a null value.
if (!defined($value)) {
$errs_ref->{$key} = "Must provide a non-null value";
next;
}
}
if ($required & $SLOT_OPTIONAL) {
# Optional slot. If value is null skip it. Might not be the correct
# thing to do all the time?
if (!defined($value)) {
next
if (!defined($default));
$value = $default;
}
}
if ($required & $SLOT_ADMINONLY) {
# Admin implies optional, but thats probably not correct approach.
$errs_ref->{$key} = "Administrators only"
if (! $this_user->IsAdmin());
}
# Now check that the value is legal.
if (! TBcheck_dbslot($value, $table_name, $dbslot,
TBDB_CHECKDBSLOT_ERROR)) {
$errs_ref->{$key} = TBFieldErrorString();
next;
}
$args_ref->{$key} = $value;
}
return 0;
}
sub fatal($) {
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use English;
use Getopt::Std;
......
#!/usr/bin/perl -w
#
# Copyright (c) 2008 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use strict;
use English;
use Getopt::Std;
#
# A hook invoked from boss after a new user is added to ops.
#
sub usage()
{
print "Usage: adduserhook <uid>\n";
exit(-1);
}
my $optlist = "d";
my $debug = 0;
#
# Configure variables
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
#
# Turn off line buffering on output
#
$| = 1;
#
# Untaint the path
#
$ENV{'PATH'} = "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Only real root can run this script.
#
if ($UID != 0) {
die("*** $0:\n".
" Must be root to run this script!\n");
}
#
# Testbed Support libraries
#
use lib "@prefix@/lib";
use libtestbed;
# Protos
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (@ARGV != 1) {
usage();
}
my $user = shift(@ARGV);
#
# Add your code here, but remember you are running as root. Be careful.
#
exit(0);
sub fatal($)
{
my($mesg) = $_[0];
die("*** $0:\n".
" $mesg\n");
}
#!/usr/bin/perl -w
#
# Copyright (c) 2010-2011 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use English;
use strict;
use Getopt::Std;
use CGI;
use Data::Dumper;
#
# Dump a project in XML format suitable for reading into newproj script.
#
sub usage()
{
print("Usage: dumpproject [-d] <pid>\n");
exit(-1);
}
my $optlist = "d";
my $debug = 0;
#
# Configure variables
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
#
# Untaint the path
#
$ENV{'PATH'} = "$TB/bin:$TB/sbin:/bin:/usr/bin:/usr/bin:/usr/sbin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Turn off line buffering on output
#
$| = 1;
#
# Load the Testbed support stuff.
#
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use User;
use Project;
# Protos
sub fatal($);
sub DumpProject($);
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (@ARGV != 1) {
usage();
}
my $pid = $ARGV[0];
# Map invoking user to object.
my $this_user = User->ThisUser();
if (! defined($this_user)) {
fatal("You ($UID) do not exist!");
}
#
# Figure out who called us. Must have admin status to do this.
#
if (!$this_user->IsAdmin()) {
fatal("You must be a TB administrator to run this script!");
}
# Map target user to object.
my $project = Project->Lookup($pid);
if (! defined($project)) {
fatal("$pid does not exist!");
}
DumpProject($project);
exit(0);
#
# Dump the project in XML.
#
sub DumpProject($)
{
my ($project) = @_;
# Array of string values to print.
my %xmlnames = (
"pid" => {"tag" => "name",
"optional" => 0 },
"head_uid" => {"tag" => "leader",
"optional" => 0 },
"description" => {"tag" => "short description",
"optional" => 0 },
"URL" => {"tag" => "URL",
"optional" => 0 },
"funders" => {"tag" => "funders",
"optional" => 0 },
"why" => {"tag" => "long description",
"optional" => 0 },
"public" => {"tag" => "public",
"optional" => 0 },
"num_pcs" => {"tag" => "num_pcs",
"optional" => 0 },
"linked_to_us" => {"tag" => "linkedtous",
"optional" => 0 },
);
print "<project>\n";
foreach my $key (keys(%xmlnames)) {
my $ref = $xmlnames{$key};
my $tag = $ref->{'tag'};
my $optional = $ref->{'optional'};
my $val = $project->$key();
next
if (!defined($val) && $optional);
$val = "None"
if (!defined($val) &&
($key eq "funders" || $key eq "why"));
print " <attribute name=\"$tag\">";
print "<value>" . CGI::escapeHTML($val) . "</value>";
print "</attribute>\n";
}
print "</project>\n";
}
sub fatal($)
{
my ($mesg) = @_;
print STDERR "*** $0:\n".
" $mesg\n";
exit(-1);
}