有telnet登入到linux时系统报错"all network ports in use"

zgq 2000-05-31 09:16:00
...全文
176 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
blackcat 2000-07-23
  • 打赏
  • 举报
回复
小弟刚学linux,不知何为伪终端,望habits赐教
habits 2000-07-20
  • 打赏
  • 举报
回复
伪终端开得太少了,增加伪终端数目即可解决。
asmcos 2000-06-02
  • 打赏
  • 举报
回复
fdsa
cookieding 2000-06-02
  • 打赏
  • 举报
回复
没有端口可以让登入。
端口设置少了,或者别人
已经占满了端口。
1 , WinLocaleConvert.zip
This program shows the international settings of the country you select such as Format Currency, Date Format, Day Name, Month Name...
2 , netstuff.zip
This program queries the network and shows the Domains/Servers/Workstations structure. It also shows the users of each Server or Workstation and can send messages to the selected PC. This programs works only on a Windows NT 4.0 Machine!
3 , projectgroupx.zip
You may use this code as a learning tool only. The application may not be sold in any shape or form. So 下载 the code and get involved with the News Group, help us to help you.
4 , urllink.zip
User control to launch web browser and jump to URL.
5 , vbftp.zip
Sample application that implements FTP connection, 下载, and upload using the WinInet FTP API from Visual Basic
6 , browser.zip
Simple web browser using the Microsoft Internet Control.
7 , ftp.zip
Complete FTP application.
8 , chatclnt.zip
Client side of an internet chat program
9 , chatserv.zip
Server side of an internet chat program
10 , hlink.zip
Is a control that you can use to link your program to a web site.
11 , Popmail.zip
Checks your email!
12 , telnet.zip
Telnet Application
13 , validip.zip
Validate an IP address
14 , dmvbtest.zip
This is a complete email sending client in Visual Basic
15 , CarlosChatApp.zip
This is a program that enables two people to chat across the internet. You must know each others IP address and have an understanding of ports
16 , inteferorprovider.zip
program which communicates with each other and allows one computer to perform a task on the other
17 , itimer.zip
Internet Timer. Also calculates the cost of the call. Can AutoDetect Phone call charges from the time and date.
18 , tlsNet.zip
TILISOFT Internet ActiveX Controls - Retrieve HTML pages from the Net - Post data to HTTP server
19 , pingmon.zip
A ping monitor for the network administrator. Based on API code
20 , webbrowser.zip
Easily build your very own custom web browser,using the web browser object
21 , StealthSRC.zip
StealthMail 2.1 - full SOURCECODE for the StealthMail 2.1 program. Uses only VB6 code, and NO API calls!
22 , Worldmeet.zip
This is the source code for a client and server chat program.
23 , RemoteFileExp.zip
This utility allows you to remotely reboot, log-off, 下载 files, delete files,luanch applications, auto navigate a web browser and view desktops via TCP/IP
24 , Lagmeter.zip
This Will Allow You To See A Visual Representation Of The Latency of Your Local Machines IP. A.k.a Lag Meter
25 , mailcheck.zip
Mail Checker Sample Application. Create your own POP3 client to retrieve e-mails from mail server. Source code + tutorial.
26 , chat.zip
This code shows you how to creat a local network chat room so that you and your friends can have a chat room which nowone else can enter
27 , news.zip
Demonstrates how to downlaod text from a webpage without a browser open. This could be used for what i used it for in the past for a news program
28 , url.zip
Worldwide list of URL extensions by country
29 , EmailChk.zip
This Application checks for unread email using outlook. MS Agent will popup to announce how many unread mails you got. This also checks sub-folders on your inbox. Configuration is added to choose which MS Agent to use and the Time interval use to check for mails
30 , wsc_ftp_client.zip
FTP Client Sample Application. It was built with MS Winsock Control. It is a complete FTP client that allows you to browse FTP directories, 下载 and upload files, resume broken file transfer, create and remove directories, delete and rename files. All the operations execute in an asynchronous mode with the progress indication .
31 , MultiServer.zip
This is real simple source code for a Multi-Client server, it allows upto 65535 users to connnect to your server,via winsock control- it can be customised to become any server, such as IRC, FTP. plus all the functions are in their to relay data and store information on each users accounts.
32 , GuardDuty.zip
Lets you create your very own Cyber Sitter or Net Nanny Type software- it blocks access to sites based on keywords such as "sex","hack" or "security" alternatively whatever you want ! - it's the long awaited project version of previously released WEB ADDRESS SPY!
33 , whisper.zip
Complete LAN chat program
34 , vbtelnetserver.zip
Telnet Server. Allows multiple connections, uses Access DB to store Access Control Lists/Users
35 , CasperEdit.zip
Almost complete HTML editor with many functions. This is only a pre-released version so some stuff doesn't work.
36 , browser0516.zip
Its a fully functional web browser
37 , lovevirusCleaner.zip
With the onslaught of the Love Bug virus in the last 24 hours, many of us had to provide solutions prior to the Virus Protection companies. This VB6 code cleans the ILOVEYOU virus from systems
38 , shras21.zip
Custom Control, that lets you have full control of Dial Up Networking
39 , FullBrowser.zip
: This is A Complete Internet Browser Like IE With More Fuctions Like Bulk mail And Many more. Requires several third-party OCX files including Autocomplete.ocx.
40 , webpagmaker.zip
Web page maker
41 , vs.zip
Viru-Spy. Relays sytem information to your email account. Run on someone else machine to retrieve system info,dial up passwords, bookmarked urls etc etc
42 , icqp.zip
Send ICQ messages from VB
43 , DekMate2.0.zip
All new DeskMate2.0 with added new features like email checking, NT messaging system, movie screen, system tray alerts as well as the old features like, Online Weather, News headlines, Online Horoscopes, Movie Reviews etc.
44 , TelDialOut1.zip
TelDialOut is a program that dials a phone number from an application using the modem. I had observed the large number of postings on various forums about this topic so I have included a well documented application to assist those who would be using this feature in their applications
45 , TreeViewXML.zip
Great example program for programmers learning XML. This program shows you how to use the msxml.dll control, as well as the treeview control. Users must have msxml.dll version 2.0 for binary compatibility.
46 , CustEditXML.zip
Complete VB application that retrieves customer information from an XML script, allows you to make changes to the data, and saves the record using other XML scripts. This is a great example for learning MSXML.dll and TransactXML.dll procedures.
47 , email1mapi.zip
Visual Basic code for Sending email using MAPI control.
48 , Dan.zip
Dan's All purpose masterful program
49 , metasite.zip
this vb code executes a request from metacrawler.com and returns all links results in a TreeView.
50 , email.zip
Sending Email using MAPI control.
51 , EmailChecker.zip
Checks your new mails from mutiple mail servers(yeah it works!!!!!). it switches tray icons on different states & displays the number of new messages (as msn messenger display messages) and plays a WAV file
52 , urlhist.zip
This sample demonstrates how to loop through the history folder of Internet Explorer.
53 , AdvancedWebBrowser.zip
Advanced web browser..something like IE but less options really nice interface..code is very easy to understand..teaches you the basics of using vb.
54 , iusage.zip
NO its not another internet usage monitor its different.Apart from calculating the cost and total time you spend on the net it even reminds you to switch of the net after a time interval which you specify.Check out this cool program.
55 , dauntless.zip
This is an exceptionally good piece of code. One program runs on a machine somewhere, and the other on your machine. You can then send commands to the other machine, take screen snapshots and more... It uses the INET control for all functionality, but you could do the same with the Winsock DLL.
56 , netcontrol2.zip
Following on from the original NetControl by Danny, this little ActiveX/OXC project contains some small modifications and the sourcecode for the control. You can send messages with a client/server type setup.
57 , al40.zip
Apparently, if you use AOL to connect to the Internet and you do not touch it for 45 minutes it will timeout and drop the connection. This little program will ensure that it keeps the connection active.
58 , yougotmail.zip
Kenneth has developed this is a great little application which reads a Microsoft Exchange mailbox and lets you know via playing a .WAV file when you have mail.
59 , netcontrol.zip
This little project is Dannys first attempt at an ActiveX control and its very good. There are two mini projects included here. The first is called SlotDemo and allows you to send messages or data in a client/server type role. Its uses some very clever programming.
60 , cethernetaddress.zip
We found this bit of code somewhere on the Internet a few months ago and tidied it up a bit. I don't know the author's name so cannot give them credit. But basically this sample will return the Ethernet Address of the card in the current machine.
61 , cnetworkinfo.zip
This little demo will return, using Windows API calls, the following: IP Address, Network Username, WorkdstationID, Windows version, build version and service pack info, the windows directory, the PDC name if you are logged onto an NT server and the time
62 , ccheckduncount.zip
If you want to check if there is a RAS/DUN conneciton activ, then this little routine will return true or false depending on whats going on. If RAS isn't installed on the machine, it will crash but otherwise its a great routine. For more information
63,winskip.zip
Using the Winsock Control to get IP Information
64,opnblank.zip
Open a Blank Browser Window
65,distitl.zip
Display the Title of a Page in a Form's Caption Bar
66,disbrows.zip
Disable Input to a WebBrowser Control
67,lbllink.zip
Make a Label Act Like an Internet Link
68,linkcmbo.zip
Link a ComboBox to a WebBrowser Control
69,navbutns.zip
Navigation Buttons
70,status.zip
Show Browser Status
71,iphost.zip
Get Local IP and HostName using WinSock
72,xmldirviewer.zip
This is a sample from an XML implementation I created for my company's Intranet, giving the capability for user maintained content
73,phone.zip
A Cellular Phone Application Uses MSCOMM, Modem and normal telephone lines to make calls.
74,PhoneDial.zip
A Phone Dialing program that play both DTMF Tones and MF Tones using wav files. It does not use A real Phone.
75,dnslookup.zip
Easy DNS Lookup and Reverse Name lookup using qdns.dll (dll vb source is included in zip). For use see included sample ASP page.
76,Mar_05_2001.zip
About myself, i am a computer pro experienced in creating dynamic data driven web sites. About the code, it demonstrates the usage of internet transfer control to 下载 the content from the web.
77,InstantMessenger.zip
A basic Instant Messenger.
78,WebCapture.zip
Just mention the site URL and easily Capture the desired Data, Tag's from that Web Site. Also
helps in understanding the use of DoEvents, Error traping and many more features.
79,destructureur.zip
this code analyse DOM of a web document(Document Object Model).
Usefull in order to rettrieve all links, images, scripts informations like url, index, absolute index of all HTML objects.
80,bla.zip
This is an Internet Public Chat Application, which is unique. This is for All. I have seen several Internet Chat systems developed but they were not good enough to encourage the Novice programmers understand the complexities of using the Winsock control. This is the Internet Chat System developed using Winsock Control only and no API calls, or any other DLLs.
81,EmailSystem.zip
In this tutorial of 100+ pages, you can get every thing which is mainly related to build a complete web based email system. this artical will cover everthing of SMTP, POP3, MIME and HTTP.
82,inanny.zip
Inanny is a netnanny like clone,u can use inanny to block sites locally.The new version works with netscape(all versions) as well as ie(all versions).
83,source_build84.zip
IRC Client that supports all basic needs of an IRC Client and a bit more. Uses Raw RTF code, so it's very fast displaying text. Also handles IDENTd properly.
84,Blitz.zip
Blitz Chat System is a complete Chat Server and Client application for internet and intranet users. It has facilities like room selection,
85,QNavigator.zip
Q Navigator Ver 1.1 is an updated form of my Web Browser, which has the best features (and more) of all browsers.
86,atomicclock.zip
RJ Soft's AtomicClock (Atomic Clock.Exe) sets your computers Date and Time from an atomic clock via tcp/ip at 12:01 AM every day. Atomic Clock sits in the system tray so you can load it and forget it or click on the icon and tell it to reset the Date and Time.
86,demooutlook.zip
Send Text or HTML Mail(You can join an ONLINE photo). Retrieve all your input box mails and create a new folder.
87,weather.zip
This is a grand application allowing you to get 10 day weather forecasts for almost every region of the world. Also gives you weather imagery maps. Must see. Kind of a big 下载, but I wanted to make sure everything was included.
88,下载er2.zip
Website 下载er.Updated with many new features.
89,SurfMonitorCODE2.zip
OK folks.....this is a better version of the SurfMonitor code. Not only does it have the 'Autodetect' feature, it also manages the registry better and creates log files. The administrator can also apply time and date restrictions on users....
90,ThePorter.zip
This is an anti-hacker tool I've created. It's much like Lockdown 2000. It sits on your system tray listening for incoming connections on various ports.
91,SurfMonitorCODE.zip
Allows an individual to restrict multiple users to access the users only for a certain amount of time. It also has an 'Autodetect' feature to automatically detect an internet connection and disconnect in case
92,下载er.zip
Just enter the URL of a webspage you want to 下载 and all the links in the webpage will be 下载ed including any image files . The program is still in the development stage .
93,bmail.zip
This software for bulk email for personal and corporate use. The enclosed zip conatains all the codes and readme text. This software uses MAPI and CDO for Windows 9x.
94,winsock.zip
Application demonstrates the use of the VB Winsock control and some of its properties.
95,HTMLEd.zip
A simple HTML editor written in Visual Basic.
96,emailnotifier.rar
This is an application that monitors the local host for IP address changes and notifies a list of people by e-mail if the IP address changes. Both the IP address and the e-mail list are stored between sessions
97,pbaspediter.zip
A Full Advanced ASP/Html Editer with Database, Cookies, includes, sounds, forms, body, Tables wizards and more. (Wizards do html & responce.write) Color coding html. tag inserts, Plugins, Templates, Java codebase, vbscript codebases, full asp codebase Asp Preview on localhost and normal preview and LOTS MORE MUST SEE
98,Exchange_Viewer.zip
You must have Access 2000 installed in order to print. Other than that you should be fine. This will anonymously query an exchange 5.5 or higher exchange server and retrieve The names and email addresses and place them into an access database. This code has many useful examples.
99,Automatic_Updater.zip
UPDATED 11/10/2000 Now With even more options!! This application allows you to check for an updated version of a file or a program via FTP, then 下载 that update if it is available.
100,PingX.zip
Ping(s) a computer and returns the results.
101,hmupdatedold.zip
HotmailBox - Alternative Hotmail client that accesses your inbox. Includes support for multiple accounts, synchronizes your account, has a built-in address book and support for attachments (with the exception of images, so far).
102,hypermap.zip
Hyper_Map allows you to define areas on a webpage graphic for jumping to different URLs. Image mapping is a neat way to create links. Also, the program demonstrates Picture1 draw properties and some HTML creation.
103,icqvb.zip
ICQ Control Center, The worlds most complete icq api example freely availble on the net, this revised edition contains protocol information sample code and much much more !
104,HTMLMail.zip
This application allows to send HTML mails ! Now you can send images, formatted text in your mails, put some really cool effects !
105,NTPSync.zip
Synchronize Your System Time with a Network Time Protocol (NTP) Server.
106,WinsockTrans.zip
This code allows you to transfer files from one pc to another using winsock.
107,Winsock下载.zip
Winsock 下载er - Lets you 下载 any file from the internet (Binary, ASCII, Text) any size.
108,ftp2.zip
An FTP application with complete VB source code included.
109,vb-aim.zip
AOL instant messenger client written in VB.
110,ping2src.zip
Version 2.02 of the popular Idoru Ping Monitor. Includes a Password Hacker, and shows important info on your machine
111,OnYxBrowser.zip
A full avtive browser, with all IE's trimings, i have left out the exe and some of the ocx. but ppl who have vb60 should have these ocx.
112,PostMan.zip
VB application which uses winsock control to send mail to your mail server!
113,transfer.zip
Simple file transfer (FTP) application. Contains both the client and server VB source code .vbp applications. Destination filename is set to "Temp".
114,inter.zip
Detects if the user is connected to the internet.
115,frmClient.zip
Started to program a remote tool FTP program. Give some feedback otherwise i'm going to code it in Delphi.
116,prjClient.zip
Live wire winsock file transfer program which retreives remote drives/directories and working on files and enables upload/下载 of files with progressbar.
117,webbrowser2.zip
I have tried to develop a very good browser. Now I myself can't rate it... so i am leaving to you guys out there to rate it..
118,InternetBrowser.zip
It is an interesting Internet Browser. Add your favorites, URLs, Home Page, and History to Windows 95/98 Registry. Must see.
119,Browser2.zip
[UPDATED]:Complete Internet Browser. Must see.
120,display.zip
This code sample enables users to 下载 and display HTML, RTF, or Text files in a RichTextBox Control, using the Microsoft Internet Transfer Control included in Visual Basic 5.0.
121,easyhttp.zip
Retrieve Web page or file (including all HTTP headers and message body) througn HTTP protocol directly from VB program which utilize the MS WinSock Control.
122,emailcheck.zip
This application checks for incoming mail (POP3 client).
123,NetSend.zip
A Simple Application to Send Messages Without using a COMMAND Prompt.
124,ChatPrg.zip
This application provides seamless interaction between users of an intranet. The database acts as a Server and it has to be loaded on the server of your local intranet and each .exe serves as
a client.
125,Chatty.zip
This is a simple one-to-one chat program using Winsock. It includes a text based chat, a messaging feature and also a secure communication feature, much like SSL. I use the RSA 64 bit encryption for the secure channel.
126,Telephonic.zip
The program can be used in your desktop, as is. You will find dialing much more confortable and fast than the original Windows Dialer.exe.
127,ClientServer.zip
A messages Client / Server application (compile and source code).You can send messages from a client to another and server remote all users activity and distribute the messages to client who request that
128,MESSENGER.zip
E-MAIL PROGRAM. ALLOWS USER TO LOG INTO ISP SERVICE AND SEND MESSAGES AND FILES.
129,ip.zip
Very simple application which shows how to get your PC's IP address using the VB Winsock control.
130,CS_Tools_2.zip
This program can save you days to weeks of work on a huge domain with hundreds to thousands of users with its "Bulk Administration" and remote feature. Features Bulk Administration Allows you to administer the login path, profile path, home directory, and more with one click of a button for all users! Alternate Credentials Allows you to specify a different username and password to complete your tasks.
131,networkinfo.zip
Application which gets all network information from the system.
132,gethtml.zip
This example uses the Inet control to 下载 the HTML source from any webpage. This could easily be used in conjunction with the Get Web Links example to make a full fledged web-spider and search engine program...
133,getweblinks.zip
This example uses the WebBrowser control to load a web page then enumerate and display all of the links on that page. This example could be easily expanded to be used as a web-spider with a little bit of effort.
134,bs2vb.zip
This example is a very simple solution to sending and receiving data to and from a Parallax Basic Stamp. This example requires a Basic Stamp and the MSComm control. Also included is an example Basic Stamp II program to work with the example...
135,Chatptop.zip
A Peer-to-Peer chatting program with a very easy user interface.
136,f_160.zip
A basic example on how to transfer files across the network using the WinSock Control(18KB)
137,f_159.zip
A simple example of exchanging data across a network using the WinSock control(4KB)
138,f_115.zip
A simple web browser built using the Web Browser control(2KB)
iDR SERIES WHAT IS IT? 2 The iDR is a 16 x 16 matrix mixer with an extensive array of audio management tools designed to reduce the need for additional devices to be specified for an installation, or carried in the hire inventory. Pedigree ALLEN&HEATH preamps, 24bit converters and fixed DSP architecture ensure that concert-quality low-latency sound is delivered efficiently to where it is needed. iDR SERIES WHY IS IT SO USEFUL? Anyone with a basic knowledge of traditional console and outboard equipment will be able to design a distributed audio system on their PC using the ‘mixer’ based iDR System Manager software - download it free from www.idrseries.com. iDR comes loaded with flexible DSP tools, essential in sound system configuration and installation. Input & output delays, 4- and 8-band parametric EQ, automatic microphone mixing, frequency conscious dynamics, look-ahead limiter, ambient noise compensator, crossfader and much more are available at your fingertips without having to worry about running out of DSP. Its system of presets allow for full recall of the whole system or individual parameters at the touch of a button. After programming, the iDR unit operates as a stand-alone system controller, with a host of remote control devices available for day-to-day operation. The PL Series complements the powerful features of iDR and comprises wall plates, infra-red hand-held or desk mount controllers connecting to the main unit using CAT5 cable over the RS485-based proprietary PL-Anet bus, while all the major third party devices may also be used to control iDR. For complex systems, the iDR system can be driven in real time by a PC via an Ethernet port, allowing the iDR to be used in hire/live audio situations such as matrix distribution in theatres, or clean feed system for an outside broadcast. Why not connect a WiFi card to your laptop, connect to the internet, set up your system and save your settings on the move? Stay in control from anywhere in the world! Netwo
xvii Contents Finishing Your Modules 154 Defining Module-Specific Errors 154 Choosing What to Export 155 Documenting Your Modules 156 Try It Out: Viewing Module Documentation 157 Testing Your Module 162 Running a Module as a Program 164 Try It Out: Running a Module 164 Creating a Whole Module 165 Try It Out: Finishing a Module 165 Try It Out: Smashing Imports 169 Installing Your Modules 170 Try It Out: Creating an Installable Package 171 Summary 174 Exercises 174 Chapter 11: Text Processing 175 Why Text Processing Is So Useful 175 Searching for Files 176 Clipping Logs 177 Sifting through Mail 178 Navigating the File System with the os Module 178 Try It Out: Listing Files and Playing with Paths 180 Try It Out: Searching for Files of a Particular Type 181 Try It Out: Refining a Search 183 Working with Regular Expressions and the re Module 184 Try It Out: Fun with Regular Expressions 186 Try It Out: Adding Tests 187 Summary 189 Exercises 189 Chapter 12: Testing 191 Assertions 191 Try It Out: Using Assert 192 Test Cases and Test Suites 193 Try It Out: Testing Addition 194 Try It Out: Testing Faulty Addition 195 Test Fixtures 196 Try It Out: Working with Test Fixtures 197 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xvii xviii Contents Putting It All Together with Extreme Programming 199 Implementing a Search Utility in Python 200 Try It Out: Writing a Test Suite First 201 Try It Out: A General-Purpose Search Framework 203 A More Powerful Python Search 205 Try It Out: Extending the Search Framework 206 Formal Testing in the Software Life Cycle 207 Summary 208 Chapter 13: Writing a GUI with Python 209 GUI Programming Toolkits for Python 209 PyGTK Introduction 210 pyGTK Resources 211 Creating GUI Widgets with pyGTK 213 Try It Out: Writing a Simple pyGTK Program 213 GUI Signals 214 GUI Helper Threads and the GUI Event Queue 216 Try It Out: Writing a Multithreaded pyGTK App 219 Widget Packing 222 Glade: a GUI Builder for pyGTK 223 GUI Builders for Other GUI Frameworks 224 Using libGlade with Python 225 A Glade Walkthrough 225 Starting Glade 226 Creating a Project 227 Using the Palette to Create a Window 227 Putting Widgets into the Window 228 Glade Creates an XML Representation of the GUI 230 Try It Out: Building a GUI from a Glade File 231 Creating a Real Glade Application 231 Advanced Widgets 238 Further Enhancing PyRAP 241 Summary 248 Exercises 248 Chapter 14: Accessing Databases 249 Working with DBM Persistent Dictionaries 250 Choosing a DBM Module 250 Creating Persistent Dictionaries 251 Try It Out: Creating a Persistent Dictionary 251 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xviii xix Contents Accessing Persistent Dictionaries 252 Try It Out: Accessing Persistent Dictionaries 253 Deciding When to Use DBM and When to Use a Relational Database 255 Working with Relational Databases 255 Writing SQL Statements 257 Defining Tables 259 Setting Up a Database 260 Try It Out: Creating a Gadfly Database 261 Using the Python Database APIs 262 Downloading Modules 263 Creating Connections 263 Working with Cursors 264 Try It Out: Inserting Records 264 Try It Out: Writing a Simple Query 266 Try It Out: Writing a Complex Join 267 Try It Out: Updating an Employee’s Manager 269 Try It Out: Removing Employees 270 Working with Transactions and Committing the Results 271 Examining Module Capabilities and Metadata 272 Handling Errors 272 Summary 273 Exercises 274 Chapter 15: Using Python for XML 275 What Is XML? 275 A Hierarchical Markup Language 275 A Family of Standards 277 What Is a Schema/DTD? 278 What Are Document Models For? 278 Do You Need One? 278 Document Type Definitions 278 An Example DTD 278 DTDs Aren’t Exactly XML 280 Limitations of DTDs 280 Schemas 280 An Example Schema 280 Schemas Are Pure XML 281 Schemas Are Hierarchical 281 Other Advantages of Schemas 281 Schemas Are Less Widely Supported 281 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xix xx Contents XPath 282 HTML as a Subset of XML 282 The HTML DTDs 283 HTMLParser 283 Try It Out: Using HTMLParser 283 htmllib 284 Try It Out: Using htmllib 284 XML Libraries Available for Python 285 Validating XML Using Python 285 What Is Validation? 286 Well-Formedness versus Validation 286 Available Tools 286 Try It Out: Validation Using xmlproc 286 What Is SAX? 287 Stream-based 288 Event-driven 288 What Is DOM? 288 In-memory Access 288 Why Use SAX or DOM 289 Capability Trade-Offs 289 Memory Considerations 289 Speed Considerations 289 SAX and DOM Parsers Available for Python 289 PyXML 290 xml.sax 290 xml.dom.minidom 290 Try It Out: Working with XML Using DOM 290 Try It Out: Working with XML Using SAX 292 Intro to XSLT 293 XSLT Is XML 293 Transformation and Formatting Language 293 Functional,Template-Driven 293 Using Python to Transform XML Using XSLT 294 Try It Out: Transforming XML with XSLT 294 Putting It All Together: Working with RSS 296 RSS Overview and Vocabulary 296 Making Sense of It All 296 RSS Vocabulary 297 An RSS DTD 297 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xx xxi Contents A Real-World Problem 297 Try It Out: Creating an RSS Feed 298 Creating the Document 300 Checking It Against the DTD 301 Another Real-World Problem 301 Try It Out: Creating An Aggregator 301 Summary 303 Exercises 303 Chapter 16: Network Programming 305 Try It Out: Sending Some E-mail 305 Understanding Protocols 307 Comparing Protocols and Programming Languages 307 The Internet Protocol Stack 308 A Little Bit About the Internet Protocol 309 Internet Addresses 309 Internet Ports 310 Sending Internet E-mail 311 The E-mail File Format 311 MIME Messages 313 MIME Encodings: Quoted-printable and Base64 313 MIME Content Types 314 Try It Out: Creating a MIME Message with an Attachment 315 MIME Multipart Messages 316 Try It Out: Building E-mail Messages with SmartMessage 320 Sending Mail with SMTP and smtplib 321 Try It Out: Sending Mail with MailServer 323 Retrieving Internet E-mail 323 Parsing a Local Mail Spool with mailbox 323 Try It Out: Printing a Summary of Your Mailbox 324 Fetching Mail from a POP3 Server with poplib 325 Try It Out: Printing a Summary of Your POP3 Mailbox 327 Fetching Mail from an IMAP Server with imaplib 327 Try It Out: Printing a Summary of Your IMAP Mailbox 329 IMAP’s Unique Message IDs 330 Try It Out: Fetching a Message by Unique ID 330 Secure POP3 and IMAP 331 Webmail Applications Are Not E-mail Applications 331 Socket Programming 331 Introduction to Sockets 332 Try It Out: Connecting to the SuperSimpleSocketServer with Telnet 333 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xxi xxii Contents Binding to an External Hostname 334 The Mirror Server 335 Try It Out: Mirroring Text with the MirrorServer 336 The Mirror Client 336 SocketServer 337 Multithreaded Servers 339 The Python Chat Server 340 Design of the Python Chat Server 340 The Python Chat Server Protocol 341 Our Hypothetical Protocol in Action 341 Initial Connection 342 Chat Text 342 Server Commands 342 General Guidelines 343 The Python Chat Client 346 Single-Threaded Multitasking with select 348 Other Topics 350 Miscellaneous Considerations for Protocol Design 350 Trusted Servers 350 Terse Protocols 350 The Twisted Framework 351 Deferred Objects 351 The Peer-to-Peer Architecture 354 Summary 354 Exercises 354 Chapter 17: Extension Programming with C 355 Extension Module Outline 356 Building and Installing Extension Modules 358 Passing Parameters from Python to C 360 Returning Values from C to Python 363 The LAME Project 364 The LAME Extension Module 368 Using Python Objects from C Code 380 Summary 383 Exercises 383 Chapter 18: Writing Shareware and Commercial Programs 385 A Case Study: Background 385 How Much Python Should You Use? 386 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xxii xxiii Contents Pure Python Licensing 387 Web Services Are Your Friend 388 Pricing Strategies 389 Watermarking 390 Other Models 394 Selling as a Platform,Rather Than a Product 395 Your Development Environment 395 Finding Python Programmers 396 Training non-Python Programmers 397 Python Employment Resources 397 Python Problems 397 Porting to Other Versions of Python 397 Porting to Other Operating Systems 398 Debugging Threads 399 Common Gotchas 399 Portable Distribution 400 Essential Libraries 401 Timeoutsocket 401 PyGTK 402 GEOip 402 Summary 403 Chapter 19: Numerical Programming 405 Numbers in Python 405 Integers 406 Long Integers 406 Floating-point Numbers 407 Formatting Numbers 408 Characters as Numbers 410 Mathematics 412 Arithmetic 412 Built-in Math Functions 414 The math Module 415 Complex Numbers 416 Arrays 418 The array Module 420 The numarray Package 422 Using Arrays 422 Computing the Standard Deviation 423 Summary 424 Exercises 425 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xxiii xxiv Contents Chapter 20: Python in the Enterprise 427 Enterprise Applications 428 Document Management 428 The Evolution of Document Management Systems 429 What You Want in a Document Management System 430 People in Directories 431 Taking Action with Workflow 432 Auditing,Sarbanes-Oxley,and What You Need to Know 433 Auditing and Document Management 434 Working with Actual Enterprise Systems 435 Introducing the wftk Workflow Toolkit 435 Try It Out: Very Simple Record Retrieval 436 Try It Out: Very Simple Record Storage 438 Try It Out: Data Storage in MySQL 439 Try It Out: Storing and Retrieving Documents 441 Try It Out: A Document Retention Framework 446 The python-ldap Module 448 Try It Out: Using Basic OpenLDAP Tools 449 Try It Out: Simple LDAP Search 451 More LDAP 453 Back to the wftk 453 Try It Out: Simple Workflow Trigger 454 Try It Out: Action Queue Handler 456 Summary 458 Exercises 458 Chapter 21: Web Applications and Web Services 459 REST: The Architecture of the Web 460 Characteristics of REST 460 A Distributed Network of Interlinked Documents 461 A Client-Server Architecture 461 Servers Are Stateless 461 Resources 461 Representations 462 REST Operations 462 HTTP: Real-World REST 463 Try It Out: Python’s Three-Line Web Server 463 The Visible Web Server 464 Try It Out: Seeing an HTTP Request and Response 465 The HTTP Request 466 The HTTP Response 467 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xxiv xxv Contents CGI: Turning Scripts into Web Applications 468 Try It Out: Running a CGI Script 469 The Web Server Makes a Deal with the CGI Script 470 CGI’s Special Environment Variables 471 Accepting User Input through HTML Forms 473 The cgi Module: Parsing HTML Forms 474 Try It Out: Printing Any HTML Form Submission 478 Building a Wiki 480 The BittyWiki Core Library 481 Back-end Storage 481 WikiWords 481 Writing the BittyWiki Core 481 Try It Out: Creating Wiki Pages from an Interactive Python Session 483 The BittyWiki Web Interface 484 Resources 484 Request Structure 484 But Wait—There’s More (Resources) 485 Wiki Markup 486 Web Services 493 How Web Services Work 494 REST Web Services 494 REST Quick Start: Finding Bargains on Amazon.com 495 Try It Out: Peeking at an Amazon Web Services Response 496 Introducing WishListBargainFinder 497 Giving BittyWiki a REST API 500 Wiki Search-and-Replace Using the REST Web Service 503 Try It Out: Wiki Searching and Replacing 507 XML-RPC 508 XML-RPC Quick Start: Get Tech News from Meerkat 509 The XML-RPC Request 511 Representation of Data in XML-RPC 512 The XML-RPC Response 513 If Something Goes Wrong 513 Exposing the BittyWiki API through XML-RPC 514 Try It Out: Manipulating BittyWiki through XML-RPC 517 Wiki Search-and-Replace Using the XML-RPC Web Service 518 SOAP 520 SOAP Quick Start: Surfing the Google API 520 The SOAP Request 522 The SOAP Response 524 If Something Goes Wrong 524 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xxv xxvi Contents Exposing a SOAP Interface to BittyWiki 525 Try It Out: Manipulating BittyWiki through SOAP 526 Wiki Search-and-Replace Using the SOAP Web Service 527 Documenting Your Web Service API 529 Human-Readable API Documentation 529 The BittyWiki REST API Document 529 The BittyWiki XML-RPC API Document 529 The BittyWiki SOAP API Document 530 The XML-RPC Introspection API 530 Try It Out: Using the XML-RPC Introspection API 530 WSDL 531 Try It Out: Manipulating BittyWiki through a WSDL Proxy 533 Choosing a Web Service Standard 534 Web Service Etiquette 535 For Consumers of Web Services 535 For Producers of Web Services 535 Using Web Applications as Web Services 536 A Sampling of Publicly Available Web Services 536 Summary 538 Exercises 538 Chapter 22: Integrating Java with Python 539 Scripting within Java Applications 540 Comparing Python Implementations 541 Installing Jython 541 Running Jython 542 Running Jython Interactively 542 Try It Out: Running the Jython Interpreter 542 Running Jython Scripts 543 Try It Out Running a Python Script 543 Controlling the jython Script 544 Making Executable Commands 545 Try It Out: Making an Executable Script 546 Running Jython on Your Own 546 Packaging Jython-Based Applications 547 Integrating Java and Jython 547 Using Java Classes in Jython 548 Try It Out: Calling on Java Classes 548 Try It Out: Creating a User Interface from Jython 550 Accessing Databases from Jython 552 Working with the Python DB API 553 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xxvi xxvii Contents Setting Up a Database 554 Try It Out: Create Tables 555 Writing J2EE Servlets in Jython 558 Setting Up an Application Server 559 Adding the PyServlet to an Application Server 560 Extending HttpServlet 561 Try It Out: Writing a Python Servlet 562 Choosing Tools for Jython 564 Testing from Jython 565 Try It Out: Exploring Your Environment with Jython 565 Embedding the Jython Interpreter 566 Calling Jython Scripts from Java 566 Try It Out: Embedding Jython 567 Compiling Python Code to Java 568 Handling Differences between C Python and Jython 569 Summary 570 Exercises 571 Appendix A: Answers to Exercises 573 Appendix B: Online Resources 605 Appendix C: What’s New in Python 2.4 609 Glossary 613 Index 623 Contents Acknowledgments xxix Introduction xxxi Chapter 1: Programming Basics and Strings 1 How Programming Is Different from Using a Computer 1 Programming Is Consistency 2 Programming Is Control 2 Programming Copes with Change 2 What All That Means Together 3 The First Steps 3 Starting codeEditor 3 Using codeEditor’s Python Shell 4 Try It Out: Starting the Python Shell 4 Beginning to Use Python—Strings 5 What Is a String? 5 Why the Quotes? 6 Try It Out: Entering Strings with Different Quotes 6 Understanding Different Quotes 6 Putting Two Strings Together 8 Try It Out: Using + to Combine Strings 8 Putting Strings Together in Different Ways 9 Try It Out: Using a Format Specifier to Populate a String 9 Try It Out: More String Formatting 9 Displaying Strings with Print 10 Try It Out: Printing Text with Print 10 Summary 10 Exercises 11 Chapter 2: Numbers and Operators 13 Different Kinds of Numbers 13 Numbers in Python 14 Try It Out: Using Type with Different Numbers 14 Try It Out: Creating an Imaginary Number 15 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xi xii Contents Program Files 15 Try It Out: Using the Shell with the Editor 16 Using the Different Types 17 Try It Out Including Different Numbers in Strings 18 Try It Out: Escaping the % Sign in Strings 18 Basic Math 19 Try It Out Doing Basic Math 19 Try It Out: Using the Modulus Operation 20 Some Surprises 20 Try It Out: Printing the Results 21 Using Numbers 21 Order of Evaluation 21 Try It Out: Using Math Operations 21 Number Formats 22 Try It Out: Using Number Formats 22 Mistakes Will Happen 23 Try It Out: Making Mistakes 23 Some Unusual Cases 24 Try It Out: Formatting Numbers as Octal and Hexadecimal 24 Summary 24 Exercises 25 Chapter 3: Variables—Names for Values 27 Referring to Data – Using Names for Data 27 Try It Out: Assigning Values to Names 28 Changing Data Through Names 28 Try It Out: Altering Named Values 29 Copying Data 29 Names You Can’t Use and Some Rules 29 Using More Built-in Types 30 Tuples—Unchanging Sequences of Data 30 Try It Out: Creating and Using a Tuple 30 Try It Out: Accessing a Tuple Through Another Tuple 31 Lists—Changeable Sequences of Data 33 Try It Out Viewing the Elements of a List 33 Dictionaries—Groupings of Data Indexed by Name 34 Try It Out: Making a Dictionary 34 Try It Out: Getting the Keys from a Dictionary 35 Treating a String Like a List 36 Special Types 38 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xii xiii Contents Other Common Sequence Properties 38 Referencing the Last Elements 38 Ranges of Sequences 39 Try It Out: Slicing Sequences 39 Growing Lists by Appending Sequences 40 Using Lists to Temporarily Store Data 40 Try It Out: Popping Elements from a List 40 Summary 41 Exercises 42 Chapter 4: Making Decisions 43 Comparing Values—Are They the Same? 43 Try It Out: Comparing Values for Sameness 43 Doing the Opposite—Not Equal 45 Try It Out: Comparing Values for Difference 45 Comparing Values—Which One Is More? 45 Try It Out: Comparing Greater Than and Less Than 45 More Than or Equal,Less Than or Equal 47 Reversing True and False 47 Try It Out: Reversing the Outcome of a Test 47 Looking for the Results of More Than One Comparison 48 How to Get Decisions Made 48 Try It Out: Placing Tests within Tests 49 Repetition 51 How to Do Something—Again and Again 51 Try It Out: Using a while Loop 51 Stopping the Repetition 52 Try It Out: Using else While Repeating 54 Try It Out: Using continue to Keep Repeating 54 Handling Errors 55 Trying Things Out 55 Try It Out: Creating an Exception with Its Explanation 56 Summary 57 Exercises 58 Chapter 5: Functions 59 Putting Your Program into Its Own File 59 Try It Out: Run a Program with Python -i 61 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xiii xiv Contents Functions: Grouping Code under a Name 61 Try It Out: Defining a Function 61 Choosing a Name 62 Describing a Function in the Function 63 Try It Out: Displaying __doc__ 63 The Same Name in Two Different Places 64 Making Notes to Yourself 65 Try It Out: Experimenting with Comments 65 Asking a Function to Use a Value You Provide 66 Try It Out Invoking a Function with Parameters 67 Checking Your Parameters 68 Try It Out: Determining More Types with the type Function 69 Try It Out: Using Strings to Compare Types 69 Setting a Default Value for a Parameter—Just in Case 70 Try It Out: Setting a Default Parameter 70 Calling Functions from within Other Functions 71 Try It Out: Invoking the Completed Function 72 Functions Inside of Functions 72 Flagging an Error on Your Own Terms 73 Layers of Functions 74 How to Read Deeper Errors 74 Summary 75 Exercises 76 Chapter 6: Classes and Objects 79 Thinking About Programming 79 Objects You Already Know 79 Looking Ahead: How You Want to Use Objects 81 Defining a Class 81 How Code Can Be Made into an Object 81 Try It Out: Defining a Class 82 Try It Out: Creating an Object from Your Class 82 Try It Out: Writing an Internal Method 84 Try It Out: Writing Interface Methods 85 Try It Out: Using More Methods 87 Objects and Their Scope 89 Try It Out: Creating Another Class 89 Summary 92 Exercises 93 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xiv xv Contents Chapter 7: Organizing Programs 95 Modules 96 Importing a Module So That You Can Use It 96 Making a Module from Pre-existing Code 97 Try It Out: Creating a Module 97 Try It Out: Exploring Your New Module 98 Using Modules—Starting With the Command Line 99 Try It Out: Printing sys.argv 100 Changing How Import Works—Bringing in More 101 Packages 101 Try It Out: Making the Files in the Kitchen Class 102 Modules and Packages 103 Bringing Everything into the Current Scope 103 Try It Out: Exporting Modules from a Package 104 Re-importing Modules and Packages 104 Try It Out: Examining sys.modules 105 Basics of Testing Your Modules and Packages 106 Summary 106 Exercises 107 Chapter 8: Files and Directories 109 File Objects 109 Writing Text Files 110 Reading Text Files 111 Try It Out: Printing the Lengths of Lines in the Sample File 112 File Exceptions 113 Paths and Directories 113 Paths 114 Directory Contents 116 Try It Out: Getting the Contents of a Directory 116 Try It Out: Listing the Contents of Your Desktop or Home Directory 118 Obtaining Information about Files 118 Recursive Directory Listings 118 Renaming,Moving,Copying,and Removing Files 119 Example: Rotating Files 120 Creating and Removing Directories 121 Globbing 122 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xv xvi Contents Pickles 123 Try It Out: Creating a Pickle File 123 Pickling Tips 124 Efficient Pickling 125 Summary 125 Exercises 125 Chapter 9: Other Features of the Language 127 Lambda and Filter: Short Anonymous Functions 127 Reduce 128 Try It Out: Working with Reduce 128 Map: Short-Circuiting Loops 129 Try It Out: Use Map 129 Decisions within Lists—List Comprehension 130 Generating Lists for Loops 131 Try It Out: Examining an xrange Object 132 Special String Substitution Using Dictionaries 133 Try It Out: String Formatting with Dictionaries 133 Featured Modules 134 Getopt—Getting Options from the Command Line 134 Using More Than One Process 137 Threads—Doing Many Things in the Same Process 139 Storing Passwords 140 Summary 141 Exercises 142 Chapter 10: Building a Module 143 Exploring Modules 143 Importing Modules 145 Finding Modules 145 Digging through Modules 146 Creating Modules and Packages 150 Try It Out: Creating a Module with Functions 150 Working with Classes 151 Defining Object-Oriented Programming 151 Creating Classes 151 Try It Out: Creating a Meal Class 152 Extending Existing Classes 153 02_596543 ftoc.qxd 6/29/05 10:55 PM Page xvi
Table of Contents Table of Contents ................................................................................................................................................. 4 Overview ................................................................................................................................................................. 8 Consensus Guidance ....................................................................................................................................... 8 Intended Audience .......................................................................................................................................... 8 Acknowledgements ........................................................................................................................................ 9 Typographic Conventions .......................................................................................................................... 10 Configuration Levels ................................................................................................................................... 10 Level-I Benchmark settings/actions ................................................................................................. 10 Level-II Benchmark settings/actions................................................................................................ 10 Scoring Status ................................................................................................................................................ 10 Scorable ....................................................................................................................................................... 10 Not Scorable .............................................................................................................................................. 11 Identification Table ..................................................................................................................................... 11 Assumptions and Recommendations .................................................................................................... 11 OS Platform ................................................................................................................................................ 11 System State .............................................................................................................................................. 11 Test Actions ............................................................................................................................................... 11 Shell Environment ................................................................................................................................... 12 Order of Operations ................................................................................................................................ 12 Backup Key Files ...................................................................................................................................... 12 Create /opt/CIS Directory (optional) .......................................................................................... 12 Benchmark Items .............................................................................................................................................. 13 1. Install Updates, Patches and Additional Software ....................................................................... 13 1.1 Use the Latest OS Release .............................................................................................................. 13 1.2 Apply Latest OS Patches ................................................................................................................. 14 1.3 Install Solaris Encryption Kit ....................................................................................................... 15 2. Restrict Services ....................................................................................................................................... 17 2.1 Establish a Secure Baseline .......................................................................................................... 17 2.2 Disable Unnecessary Local Services .......................................................................................... 18 2.2.1 Disable Local CDE ToolTalk Database Server ............................................................... 19 2.2.2 Disable Local CDE Calendar Manager .............................................................................. 19 2.2.3 Disable Local Graphical Login Environment ................................................................. 20 2.2.4 Disable Local sendmail Service .......................................................................................... 21 2.2.5 Disable Local Web Console .................................................................................................. 22 2.2.6 Disable Local WBEM ............................................................................................................... 22 2.2.7 Disable Local BSD Print Protocol Adapter ..................................................................... 23 2.3 Disable Other Services .................................................................................................................... 24 2.3.1 Disable RPC Encryption Key ................................................................................................ 24 2.3.2 Disable NIS Server Daemons ............................................................................................... 25 2.3.3 Disable NIS Client Daemons................................................................................................. 26 2.3.4 Disable NIS+ Daemons ........................................................................................................... 26 2.3.5 Disable LDAP Cache Manager ............................................................................................. 27 2.3.6 Disable Kerberos TGT Expiration Warning ................................................................... 28 2.3.7 Disable Generic Security Services (GSS) Daemons ..................................................... 28 2.3.8 Disable Volume Manager ...................................................................................................... 29 2.3.9 Disable Samba Support .......................................................................................................... 30 2.3.10 Disable automount Daemon......................................................................................... 31 2.3.11 Disable Apache Services ................................................................................................... 32 2.3.12 Disable Solaris Volume Manager Services ................................................................. 33 2.3.13 Disable Solaris Volume Manager GUI .......................................................................... 34 2.3.14 Disable Local RPC Port Mapping Service ................................................................... 35 2.4 Configure TCP Wrappers ............................................................................................................... 36 3. Kernel Tuning ........................................................................................................................................... 38 3.1 Restrict Core Dumps to Protected Directory ......................................................................... 38 3.2 Enable Stack Protection ................................................................................................................. 39 3.3 Enable Strong TCP Sequence Number Generation .............................................................. 40 3.4 Modify Network Parameters ........................................................................................................ 41 3.4.1 Disable Source Packet Forwarding ................................................................................... 44 3.4.2 Disable Broadcast Packet Forwarding............................................................................. 45 3.4.3 Disable Response to ICMP Timestamp Requests ........................................................ 46 3.4.4 Disable Response to ICMP Broadcast Timestamp Requests ................................... 47 3.4.5 Disable Response to ICMP Netmask Requests ............................................................. 48 3.4.6 Disable ICMPv6 Redirect Messages .................................................................................. 50 3.4.7 Disable Response to Broadcast ICMPv4 Echo Request ............................................. 51 3.4.8 Disable Response to Multicast Echo Request ............................................................... 52 3.4.9 Set Interval for Scanning IRE_CACHE .............................................................................. 53 3.4.10 Ignore ICMP Redirect Messages .................................................................................... 55 3.4.11 Set Strict Multihoming ....................................................................................................... 56 3.4.12 Disable ICMPv4 Redirect Messages .............................................................................. 57 3.4.13 Set ARP Cleanup Interval .................................................................................................. 59 3.4.14 Disable TCP Reverse IP Source Routing ..................................................................... 60 Set Maximum Number of Half-open TCP Connections ...................................................... 61 3.4.15 ............................................................................................................................................................ 61 3.4.16 Set Maximum Number of Incoming Connections.................................................... 62 3.4.17 Lock down dtspcd(8) ................................................................................................... 64 3.5 Disable Network Routing .............................................................................................................. 65 4. Logging ........................................................................................................................................................ 66 4.1 Enable inetd Connection Logging ............................................................................................... 66 4.2 Enable FTP daemon Logging ........................................................................................................ 67 4.3 Enable Debug Level Daemon Logging ...................................................................................... 68 4.4 Capture syslog AUTH Messages.............................................................................................. 69 4.5 Enable Login Records ..................................................................................................................... 70 4.6 Capture All Failed Login Attempts ............................................................................................. 71 4.7 Enable cron Logging ........................................................................................................................ 71 4.8 Enable System Accounting ............................................................................................................ 72 4.9 Enable Kernel Level Auditing ...................................................................................................... 73 5. File/Directory Permissions/Access .................................................................................................. 76 5.1 Set daemon umask ........................................................................................................................... 76 5.2 Restrict Set-UID on User Mounted Devices ............................................................................ 77 5.3 Set Sticky Bit on World Writable Directories ........................................................................ 78 6. System Access, Authentication, and Authorization ..................................................................... 79 6.1 Disable login: Prompts on Serial Ports ............................................................................... 79 6.2 Disable "nobody" Access for RPC Encryption Key Storage Service .............................. 80 6.3 Configure SSH.................................................................................................................................... 80 6.3.1 Set SSH Protocol to 2 .............................................................................................................. 81 6.3.2 Disable SSH X11Forwarding ................................................................................................ 82 6.3.3 Set SSH MaxAuthTries to 3 ................................................................................................... 83 6.3.4 Set SSH MaxAuthTriesLog to 0 ........................................................................................... 84 6.3.5 Set SSH IgnoreRhosts to yes ................................................................................................ 85 6.3.6 Set SSH RhostsAuthentication to no ................................................................................. 86 6.3.7 Set SSH RhostsRSAAuthentication to no......................................................................... 87 6.3.8 Disable SSH root login ............................................................................................................ 87 6.3.9 Set SSH PermitEmptyPasswords to no ............................................................................ 88 6.3.10 Set SSH Banner ..................................................................................................................... 89 6.4 Disable .rhosts Support in /etc/pam.conf ............................................................................... 90 6.5 Restrict FTP Use ............................................................................................................................... 91 6.6 Set Delay between Failed Login Attempts to 4 ..................................................................... 92 6.7 Set Default Screen Lock for CDE Users ..................................................................................... 93 6.8 Set Default Screen Lock for GNOME Users ............................................................................. 94 6.9 Restrict at/cron to Authorized Users ....................................................................................... 95 6.10 Restrict root Login to System Console .............................................................................. 96 6.11 Set Retry Limit for Account Lockout ..................................................................................... 97 6.12 Set EEPROM Security Mode and Log Failed Access ........................................................ 98 6.13 Secure the GRUB Menu ............................................................................................................ 100 7. User Accounts and Environment ...................................................................................................... 101 7.1 Disable System Accounts ............................................................................................................. 101 7.2 Set Password Expiration Parameters on Active Accounts ............................................. 103 7.3 Set Strong Password Creation Policies .................................................................................. 104 7.4 Set Default Group for root Account ...................................................................................... 106 7.5 Change Home Directory for root Account ........................................................................ 107 7.6 Set Default umask for Users ....................................................................................................... 108 7.7 Set Default umask for FTP Users .............................................................................................. 109 7.8 Set "mesg n" as Default for All Users ....................................................................................... 110 7.9 Lock Inactive User Accounts ...................................................................................................... 111 8. Warning Banners ................................................................................................................................... 112 8.1 Create Warnings for Standard Login Services..................................................................... 113 8.2 Create Warning Banner for CDE Users .................................................................................. 114 8.3 Create Warning Banner for GNOME Users ........................................................................... 115 8.4 Create Warning Banner for FTP daemon .............................................................................. 116 8.5 Check Banner Setting for telnet is Null ............................................................................. 117 9. System Maintenance ............................................................................................................................. 117 9.1 Check for Remote Consoles ........................................................................................................ 118 9.2 Verify System File Permissions ................................................................................................. 118 9.3 Ensure Password Fields are Not Empty ................................................................................ 119 9.4 Verify No Legacy “+” Entries Exist in passwd, shadow, and group Files ............. 120 9.5 Verify No UID 0 Accounts Exist Other than root ................................................................ 120 9.6 Ensure root PATH Integrity ........................................................................................................ 121 9.7 Check Permissions on User Home Directories .................................................................... 122 9.8 Check User Dot File Permissions .............................................................................................. 123 9.9 Check Permissions on User .netrc Files ............................................................................ 124 9.10 Check for Presence of User .rhosts Files............................................................................ 125 9.11 Check Groups in /etc/passwd ............................................................................................... 126 9.12 Check That Users Are Assigned Home Directories ....................................................... 127 9.13 Check That Defined Home Directories Exist .................................................................... 128 9.14 Check User Home Directory Ownership ........................................................................... 130 9.15 Check for Duplicate UIDs ......................................................................................................... 131 9.16 Check for Duplicate GIDs ......................................................................................................... 132 9.17 Check That Reserved UIDs Are Assigned to System Accounts ................................. 132 9.18 Check for Duplicate User Names .......................................................................................... 133 9.19 Check for Duplicate Group Names ....................................................................................... 134 9.20 Check for Presence of User .netrc Files .............................................................................. 135 9.21 Check for Presence of User .forward Files ........................................................................ 136 9.22 Find World Writable Files ....................................................................................................... 137 9.23 Find SUID/SGID System Executables ................................................................................. 137 9.24 Find Un-owned Files and Directories ................................................................................. 138 9.25 Find Files and Directories with Extended Attributes ................................................... 139 Appendix A: File Backup Script .................................................................................................................. 141 Appendix B: Service Manifest for /lib/svc/method/cis_netconfig.sh ........................................ 142 Appendix C: Additional Security Notes .................................................................................................. 144 SN.1 Enable process accounting at boot time ............................................................................ 144 SN.2 Use full path names in /etc/dfs/dfstab file ...................................................................... 145 SN.3 Restrict access to power management functions .......................................................... 145 SN.4 Restrict access to sys-suspend feature .............................................................................. 146 SN.5 Create symlinks for dangerous files .................................................................................... 147 SN.7 Remove Support for Internet Services (inetd) ............................................................... 148 Appendix D: Application Notes ................................................................................................................... 150 AN.1 Samba: Enable SSH Port Forwarding in Web Admin Tool ......................................... 150 AN.2 Samba: Set Secure Permissions on smb.conf File...................................................... 150 AN.3 Samba: Set Group Ownership of smb.conf File .......................................................... 151 AN.4 Samba: Set Secure Permissions on smbpasswd File ................................................... 152 AN.5 Samba: Set Group Ownership of smbpasswd File ....................................................... 152 AN.6 Samba: Set Secure smb.conf File Options ......................................................................... 153 AN.7 sendmail: Set Secure Logfile Ownership to the root User ....................................... 154 AN.8 sendmail: Set Secure Permissions on Log File ................................................................ 154 Appendix E: References ................................................................................................................................ 156 Appendix F: Change History ........................................................................................................................ 159

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧