Automating System Administration with Perl: Tools to Make You More Efficient
David N. Blank-Edelman
Language: English
Pages: 670
ISBN: 059600639X
Format: PDF / Kindle (mobi) / ePub
- Manage user accounts
- Monitor filesystems and processes
- Work with configuration files in important formats such as XML and YAML
- Administer databases, including MySQL, MS-SQL, and Oracle with DBI
- Work with directory services like LDAP and Active Directory
- Script email protocols and spam control
- Effectively create, handle, and analyze log files Administer network name and configuration services, including NIS, DNS and DHCP
- Maintain, monitor, and map network services, using technologies and tools such as SNMP, nmap, libpcap, GraphViz and RRDtool
- Improve filesystem, process, and network security
This edition includes additional appendixes to get you up to speed on technologies such as XML/XPath, LDAP, SNMP, and SQL. With this book in hand and Perl in your toolbox, you can do more with less--fewer resources, less effort, and far less hassle.
Express.js Guide: The Comprehensive Book on Express.js
Cybersecurity: Public Sector Threats and Responses (Public Administration and Public Policy)
A Game Design Vocabulary: Exploring the Foundational Principles Behind Good Game Design
documentation on this process in a file called perlmodinstall.pod (type perldoc perlmodinstall to read it). The next sections provide brief summaries of the steps required for each operating system used in this book. 8 | Chapter 1: Introduction Installing Modules on Unix In most cases, the process goes like this: 1. 2. 3. 4. 5. Download the module and unpack it. Run perl Makefile.PL to create the necessary Makefile. Run make to build the package. Run make test to run any test suites included
instance, you may wish to check that the file and all of the directories in its path are not writable (since that would make it possible for someone to tamper with them). There’s a good recipe for testing this in Chapter 8 of the Perl Cookbook (http://oreilly .com/catalog/9780596003135/), by Tom Christiansen and Nathan Torkington (O’Reilly). The other concern is user input. Never trust that input from a user is palatable. Even if you explicitly print Please answer Y or N:, there is nothing to
to close this section with a more complex example. One idea that seems to get short shrift in many system administration contexts (but can yield tremendous benefit in the end) is the notion of empowering the user. If your users can fix their own problems with tools you provide, everybody wins. Much of this chapter is devoted to dealing with problems that arise from filesystems being filled. Often this occurs because users do not know enough about their environment, or because it is too cumbersome
particular file can be derived from another “base” file in the same directory (i.e., whether happy.c exists if we find happy.o): sub BaseFileExists { my ( $name, $path, $suffix ) = File::Basename::fileparse( $_[0], '\..*' ); # if we don't know how to derive this type of file return 0 unless ( defined $derivations{$suffix} ); # easy, we've seen the base file before return 1 if ( defined $baseseen{ $path . $name . $derivations{$suffix} } ); } # if file (or file to which link points) exists and
under Windows is slightly easier than the process under Unix, because standard API calls for these operations exist in Windows. As in Unix, we could call an external executable to handle the job (e.g., the ubiquitous net command with its USERS /ADD switch), but it is easy to use the native API calls from a handful of different modules, some of which we’ve mentioned earlier. Account creation functions exist in Win32::NetAdmin, Win32::UserAdmin, Win32API::Net, and Win32::Lanman, to name a few.