使用 Perl实现系统管理自动化(第2版)(影印版)》内容简介:如果你从事任何系统管理方面的工作,就必须应对日益复杂的工作环境以及对你的时间不断增加的需求。《使用Perl实现系统管理自动化 第二版》不仅提供了可用于工作的恰当工具,还给出了许多建议,帮助你解决特定问题以及安全地自动处理重复事务。这一版的"书"经过更新和扩充,涵盖了的操作系统、技术和Perl模块,将会帮助你:
管理用户账户
监测文件系统和进程
处理XML和YAML等格式的配置文件
使用DBI管理数据库,包括MySQL、MS SQL和Oracle
处理LDAP和Active Directory等目录服务
编写脚本管理电子邮件协议和垃圾邮件
高效地创建、处理和分析日志文件
管理网络名称和配置服务,包括NIS、DNS和DHCP
维护、监测和映射网络服务
提高文件系统、进程和网络的安全性
这一版的附录中还包含了额外内容,帮助你快速掌握XML/XPath、LDAP、SNMP和SQL等技术。《使用 Perl实现系统管理自动化(第2版)(影印版)》在手并结合Perl,你将花费更少的资源,付出更少的劳动,大大减少烦恼,让你事半功倍。
David N.Blank-Edelman是美国东北大学计算机与信息科学学院的技术主任,拥有25年在多种平台上的系统/网络管理员经验。
Preface
1. Introduction
Automation Is a Must
How Perl Can Help You
This Book Will Show You How
What You Need
Some Notes About the Perl Versions Used for This Book
What About Perl 5.10?
What About Strawberry Perl?
What About Perl 6?
Some Notes About Using Vista with the Code in This Book
Locating and Installing Modules
Installing Modules on Unix
Installing Modules on Win32
It`s Not Easy Being Omnipotent
Don`t Do It
Drop Your Privileges As Soon As Possible
Be Careful When Reading Data
Be Careful When Writing Data
Avoid Race Conditions
.Enjoy
References for More Information
2. Filesystems
Perl to the Rescue
Filesystem Differences
Unix
Windows-Based Operating Systems
Mac OS X
Filesystem Differences Summary
Dealing with Filesystem Differences from Perl
Walking or Traversing the Filesystem by Hand
Walking the Filesystem Using the File::Find Module
Walking the Filesystem Using the File::Find::Rule Module
Manipulating Disk Quotas
Editing Quotas with edquota Trickery
Editing Quotas Using the Quota Module
Editing NTFS Quotas Under Windows
Querying Filesystem Usage
Module Information for This Chapter
References for More Information
3. User Accounts
Unix User Identities
The Classic Unix Password File
Changes to the Password File in BSD 4.4 Systems
Shadow Passwords
Windows-Based Operating System User Identities
Windows User Identity Storage and Access
Windows User ID Numbers
Windows Passwords Don`t Play Nice with Unix Passwords
Windows Groups
Windows User Rights
Building an Account System to Manage Users
The Backend Database
The Low-Level Component Library
The Process Scripts
Account System Wrap-Up
Module Information for This Chapter
References for More Information
Unix Password Files
Windows User Administration
4. User Activity
Process Management
Windows-Based Operating System Process Control
Unix Process Control
File and Network Operations
Tracking File Operations on Windows
Tracking Network Operations on Windows
Tracking File and Network Operations in Unix
Module Information for This Chapter
Installing Win32::Setupsup
References for More Information
5. TCP/IP Name and Configuration Services
Host Files
Generating Host Files
Error-Checking the Host File Generation Process
Improving the Host File Output
Incorporating a Source Code Control System
NIS, NIS+, and WINS
NIS+
Windows Internet Name Server (WINS
Domain Name Service (DNS
Generating DNS (BIND) Configuration Files
DNS Checking: An Iterative Approach
DHCP
Active Probing for Rogue DHCP Servers
Monitoring Legitimate DHCP Servers
Module Information for This Chapter
References for More Information
6. Working with Configuration Files
Configuration File Formats
Binary
Naked Delimited Data
Key/Value Pairs
Markup Languages
All-in-One Modules
Advanced Configuration Storage Mechanisms
Module Information for This Chapter
References for More Information
XML and YAML
7. SQL Database Administration
Interacting with a SQL Server from Perl
Using the DBI Framework
Using ODBC from Within DBI
Server Documentation
MySQL Server via DBI
Oracle Server via DBI
Microsoft SQL Server via ODBC
Database Logins
Monitoring Space Usage on a Database Server
Module Information for This Chapter
References for More Information
DBI
Microsoft SQL Server
ODBC
Oracle
8. Email
Sending Mail
Getting sendmail (or a Similar Mail Transport Agent
Using the OS-Specific IPC Framework to Drive a Mail Client
Speaking the Mail Protocols Directly
Common Mistakes in Sending Email
Overzealous Message Sending
Subject Line Waste
Insufficient Information in the Message Body
Fetching Mail
Talking POP3 to Fetch Mail
Talking IMAP4rev1 to Fetch Mail
Processing Mail
Dissecting a Single Message
Dissecting a Whole Mailbox
Dealing with Spam
Support Mail Augmentation
Module Information for This Chapter
References for More Information
9. Directory Services
What`s a Directory?
Finger: A Simple Directory Service
The WHOIS Directory Service
LDAP: A Sophisticated Directory Service
LDAP Programming with Perl
The Initial LDAP Connection
Performing LDAP Searches
Entry Representation in Perl
Adding Entries with LDIF
Adding Entries with Standard LDAP Operations
Deleting Entries
Modifying Entry Names
Modifying Entry Attributes
Deeper LDAP Topics
Putting It All Together
Active Directory Service Interfaces
ADSI Basics
Using ADSI from Perl
Dealing with Container/Collection Objects
Identifying a Container Object
So How Do You Know Anything About an Object?
Searching
Performing Common Tasks Using the WinNT and LDAP Namespaces
Working with Users via ADSI
Working with Groups via ADSI
Working with File Shares via ADSI
Working with Print Queues and Print Jobs via ADSI
Working with Windows-Based Operating System Services via ADSI
Module Information for This Chapter
References for More Information
LDAP
ADSI
10. Log Files
Reading Text Logs
Reading Binary Log Files
Using unpack
Calling an OS (or Someone Else`s) Binary
Using the OS`s Logging API
Structure of Log File Data
Dealing with Log File Information
Space Management of Logging Information
Log Parsing and Analysis
Writing Your Own Log Files
Logging Shortcuts and Formatting Help
Basic/Intermediate Logging Frameworks
Advanced Logging Framework
Module Information for This Chapter
References for More Information
11. Security
Noticing Unexpected or Unauthorized Changes
Local Filesystem Changes
Changes in Data Served Over the Network
Noticing Suspicious Activities
Local Signs of Peril
Finding Problematic Patterns
Danger on the Wire, or "Perl Saves the Day"
Preventing Suspicious Activities
Suggest Better Passwords
Reject Bad Passwords
Module Information for This Chapter
References for More Information
12. SNMP
Using SNMP from Perl
Sending and Receiving SNMP Traps, Notifications, and Informs
Alternative SNMP Programming Interfaces
Module Information for This Chapter
References for More Information
13. Network Mapping and Monitoring
Network Mapping
Discovering Hosts
Discovering Network Services
Physical Location
Presenting the Information
Textual Presentation Tools
Graphical Presentation Tools
Monitoring Frameworks
Extending Existing Monitoring Packages
What`s Left?
Module Information for This Chapter
References for More Information
14. Experiential Learning
Playing with Timelines
Task One: Parsing crontab Files
Task Two: Displaying the Timeline
Task Three: Writing Out the Correct XML File
Putting It All Together
Summary: What Can We Learn from This?
Playing with Geocoding
Geocoding from Postal Addresses
Geocoding from IP Addresses
Summary: What Can We Learn from This?
Playing with an MP3 Collection
Summary: What Can We Learn from This?
One Final Exploration
Part One: Retrieving the Wiki Page with WWW::Mechanize
Part Two: Extracting the Data
Part Three: Geocoding and Mapping the Data
Summary: What Can We Learn from This?
Remember to Play
Module Information for This Chapter
Source Material for This Chapter
A. The Eight-Minute XML Tutorial
B. The 10-Minute XPath Tutorial
C. The 10-Minute LDAP Tutorial
D. The 15-Minute SQL Tutorial
E. The Five-Minute RCS Tutorial
F. The Two-Minute VBScript-to-Perl Tutorial
G. The 20-Minute SNMP Tutorial
Index
FAT filesystems are case-insensitive. In Unix, an attempt to open a file using thewrong case (i.e., MYFAVORITEFILE versus myfavoritefile) will fail, but with FATor VFAT, this will succeed with no problem.
Instead of a forward slash, FAT uses the backward slash () as its path separator.This has a direct ramification for the Perl programmer, because the backslash is aquoting character in Perl. Paths written in single quotes with only single separators(e.g, Spathe' dirdirfilename') are just fine. However, situations in which youneed to place multiple backslashes next to each other (e.g, serverdirfile) arepotential trouble. In those cases, you have to be vigilant in doubling any multiplebackslashes. Some Perl functions and some Perl modules will accept paths withforward slashes, but you shouldn't count on this convention when programming.
It is better to bite the bullet and write winnttemp than to learn that yourcode breaks because the conversion hasn't been done for you.
FAT files and directories have special flags associated with them that are calledattributes. Example attributes include "Read-only" and "System."
The root of a FAT filesystem is specified starting with the drive letter on which thefilesystem resides. For instance, the absolute path for a file might be specified asc : homecindydocsresumecurrent.doc.
FAT32 and NTFS filesystems have the same semantics as VFAT filesystems. They sharethe same support for long filenames and use the same root designator. NTFS is moresophisticated in its name support, however, because it allows these names to be specified using Unicode. Unicode is a multibyte character encoding scheme that can be usedto represent all of the characters of all of the written languages on the planet.NTFS also has some functional differences that distinguish it from the other Windowsand basic Unix filesystems. Later in this chapter, we will write some code to take advantage of some of these differences, such as filesystem quotas. NTFS supports ACLs,which provide a fine-grained permission mechanism for file and directory access.
"直到系统管理员阅读本书前,存在太多的任务本可以(并且应该)自动化完成但却没有。Peri是一种强大的工具,David向我们展示了如何让系统管理员付出更少劳动就能将系统掌控得更好。" ——Peter Baer Galvin,Corporate Technologies 公司首席技术官、IT架构师
还不错,英文版的,慢慢看
书很好,对系统管理员来说非常合适。
这个商品不错~
"这种计算机一类的书,本人觉得经常是挑花眼了,一搜索,就出来一大堆,看看都差不多,也不知道哪个好,哪个不行?看得急了烦了,就随便选一本。结果有时快递到了,一翻,发现要不看不懂,要不不是我想学的。挺愁人的。那天又在网上到处查,碰巧 看到一个“猎豹网校”,嘿,全是计算机课程,还每门课都有本书,比如我想学网页设计、想学点C语言了,不知道该挑什么书才合适,在猎豹网校上一搜,出来好多,老师列得挺清楚。试听了一下,就跟坐教室机房里,看着老师在自己面前操作一样,一步一步,可清楚了。这样子学一下,可比自己光买本书,回来学得一个头三个大要…
"这种计算机一类的书,本人觉得经常是挑花眼了,一搜索,就出来一大堆,看看都差不多,也不知道哪个好,哪个不行?看得急了烦了,就随便选一本。结果有时快递到了,一翻,发现要不看不懂,要不不是我想学的。挺愁人的。那天又在网上到处查,碰巧 看到一个“猎豹网校”,嘿,全是计算机课程,还每门课都有本书,比如我想学网页设计、想学点C语言了,不知道该挑什么书才合适,在猎豹网校上一搜,出来好多,老师列得挺清楚。试听了一下,就跟坐教室机房里,看着老师在自己面前操作一样,一步一步,可清楚了。这样子学一下,可比自己光买本书,回来学得一个头三个大要…