old-www/LDP/LG/issue19/hallways.html

344 lines
18 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Intranet Hallways Systems Based on Linux Issue 19</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
&quot;Linux Gazette...<I>making Linux just a little more fun!</I>&quot;
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H2>Intranet Hallways Systems Based on Linux</H2>
<H4>By Justin Seiferth,
<a href="mailto:seiferthyahoo.com">seiferth@yahoo.com</a>
</center></H4><P><HR>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.0b5 [en] (Win16; I) [Netscape]">
<p>
<BLOCKQUOTE><EM>
[Update 27-Dec-1999: Author's e-mail address. -Ed.]
</EM></BLOCKQUOTE>
<CENTER><FONT FACE="Arial,Helvetica"><FONT SIZE=+2>Using Linux: An Intranet
Hallways System</FONT></FONT></CENTER>
<FONT FACE="Arial,Helvetica">Like many of you, I like to use Unix, esp.
Linux when ever and where ever it seems to be the best fit for the job.
This means I have to work fast and be creative; making opportunities when
and where ever I can't take them. I had just such an opportunity recently
when I put together a system which allows <A HREF="http://www.disa.mil">my
workplace</A> to publish the common file sharing areas of its Microsoft
Windows NT based desktops. I thought others might be interested in this
system and created a <A HREF="ftp://www.disa.mil/pub/linux_gazette/">distribution</A>
have your own Intranet Hallways system or as the popular press would put
it an "enterprise information warehouse".&nbsp; Don't let on how easy it
is and you'll be able to make a bundle reselling the system.&nbsp; Here's
what you need to do to make it happen:</FONT>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="#Show">Kernel Options</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="#utilities">Support Utilities</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="#pages">HTML pages</A> and <A HREF="#scripts">scripts</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="#Stage">Some Configuration Changes</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="#install">A Quick installation</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="#Applause">Other things</A> you might
do with it</FONT></LI>
<P><FONT FACE="Arial,Helvetica">Once you've retrieved the distribution,
it shouldn't take more than an hour to get things running; let <A HREF="mailto:seiferth@yahoo.com">me</A>
know what you think about the system when you do.</FONT>
<P><B><FONT FACE="Arial,Helvetica"><FONT SIZE=+1>The Opportunity</FONT></FONT></B>
<BR><FONT FACE="Arial,Helvetica">Microsoft's Windows NT suffers from a
file system inherited from its MS-DOS lineage. For those of you who haven't
had the displeasure this means file systems are cryptically named A-Z,
can't automount and the process of manually mounting them is much more
complicated and error prone than the more user friendly tools like <A HREF="http://www.redhat.com">Red
Hat's</A>
fstool. These problems have been worked around somewhat at my agency through
a series of .bat files which mount server drives in standard places so
users can say "Just look at the T: drive" or something similar. This still
left users with problems searching tens of thousands of files spread thousands
of directories located on servers across the world. The Microsoft Windows
NT operators were trying to figure out a way to present an efficient, agency-wide
view of these servers so that users could easily find and retrieve things.
We used Linux to integrate and publish these file sharing areas on our
intranet.</FONT>
<P><B><FONT FACE="Arial,Helvetica"><FONT SIZE=+1>Before the<A NAME="Show"></A>Show</FONT></FONT></B>
<BR><FONT FACE="Arial,Helvetica">Key to the system is the ability of the
Linux kernel (later 2.0 and 2.1 versions) to mount <A HREF="http://www.informatik.hu-berlin.de:80/~loewis/ntfs/">local</A>
NTFS and remote <A HREF="http://samba.anu.edu.au/cifs/docs/smb-history.html">SMB</A>
volumes. There's nothing esoteric about enabling or using this option,
just <A HREF="http://www.disa.mil/.drafts/smbselect.gif">check it off </A>when
you're compiling the kernel. (Don't run away at the thought of compiling
a kernel! Most <A HREF="http://www.xnet.com/~blatura/linux.shtml#src">distributions</A>
include these options in their default kernel so you probably don't have
do anything- just try it out </FONT><TT>smbmount</TT><FONT FACE="Arial,Helvetica">
and see if it works). If any of your network shares are coming from Windows
95 machines, make sure to also select the patch for Windows 95 machines
and long file names. If you are just serving Microsoft Windows NT or Samba
shares, don't use the Windows 95 option as I've found it has a noticeable
impact on the speed of the SMB mount and file operations.</FONT>
<P><FONT FACE="Arial,Helvetica">Once you've got an SMB capable kernel installed
you're almost ready to go. The other critical components are the<A NAME="utilities"></A><A HREF="http://134.76.140.96/linux-lan/">smbfs</A>
utilities, the <A HREF="ftp://ftp.caldera.com/pub/mirrors">wu-ftpd</A>
suite, a <A HREF="http://www.apache.org">web server</A>, a search engine
and a javascript - capable <A HREF="http://home.netscape.com">browser</A>.
Your distribution has probably installed an operational FTP and HTTP server
and most people nowadays have a Netscape browser installed so all you really
need to do is compile the smbfs utilities and setup a search engine. If
most of the documents on your SMB shares are in text or HTML format, there
are a number of search engines that you can choose from- htdig and glimpse
come to mind. If you want to be able to search non-HTML documents then
you might need one of the commercial search engine. We use Netscape's catalog
server for Solaris.</FONT>
<P><FONT FACE="Arial,Helvetica">The system will work without a javascript
browser; it just won't be a easy to use.</FONT> <FONT FACE="Arial,Helvetica">Hit
the links to grab the software tools you need from the list above set it
up. If you run into problems, be sure and check out the linux HOWTOs and
mailing list documentation on the sites offering the software.&nbsp; If
you have RedHat's RPM or Debian's package tools somebody else has probably
already made a binary available; just check your local archive.</FONT>
<P><B><FONT FACE="Arial,Helvetica"><FONT SIZE=+1>Set and<A NAME="Stage"></A>Stage</FONT></FONT></B>
<BR><FONT FACE="Arial,Helvetica">I'm assuming you've tested your kernel
to make sure you can indeed mount SMB shares and that your ftp server is
up and alive. Before we can start serving your "enterprise information
warehouse" there are a few files which need to be added to or modified
on your system in addition to the <A HREF="http://www.w3.org">HTML</A>
files we'll discuss later. The first addition is a new init.d file for
automatically mounting SMB shares when you boot your system. Then we'll
enable a few features of your FTP server.</FONT>
<P><FONT FACE="Arial,Helvetica">First, let's contend with mounting shares
automatically. I do this with a standard run-level 3/5 initscript; here's
an excerpt with the most critical lines:</FONT>
<BR>
<HR SIZE=1 WIDTH="100%">
<BR><B><TT># Check that networking is up.</TT></B>
<BR><B><TT>[ ${NETWORKING} = "no" ] exit 0</TT></B>
<P><B><TT># See how we were called.</TT></B>
<BR><B><TT>case "$1" in</TT></B>
<BR><B><TT>start)</TT></B>
<BR><B><TT>echo -n "Mounting SMB shares..."</TT></B>
<BR><B><TT>echo "Mounting share1"</TT></B>
<BR><B><TT>/usr/sbin/smbmount //hostname/share /home/ftp/mountpoint -n
-uftp -gftp -f755 -Ihostnames_IP_address</TT></B>
<BR><B><TT># mount your other shares</TT></B>
<BR><B><TT>echo ""</TT></B>
<BR><B><TT>;;</TT></B>
<BR><B><TT>stop)</TT></B>
<BR><B><TT>echo -n "Umounting SMB shares..."</TT></B>
<BR><B><TT>/usr/sbin/umount /home/ftp/mountpoint</TT></B>
<BR><B><TT>#insert other mount comments here ....</TT></B>
<BR><B><TT>echo ""</TT></B>
<BR><B><TT>;;</TT></B>
<BR><B><TT>*)</TT></B>
<BR><B><TT>echo "Usage: hallways {start|stop}"</TT></B>
<BR><B><TT>exit 1</TT></B>
<BR><B><TT>esac</TT></B>
<BR>
<HR SIZE=1 WIDTH="100%">
<BR><FONT FACE="Arial,Helvetica">The </FONT><TT>smbmount(8)</TT><FONT FACE="Arial,Helvetica">
and </FONT><TT>umount(8)</TT><FONT FACE="Arial,Helvetica"> man pages have
more details on what all those flags are about. Basically, we are mounting
the shares into a directory accessible via anonymous FTP. The permissions
and groups are "fake" in the sense that they don't map to anything sensible
in the NT file system; they are only for the convenience and protection
of the Unix system. Our common shares are read/write for everyone; if your
site is more cautious you may want to review the implications of the file
permissions and ownership or perhaps impose access controls using your
file system and web server's security mechanisms.</FONT>
<P><FONT FACE="Arial,Helvetica">Now, let's take a look at the scripts used
to startup your FTP server. You have to make sure you're taking advantage
of wu-ftpd's </FONT><TT>ftpaccess(5)</TT><FONT FACE="Arial,Helvetica">
configuration capabilities. If you start your FTP daemon using the </FONT><TT>-a</TT><FONT FACE="Arial,Helvetica">
option the </FONT><TT>/etc/ftpaccess</TT><FONT FACE="Arial,Helvetica">
file will allow you to customize many aspects of the FTP server's performance
and capabilities. Normally, you enable the -a option of your FTP server
in your </FONT><TT>/etc/inetd.conf</TT> <FONT FACE="Arial,Helvetica">file;
some people run their FTP full time, in this case check out the startup
files in your </FONT><TT>/etc/rc.d/rc3.d</TT><FONT FACE="Arial,Helvetica">
or </FONT><TT>rc5.d</TT><FONT FACE="Arial,Helvetica"> directory and add
the option when the daemon is started up. Among the benefits of using </FONT><TT>ftpaccess</TT><FONT FACE="Arial,Helvetica">
is the ability to specify header and trailer messages in the directory
listings generated by your FTP server. These directives, </FONT><TT>message
</TT><FONT FACE="Arial,Helvetica">and </FONT><TT>readme </TT><FONT FACE="Arial,Helvetica">are
key to our system's capabilities.</FONT>
<P><A NAME="pages"></A><FONT FACE="Arial,Helvetica">We created an HTML
file within the directory structure accessible to the FTP daemon; in our
case it is called 'welcome.html', this file is placed in the root directory
of the FTP daemon's file area and the entry in </FONT><TT>ftpaccess </TT><FONT FACE="Arial,Helvetica">looks
like:</FONT>
<BR><B><TT>...</TT></B>
<BR><B><TT>message /welcome.html login</TT></B>
<BR><B><TT>...</TT></B>
<BR><FONT FACE="Arial,Helvetica">Now the contents of </FONT><TT>welcome.html</TT><FONT FACE="Arial,Helvetica">
will be displayed at the beginning of directory listings. The contents
of </FONT><TT>welcome.html</TT><FONT FACE="Arial,Helvetica"> are a little
tricky if you're not familiar with javascript. They are designed to both
dynamically tailor the HTML based on the position of the page within a
browser.&nbsp; These dynamic web pages tailor the help message to the context
of the display.</FONT>
<BR>
<HR SIZE=1 WIDTH="100%">
<BR><B><TT>&lt;HTML></TT></B>
<BR><B><TT>&lt;HEAD></TT></B>
<BR><B><TT>&lt;SCRIPT LANGUAGE="JavaScript"></TT></B>
<P><A NAME="scripts"></A><B><TT>function OpenNewWindow()</TT></B>
<BR><B><TT>{</TT></B>
<BR><B><TT>alert("To Upload a file go to file...Upload File on the browser's
button bar")</TT></B>
<BR><B><TT>parent.frames[2].location.protocol = "ftp:"</TT></B>
<BR><B><TT>window.open(parent.frames[2].location.href)</TT></B>
<BR><B><TT>}</TT></B>
<P><B><TT>&lt;/SCRIPT></TT></B>
<BR><B><TT>&lt;/HEAD</TT></B>
<BR><B><TT>&lt;BODY bgcolor="#FFFFFF"></TT></B>
<BR><B><TT>&lt;FORM></TT></B>
<BR><B><TT>&lt;SCRIPT LANGUAGE="JavaScript"></TT></B>
<BR><B><TT>if (self!=top) {</TT></B>
<BR><B><TT>document.write('&lt;i>&lt;B>Hi!&lt;/b>&lt;/i>' + "You can preview,
download files or search for information here.&lt;p>You can also upload
a file&lt;br>" + '&lt;FORM>' +</TT></B>
<BR><B><TT>'&lt;CENTER>' + '&lt;INPUT TYPE="button" Value="Upload File"
onClick="OpenNewWindow()</TT></B>
<BR><B><TT>">' + '&lt;/CENTER>' + '&lt;/FORM>');</TT></B>
<BR><B><TT>}</TT></B>
<BR><B><TT>else</TT></B>
<BR><B><TT>{</TT></B>
<BR><B><TT>document.write('&lt;i>&lt;B>Hi!&lt;/b>&lt;/i> This is a special
screen for adding information to hallways.&lt;p> To Upload a file, go to
FILE | Upload, like &lt;a href="http://webserver/access_directory/<A HREF="http://www.disa.mil/.drafts/file_upload.gif">file_upload.gif</A>"></TT></B>
<BR><B><TT>this&lt;/a></TT></B>
<BR><B><TT>&lt;p>');</TT></B>
<BR><B><TT>}</TT></B>
<BR><B><TT>&lt;/SCRIPT></TT></B>
<BR><B><TT>&lt;/FORM></TT></B>
<BR><B><TT>&lt;/BODY></TT></B>
<BR><B><TT>&lt;/HTML></TT></B>
<BR>
<HR SIZE=1 WIDTH="100%">
<P><FONT FACE="Arial,Helvetica">This interface is not the first one we
tried. I really wanted to make the system intuitive; then we'd have to
spend less time answering questions and could spend more time working on
new ideas. The tests we conducted showed most people knew how to download
files but were not aware you could upload files or view the contents of
non-HTML files. We tried HTTP uploads and downloads but settled on the
combination of FTP and HTTP generated screens. We needed a design which
allowed easy navigation around a complicated system and kept at least minimal
help hints in front of the users all the time. The final HTTP based frame
design allowed us to put together an attractive interface. Encapsulating
the FTP file display simplified uploads and downloads. Unlike a web server,
our FTP server labels all files as a single MIME type allowing us to use
a single helper application to easily display all files.; Getting this
preview function to work will require editing the association of mine types
with an application on the user's computer. We use a universal viewer,
you can use one of these if your network already has one installed or you
might investigate one of the many plug-ins which allow viewing files within
the browser itself.</FONT>
<P><B><TT><FONT FACE="Arial,Helvetica"><FONT SIZE=+1>The&nbsp;<A NAME="Curtain"></A>Curtain
Rises</FONT></FONT></TT></B>
<BR><FONT FACE="Arial,Helvetica">&nbsp;<A NAME="install"></A>Now the majority
of the work and trickery is done; all that remains is a frame based <A HREF="http://www.disa.mil/.drafts/interface.gif">user
interface</A>, a few snazzy graphics and some help files. In a nutshell,
if the FTP listing is contained within a frame then the if part of the
conditional is presented. This HTML allows the user to press an "upload"
button which will pop open another browser instance with the FTP directory
within the root window. When </FONT><TT>welcome.html</TT><FONT FACE="Arial,Helvetica">
is displayed within this root window, it contains instructions on how to
upload a file using the FTP capabilities of the browser.</FONT> <FONT FACE="Arial,Helvetica">The
best way to understand how the code works is of course to just load it
up and experiment.</FONT>
<P><FONT FACE="Arial,Helvetica">This isn't a tutorial on HTML so I'll just
let you know you can download this whole package (minus a few of the graphics
we used in our user interface) from ftp://www.disa.mil/pub/linux_gazette_stuff.tgz.
We can't redistribute some of the graphics we use but you can just draw
up your own and stick them into HTML code.</FONT>
<P><FONT FACE="Arial,Helvetica">During your review of the code you may
notice that our frame definition document distributes this system across
several machines; for us this is an important feature. We make use of local
proxy servers for FTP and HTTP traffic. These proxy servers keep down the
loading of our backbone. Our system is distributed such that the web server
documents and graphics will be served from a local departmental web server
while the FTP server distributes information from another, centralized
location. Since the proxy and web are local to our subnet documents stored
on the SMB hallways area are served from the proxy (cache)- speeding up
the file transfer times dramatically and reducing our wide area network
traffic. We are also using the Solaris version of the Netscape Catalog
Server to allow users to expediently find any document or content within
a wide variety of popular Unix, MacIntosh and Windows application formats.
This feature provides some much needed help to users who must retrieve
one of several hundred thousand documents stored on servers spread across
the globe; it was absolutely infeasible using the Microsoft Windows NT
file manager search feature previously recommended by the Microsoft Windows
NT operators</FONT>
<P><A NAME="Applause"></A><B><TT><FONT FACE="Arial,Helvetica"><FONT SIZE=+1>Applause
and Royalties</FONT></FONT></TT></B>
<BR><FONT FACE="Arial,Helvetica">You can provide many other enhancements
such as browser access to multiple file system types (NFS, Appleshare,
SMB, AFS, etc) and internet/intranet FTP areas are easily added. We are
also working on a management add-on using PHP/FI and Postgress to present
users with a fully graphical file upload facility which will also store
meta data on documents such as the originator of the information, the originators
e-mail address, etc. In fact I think with a little more work this system
is a pretty good replacement for some the proprietary commercial document
management applications that cost tens of thousands of dollars.</FONT><FONT FACE="Arial,Helvetica"></FONT>
<P><FONT FACE="Arial,Helvetica">I hope these ideas and this system will
help you and your workplace out. If you have other creative examples of
simple systems that help bring people working around the world together,
<A HREF="mailto:seiferth@yahoo.com">I'd</A> like to here about them. Thanks
for listening...</FONT>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1997, Justin Seiferth<BR>
Published in Issue 19 of the Linux Gazette, July 1997</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./gm.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./ai.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->