免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 27336 | 回复: 23
打印 上一主题 下一主题

贡献去年在论坛粘贴的资料,138页的WORD。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-01-24 15:44 |只看该作者 |倒序浏览
1.查看路由   netstat –r         
增加路由  
# route add -net 10.0.0.0 192.9.200.70
add net 10.0.0.0: gateway 192.9.200.70
# netstat -r
Routing Table:
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
192.9.200.0          dg07                  U        3    522  hme0
arpanet              192.9.200.70          UG       0      0  
224.0.0.0            dg07                  U        3      0  hme0
localhost            localhost             UH       0  10221  lo0
3.增加default 路由
# route add -net 0 192.9.200.70
add net 0: gateway 192.9.200.70
# netstat -r

Routing Table:
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
192.9.200.0          dg07                  U        3    523  hme0
arpanet              192.9.200.70          UG       0      0  
224.0.0.0            dg07                  U        3      0  hme0
default              192.9.200.70          UG       0      0  
localhost            localhost             UH       0  10221  lo0

看网卡的速度和半/全双工模式
# more messages* | grep Link
Sep  3 10:48:46 dns hme: [ID 517527 kern.info] SUNW,hme0 :   100 Mbps Full-Duple
x Link Up
Sep  3 21:25:36 dns hme: [ID 517527 kern.info] SUNW,hme0 :   100 Mbps Full-Duple
x Link Up
Sep  5 15:27:55 dns hme: [ID 517527 kern.info] SUNW,hme0 :   100 Mbps Full-Duple
x Link Up
Sep  6 08:16:30 dns hme: [ID 517527 kern.info] SUNW,hme0 :   100 Mbps Full-Duple
x Link Up
# more /var/adm/messages* | grep Link
Aug 23 18:13:37 bj140 hme: [ID 517527 kern.info] SUNW,hme0 :   100 Mbps Full-Duplex Link Up
# ndd /dev/hme link_speed  输出结果可能是0或1 代表什么还得查找。

2002年9月28日星期六
BLADE2000原来是两块PGX64显示卡,更换成EXPERT 3D卡。关机,换卡,启动,boot –r完成之后,只能进命令行,提示启动X在屏幕0出错。
查资料,从SUN网站查到SOLARIS安装盘里面相关的EXPERT 3D的包,然后从安装光盘拷贝到SUN上,执行安装,然后boot –r就OK。

方法1  临时改变
uname -S
hosname newname
方法2 永久改变
   /usr/sbin/sys-unconfig命令 相应更改的还有NISe,时区,IP地址,子网掩码,超级口令等。
方法3 编辑文件
/etc/nodename
/etc/inet/hosts
/hostname.hme0 (或类似文件)
/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/inet/ipnodes (这个文件没有的话就别动)

/usr/platform/sun4u/sbin/prtdiag -v

usr/bin/showrev [-p] -p显示已安装的补丁
/usr/sbin/prtconf
/usr/sbin/psrinfo -v
iostat -E
/usr/platform/platform-name/sbin/eeprom
sysdef
dmesg
nfsstat –m
ifconfig -a
env
uname -a
netstat –rn
share
isainfo
prstat
vmstat
psrinfo
prtconf


chroot   ??????

想建一帐户,登录进去后自动shutdown/halt,这样就可以不把root的passwd告诉
> >; 每个使用者了。请问有无可能,如何做? OS是Solaris2.4。
> >;   多谢!
> 建一个用户,将其shell设为关机命令。为了安全,这个用户的UID最好不要
> 设成0。
> 关机命令可以自己编写:
> 用root帐号登录(!!!!),编以下一个文件:
> #include <stdio.h>;
> main()
> {
>      int tmp;
>      tmp = setuid(0);
>      if (tmp) {
>         shell("/etc/shutdown -g0 -y";

           ^-----对不起,这儿应该是system

>      }
>      else
>         fprintf(stderr, "Setuid Failure!\n";
> }
> 然后编译,比方说执行文件为shut
> 最后,利用chmod修改这个命令的属性:
> chmod shut a+s
> 在建用户时,shell指向这个shut就行了。

编辑/etc/passwd加入
shut::0:1::/:/etc/halt
/etc/group加入
shut::::::::

没什么,这样的话它们必须配置在非一个网段内才能同时正常工作。
你看到的mac地址是主机的。如果想用网卡自己的mac地址
setenv local-mac-address? True

怎样让系统的消息不在控制台显示?
修改/etc/syslog.conf
        改/etc/default/su
去掉root远程登录的提示
注掉有dev/sysmsg和*的行,就ok
谢谢大家
Multi-Booting Windows 98, Linux, and SolarisTM
Brian Gollsneider
I really enjoyed Brian Wilson's article, "Using VMware as a Development Tool," in Sys Admin (March 2001). Wilson described using VMware to emulate a Windows machine running on top of a Linux box but, rephrasing his theme, it is also a technique for getting more out of your hardware. You might wonder why bother -- hardware is so cheap that you can go out and get another box for peanuts. As I write this, I find ads selling complete systems for $800, 256 MB RAM for $80, and a 30-GB hard drive for $60. It's true that hardware is dirt cheap, but I find that my most limiting factor is not dollars but space. I run out of desk space before I run out of dollars to buy machines. So, to get more out of my hardware, I use the old Linux technique of multi-booting. Sometimes you just need the native OS, or sometimes the hardware you're working with is too underpowered to handle the overhead that an emulator/virtual machine adds. In this article, I present a formula to quickly set a machine to boot Windows 98, Linux, and Intel Solaris at no cost beyond the operating systems.
Multi-booting means that you can select which operating system to run when the computer is booting up. You can access one OS at a particular time, play computer games, and then reboot into a different OS. Most OSs have some form of a boot loader, and I use Linux's LILO most of the time because of its power and flexibility. For this article, I assume that the reader can do customized installations of Windows 98, Linux, and Intel Solaris. Here are the baseline requirements for hardware -- whatever is compatible with the three OSs, CD-ROM, floppy, and 6+ GB hard drive that hasn't been partitioned. If the disk has been partitioned, you will have to follow the spirit of the various steps and make adjustments as necessary. For software, I used Windows 98, Red Hat 6.2, and Intel Solaris 8, 6/00. I have used the formula below to set up many machines to triple-boot, but there can be differences depending on how completely the hardware is supported by Solaris. Also, this is my way of doing it. There are probably others, and I welcome hearing about other techniques. The cardinal rule when doing any kind of disk partitioning is to back up your data first.
Quick summary of steps:
1. Install Windows.
2. Install Linux in an extended partition.
3. Install Solaris.
4. Fix LILO.
I'll go through the formula below and explain at the end why some of the steps are done this way. The crux of the problem is that Solaris really slices up a hard drive during installation, leaving it in a state that Linux can't handle. Using this formula, I've set up triple-boot machines in less than six hours.
Disk Partitioning 101
There are some basic things to know about how a hard drive can be partitioned, which means dividing it into different areas. Always back up your data before doing any partitioning. Each OS has a tool to partition a hard drive. Windows, Linux, and Solaris all have a tool called fdisk, although they have different capabilities and interfaces. Use the fdisk tool from the particular OS you're installing. Windows can have a primary partition and an extended partition. The extended partition can be sliced up further into smaller logical partitions. The primary partition on the first hard drive will become c:, and the other partitions will pick up drive letters according to Windows rules.
Many versions of Linux, except for the newest ones, and Solaris must have a boot partition that is below the 1023th cylinder on the hard drive. The fdisk from Linux can set up four primary partitions or three primary and one extended. Like Windows, the extended partition can be further divided. The master IDE drive on the first channel is hda. Solaris requires a primary partition during installation that it will divide into two primaries. The first partition can be divided up into slices 0 through 7, with 2 being the overlap slice that shouldn't be modified by the user. Both Linux and Solaris have very powerful fdisk tools and can specify what type each partition will be. They can even say that a partition will be for Windows.
Formula
Step 1: Installing Windows
Do a regular Windows 98 installation according to the manual. Consider the 1023 cylinder limitations for the boot manager when you are partitioning the hard drive so don't make it too big. Since the hard drive has no partitions on it, the first time you boot it up, you will run fdisk, specify a partition, and exit fdisk. You will have to reboot, then format your partition by typing format c:, and then run the Windows setup program. Windows will be on partition 1.
Step 2: Installing Linux
Further partition the hard drive. Set up the extended partition on partition 4, dividing it as you desire for the Linux installation. You need at least two logical partitions, one for / and a swap partition. Many people set up several more, /home being the most common. Do the install. Make a floppy boot disk (this is critical). You will use the boot floppy in a later step to reestablish LILO. My habit is to install Linux at the high end of the hard drive so that after the installations are complete, the partitions are in numerical order according to the cylinders. A better reason for doing this is so you can modify Linux to live above cylinder 1023. Solaris can't do that, so I put it lower on the hard drive. For this article, I assume you're using two partititions: / in 5, swap in 6.
Step 2a: Modifying Linux
Some files on Linux need to be modified before we can move onto the Solaris install. First, modify /etc/lilo.conf as root. Change the line with /dev/hda5 in it for booting Linux to /dev/hda9. See Listing 1 for a sample /etc/lilo.conf file. Next, modify /etc/fstab. The line for hda5 needs to become hda9 and the swap line from hda6 to hda10. Listing 2 shows a modified /etc/fstab file. These changes are because of the way Solaris will install. Finally, trust me on this next part. Run fdisk /dev/hda and delete the extended partition, which will also delete your / and swap partitions. This is because of the way Solaris will install. We will re-establish these partitions later, so you won't lose any data. Make sure that you record the exact start and stop cylinders of the / and swap partitions. If done correctly, the only partition visible on the hard drive right now is Windows in partition 1.
Step 3: Installing Solaris 8
Put in the Solaris installation media and boot. The Solaris installation sequence should come right up. Run fdisk to establish partition 2 for Solaris. A catch in this step is the boundary cylinders on the hard drive. Give yourself a couple of cylinders buffer between the end of the your Windows partition and where you start the Solaris partition. Also allow some buffer between the end of your Solaris partition and the start of your Linux partition. I use a rule of thumb of two cylinders on each side. If you don't add this buffer, your installation will fail. Install what you want on partition 2. Note that Solaris will divide partition 2 into partitions 2 and 3 during the install. Late in the install process, you will have a chance to look at the filesystem layout. Partition 2 will be sliced up into / in s0, swap in s1, overlap will be in s2, and /export/home in s7. These four slices are the reason that in Step 2a we added four to several lines. After the Solaris install, Linux will see hda5 as hda9. If you use more than four slices in Solaris, you will have to modify Step 2a as appropriate. Reboot. Study Listing 3 to see what the partition table looks like after the Solaris installation, especially the cylinder buffers around the Solaris partitions.
Step 4: Boot Manager
Now you have three operating systems on your computer, but you can only access Windows and Solaris. We'll fix this by configuring LILO to give you all three. First, start a Linux install again and bring it to the point of partitioning the hard drive. Use fdisk and re-establish the partitions you previously deleted. Make sure you put the exact cylinder numbers in. You will probably have an option to use disk druid but use fdisk. Disk druid is a friendly disk partitioner, but it doesn't give you the cylinder control you need right now. You will see several messages about partitions having different logical and physical beginnings. This doesn't matter to us. Save the updated disk partitions and reboot using the boot floppy you made. Type linux root=/dev/hda9 at the LILO: prompt and log in. Edit /etc/lilo.conf, adding the lines other=/dev/hda3 and label=solaris to the end of it. Then run LILO using a special option: lilo -P ignore. The -P ignore option tells LILO to ignore any partition tables that it considers corrupt, which we have because of Solaris.
Using Your Triple-Boot Machine
Now you have a machine that can run Windows, Linux, and Solaris. When you turn it on, you will see the normal BIOS prompts and finally get a prompt LILO:. If you hit the tab key quickly, you will see the different operating systems available. Type in which one you want, and hit enter. The machine will then boot as if that OS is the only one on the machine. You will have to reboot to get to a different one. Still, this approach gives you three machines in the space of one, and it is free. You have only used tools that were part of the various operating systems.
Many of the steps may look like the ravings of a madman, but once you understand the impact of the various operating systems, especially Solaris, they make more sense. It's easy to set up a system to dual boot. Windows and Linux or Windows and Solaris set up easily, provided the hardware is supported. The hard part is when you want to combine Linux and Solaris 8. As a historical note, I've been setting up machines to triple boot for years. With Solaris 7, it was easier in some regards. Linux didn't give the error messages that you see working with Solaris 8, and it stayed in one primary partition. The biggest catch was that a native Solaris partition looks like a swap partition to Linux. This normally isn't a problem, but with Red Hat 6.2 and some other distributions, you have no control over which swap space is used.  
The Linux install will reformat any swap partition it finds. This means that your Solaris distribution is gone and is being used as a Linux swap space, so I hope you have a backup. With Solaris 2.7, I would install Windows, then Solaris, and then Linux. During the Linux install, I would change the partition type of Solaris to something like FAT32 and complete the install. That way, the Linux installation would leave that fake Windows partition containing Solaris alone. After I finished and rebooted, I would change it back and set up LILO to boot the three systems. Solaris 8 invalidates this trick. If you change anything about the Solaris partitions using fdisk, you mess up Solaris' boot signature and it won't come up. As a sidenote, this last statement might not be totally true. I've used Linux's fdisk to manage the partitions. Some versions of Linux also have cfdisk and sfdisk. These are more powerful and also harder to use partitioning tools. These tools might be able to reslice the partition so that Solaris still works. Since they aren't universal, I didn't explore using them. Also, Linux can't install on a disk with the type of cylinder boundary problems that Solaris 8 creates. In other words, Solaris can't be installed before Linux.
Another new catch with Solaris 8 is that it requires two partitions on the hard drive. Remember that in this setup, partition 1 is Windows, and I specified that 4 be set up as an extended partition for Linux. There can only be four partitions, so this scheme leaves 2 and 3 for Solaris. Set it up for 2, and during the install it will add 3. Summarizing, partition 1 is Windows, 2 and 3 are Solaris, and partition 4 is extended and subdivided into logical partitions for Linux. All of these are below cylinder 1023 unless your Linux distribution can overcome this problem. Finally, remember the way that Solaris subdivides partition 2 internally. This means that some boot files need to be modified by the number of slices you set up during the Solaris installation. But, when you're using fdisk, you see those Solaris slices as one partition. It's a little confusing, but you can keep track of it by remembering the way the boot process works.
Alternatives
I've also done this basic procedure on a system with two hard drives, and it's considerably simpler. I put Linux on the second hard drive by itself and tweaked the procedure. First, put Windows in partition 1 on the first drive and Solaris in partition 2, which will become 2 and 3. Then, put Linux on hdb. Since you're not going to install Linux on hda, you don't have to worry about the problematic partition table.
Conclusion
The procedure I've described will result in a machine that can boot into three different operating systems. This can save you considerable desk space in the office or a lot of weight if you're on the road. The procedure is fairly complicated but doesn't cost anything. Be careful, because messing up a step can mean that you have to back up several steps or start from the beginning to recover. Always back up your data before trying anything like this.
Brian Gollsneider is working on a PhD in Electrophysics at the University of Maryland, College Park. He can be reached at: gollsneb@glue.umd.edu.
Measuring and Improving Memory Efficiency of Large Applications
Greg Nakhimovsky
Many of today's computer applications require large amounts of system memory. This is especially true with very large and complex applications that provide hundreds of functionalities and handle large amounts of data.
At the same time, computer CPU speeds have increased faster than memory access speeds, so the gap between them is now very wide. This makes memory efficiency issues increasingly more important. This article describes how a large application uses system memory and what you can do to monitor and improve its memory efficiency. It presents and discusses special tools for these tasks. This information and tools can help systems administrators, software developers, and users who are working with large applications, particularly under the Solaris operating system. In this article, I will consider an example of using PTC Pro/ENGINEER (a major Mechanical CAD/CAM system) under SPARC/Solaris from Sun Microsystems. See http://www.ptc.com for more information about PTC and Pro/ENGINEER, and http://www.sun.com/ \
tecnical-computing/ISV/PTCFaq.html for a technical FAQ regarding PTC applications on Sun. Note that Pro/ENGINEER is just a convenient example of using these techniques. You can use them just as easily with any large application that requires a lot of memory.
Memory efficiency is a very large subject, impossible to address comprehensively in a single article. Because of that, this article only touches on some issues while describing a few specific tools in detail.
Memory Access Speed
Modern computers have a hierarchy of memory types. A very small portion of memory called Level-1 or L1 cache (also called CPU-internal cache) provides very fast data access. A larger portion called L2 cache (also known as external cache) provides somewhat slower memory access but still much faster than that of general RAM without using a cache. The faster the memory type, the more expensive and less practical it is to use. This is one of the fundamental tradeoffs of computer architecture.
Here are typical orders of magnitude of memory access times and sizes of the major memory components. These values are generic and they change rapidly as computers become faster but their ratios stay relatively constant:

               Latency (nanoseconds)    Size (kilobytes)
            
L1-cache              3                      32
L2-cache              30                     4096
RAM                   300                    500,000
Disk                  30,000,000             10,000,000
As you can see, memory efficiency can be hugely different depending on how much the application uses the faster memory components and avoids the slower ones.
The first practical conclusion from this data is that disk access as a substitute for memory access should be avoided in any performance-sensitive situation. High Performance Computing, Second Edition, by Kevin Dowd and Charles Severance (O'Reilly and Associates) is an excellent further resource regarding memory access speed and related issues.
Pro/ENGINEER Use of Memory
Unlike older applications that explicitly use disks for some of their storage requirements, Pro/ENGINEER keeps all model data directly in memory. It assumes that the system has enough memory for all needs. This approach relies on the OS virtual memory (VM) system. All modern operating systems contain page-demand VM systems. The main advantage of such a system is that memory available to applications is not limited to random access memory (RAM); disk swap space can also be used. The application or the users do not have to do anything special about using it: the OS handles it automatically.
The main disadvantage of using the VM system is that, if memory requirements significantly exceed the available RAM, system performance will degrade. As application memory requirements start exceeding the amount of physical memory available in the system, paging to disk will begin. This causes rapid performance degradation because, as you saw in the previous section, disk access is many orders of magnitude slower than memory access of any kind.
Eventually, if the application requires much more memory than the available physical memory, so-called "thrashing" may occur, which makes the system practically impossible to use. For detailed descriptions of the Solaris VM system and other system-related information, see Sun Performance and Tuning: Java and the Internet by Adrian Cockcroft and Richard Pettit (Prentice Hall) and Solaris Internals: Architecture, Tips and Techniques, Volume 1: Core Kernel by Richard McDougall and Jim Mauro (to be published by Prentice Hall). McDougall and Mauro's columns are also available online at SunWorld (http://www.sunworld.com).
Pro/ENGINEER is a large application with the following features (from the memory efficiency perspective):
·        The use of the malloc() interface to obtain all required memory from the system. Most applications use this method, although other methods exist (mmap-based for example). C++ operator "new" also belongs to this category since most implementations of "new" call malloc() internally.
·        Highly dynamic memory usage. In other words, the amount of memory a Pro/ENGINEER session requires is highly dependent upon the size of the model and the operations performed on it.
·        Large amounts of memory required for large models. Pro/ENGINEER memory consumption can vary from about 50 megabytes to a number of gigabytes, up to the total amount of swap space (RAM plus disk swap) available in the system.
·        Very large and complex dynamically allocated data structures, many of which are scattered over memory. One reason for this is that Pro/ENGINEER data structures represent 3-D objects, while the operating system virtual address space model is linear (1-D). This makes it necessary to map the 3-D data to the one-dimensional virtual address space. Such a mapping introduces gaps between addresses of data items that may logically be closely related.
·        Very complex memory access patterns, in some cases approaching random access. There are some objective reasons for this. For example, certain algorithms used in mechanical CAD systems (Hidden Line Removal is one such algorithm) require examining a data item (say, Z-coordinate) for all existing entities, such as triangles tessellating the surfaces. The data structures containing the needed data items can be stored in memory far from each other. This can easily cause poor "locality of reference."
·        Extensive use of function pointers, causing frequent address jumps in referencing the program code. This is typical for modern object-oriented applications. For example, C++ virtual functions are usually implemented with function pointers.
Taken together, these features mean that the CPU caches described in the previous section are not very effective with Pro/ENGINEER. A cache is only useful when many data items or program instructions can be accessed directly from the cache. When data access is almost random with large gaps between addresses, caches cannot help much. In this case, performance will often depend on raw memory latency, that is the time it takes to access RAM without the benefit of a cache.
SPARC/Solaris allows a full 4-GB virtual address space for 32-bit applications, and practically unlimited virtual address space size for 64-bit applications. See details at:
http://www.sun.com/technical-computing/ISV/PTCFaq.html#MORETHAN2G
Current Sun workstations (e.g., Ultra-80) can hold up to 4 GB of RAM, thus making large memory requirements practical. Future workstation models will be capable of holding even more RAM.
One example is the PTC Division MockUp application, which is supported in the 64-bit mode on Sun. It can handle huge assemblies by taking full advantage of the large amounts of RAM and virtual address space in the system.
Uniprocessor and Multiprocessor Systems
Currently, the most popular multiprocessing model is Symmetric Multi-Processing (SMP). All Sun workstations and servers use it. Briefly, SMP means that CPUs installed in the computer have equal status; all of them can equally execute both application and kernel code. Every CPU has its own hardware cache. Any CPU can access any data that the applications use. Such access can be performed in parallel. When the application modifies data, the MP hardware ensures that all CPUs see the same data values. This feature is called "cache coherency".
To take advantage of the multiple CPUs in the same machine, you can run multiple applications at the same time. In this case, the kernel will automatically distribute the load among CPUs. Alternatively, a single application can create multiple threads running in parallel, thus taking advantage of multiple CPUs.
Pro/ENGINEER is partially multithreaded, which means that certain operations can be performed in parallel when multiple CPUs are available. A brief description of the MP/MT features of Pro/ENGINEER is available at:
http://www.sun.com/technical-computing/ISV/PTCFaq.html#MP
On Sun systems, Pro/ENGINEER is statically linked with a special malloc() package allowing faster memory allocation when multiple threads manage their memory simultaneously. Sun Microsystems owns a patent for this technology ("Memory Allocation in a Multithreaded Environment", by Greg Nakhimovsky, http://www.uspto.gov).
Measuring Memory Used by Application
Knowing how much memory an application session has consumed can be useful in many ways. It can help you determine whether adding more RAM will help performance, or the amount of available physical memory can be decreased without a negative effect on performance. It can be useful for workload management tasks required for distributed computing. You can also use this information to detect abnormal situations, for example, when the application is consuming too much memory.
This task is generally not trivial since today's operating systems, including Solaris, are very complex. The naive methods frequently used for this purpose do not work well. Examples include ps(1), swap(1), and vmstat(1) commands. For various reasons, none of those commands report the total memory consumption of a particular application. For example, the ps(1) SZ (size) field will report the amount of virtual memory, but not the actual memory consumed. The RSS (resident set size) field will include the memory occupied by the shared libraries, which many processes can use simultaneously.
It is not impossible however. Solaris has a very useful pmap(1) command based on the proc(4) interface. Here is a description of a couple of tools based on pmap(1) technology, which you can use with most applications, not just Pro/ENGINEER.
The readers who are not programmatically inclined can skip all the details given here, download the tools, and simply use them. These tools, with the exception of pmap(1), are not officially supported by Sun Microsystems. They are informal example programs and anyone is welcome to use them or modify them. They also demonstrate a few useful programming techniques.
The first tool is a shared library interposer called mem_on_exit.so. Listing 1 contains its source code. To build this interposer, use the following command:
cc -o mem_on_exit.so -G -Kpic mem_on_exit.c
To use it (from a Pro/ENGINEER startup script, for example) do the following (we are using the C-shell syntax in this example):
setenv LD_PRELOAD /full_path/mem_on_exit.so
[ Run Pro/ENGINEER as usual ]
unsetenv LD_PRELOAD
Shared library interposers are programs capable of intercepting calls the application makes to any shared library. Once such a call is intercepted, the interposer can do whatever you need, and then call the real function originally intended by the application.
Library interposers are very useful for all kinds of debugging, testing, and collection of runtime data statistics. They can even be used to fix bugs by modifying the behavior of the interposed function. They can do all this without rebuilding the application in any way.
In this case, the library can interpose on system call exit(2), which most applications (including Pro/ENGINEER) invoke at the end of the run to exit to the operating system. First, it can determine the name of the executable that made the call. The library can use Solaris proc(4) interface for it. (Note: the version of the proc(4) interface shown here works with Solaris 2.6 and later.) Pro/ENGINEER main executable is called "pro". So if the current executable is called "pro", the library can call system(3S) invoking a Perl script called measure_proe_mem.pl. After that is finished, call the real system exit(2) routine.
I will assume that the directory where script measure_proe_mem.pl (described later) is installed in is on the shell $PATH. Alternatively, you can put the full path to measure_proe_mem.pl in the system() call.
When the application uses malloc() to dynamically allocate memory from the system, the amount of memory that the application consumes cannot decrease while the application is running. The malloc() package contains a memory management system. When the application calls free(), the freed memory is not returned to the operating system but saved for future use by the same process. (Actually, malloc() can be written to return memory to the system, but most malloc() implementations, including Sun's, do not do it that way because it would be hard to do and unnecessary in most cases.)
Therefore, to estimate the amount of memory that the application consumes, it is enough to measure it only once, immediately before the application exits. This will provide the "high-water mark" value. The actual measurement and calculations are performed by the Perl script measure_proe_mem.pl that the library interposer invokes. Listing 2 contains its source.
Perl is a part of Solaris 8 and above, where it is automatically installed in /bin. For the earlier Solaris releases, you can download Perl from a number of locations, including:
http://sunfreeware.com
If Perl is not in /bin on your system, make sure to modify the first line in the script to point to your Perl executable.
The measure_proe_mem.pl script runs the ps(1) command to find all the running processes related to Pro/ENGINEER. It assumes that any process with an executable name containing characters "pro" or "appmgr" qualifies. (These patterns can be easily changed if necessary.)
For each process with a name matching the specified pattern, the script runs the Solaris pmap(1) command with parameter "-x" producing a detailed memory map for the process. After parsing the pmap(1) output, the script adds the amounts of private memory that each process has used, and selects the maximum amount of shared memory among the processes. We do not want to add the shared memory many times since many processes share it. We assume that the Pro/ENGINEER-related processes share most of the same libraries. The resulting value (Max shared + Total private) is a good approximation for the amount of memory this Pro/ENGINEER session has consumed. You can download both source files from the Web:
ftp://ftp.sunmde.com/pub/gregns/mem_on_exit.c
ftp://ftp.sunmde.com/pub/gregns/measure_proe_mem.pl
Typically, these tools are used together. Either individual users of Pro/ENGINEER can run them directly, or a startup script of some kind can do it. In the latter case, a systems administrator can collect various statistics regarding memory consumption. You can also use the measure_proe_mem.pl script on its own. If you execute it at any time while the application is running, it will output the results at that time.
Here is an example output from the measure_proe_mem.pl script executed while Pro/ENGINEER is running:
% measure_proe_mem.pl -v
5045 /export/home/proe2000i2/sun4_solaris/obj/pro:
virtual_kb = 378512; shared_kb = 4232; private_kb = 179512
5046 /export/home/proe2000i2/sun4_solaris/nms/nmsd:
virtual_kb = 2832; shared_kb = 1512; private_kb = 1016
5048 /export/home/proe2000i2/sun4_solaris/obj/pro_comm_msg:
virtual_kb = 4848; shared_kb = 1496; private_kb = 1552
5060 /export/home/proe2000i2/sun4_solaris/obj/pglclock:
virtual_kb = 157592; shared_kb = 4224; private_kb = 6936
Total memory consumed by all Pro/ENGINEER-related processes:
Total virtual address space = 531 MB
Max shared  = 4 MB
Total private = 185 MB
Max shared + Total private = 189 MB
You can easily modify these tools to work with applications other than Pro/ENGINEER. All you will have to do is change the names (or name patterns) of the executables, the name of the Perl script, and the output messages.
Measuring Paging to Disk
You can measure paging to disk with vmstat(1). This technique (among others) is described in:
http://www.sun.com/technical-computing/ISV/PTCFaq.html#PERFORMANCE
Look at the sr (scan rate) column in the vmstat output. When the numbers in that column are consistently zero or less than 200 pages per second, there is no significant paging to disk occurring and the amount of your physical memory is sufficient for the current session. If the scan rate is consistently high, application performance will improve if you add more RAM.
A Pro/ENGINEER startup script can start vmstat(1) in the background, capture the sr column output, and calculate some meaningful statistics. The vmstat(1) process can be terminated, for example, by a signal sent to it when the Pro/ENGINEER session ends. Developing such a script is left as an exercise for the reader.
As an alternative, you can watch for the disk activity reported for the swap device (assuming you use swap partitions rather than files). One way to do this is to run the iostat(2) command. Any significant input/output (I/O) in a swap partition is a sure sign of memory shortage.
I also recommend installing the xcpustate utility and using it to graphically monitor what your system is doing. It is a public-domain X-Windows based utility available for many UNIX platform. You can download it from:
ftp://ftp.cs.toronto.edu/pub/jdd/xcpustate
The SPARC/Solaris binary that I use (which is rather old) is available here:
ftp://ftp.sunmde.com/pub/gregns/xcpustate
To use it, simply make sure the xcpustate file is executable:
chmod +x xcpustate
and then start it putting it into background:
xcpustate &amp;
If you would like to watch the I/O state in addition to the CPU state (which is a good idea, especially for the swap devices), start it with a -disk parameter:
xcpustate -disk &amp;
The resulting display will show the state of each CPU and disk (if -disk is specified). It uses the following colors for the display:
Green       User time
Yellow      System time
Blue        Wait/idle
The xcpustate display is updated each second.
There are other graphical utilities to monitor system performance, but I like xcpustate the most for its convenience and light weight.
Measuring CPU Cache Usage
Solaris 8 has cpustat(1) and cputrack(1) utilities, which can help you measure various CPU statistics. Specifically, you can measure the number of external cache hits and misses. Here is an example of how you can use cputrack(1):
% cputrack -fev -c EC_ref,EC_hit <command>;
EC_ref refers to the total number of external cache references, while EC_hit corresponds to the total number of external cache hits. The difference between the two values will give you the number of external cache misses. The external cache miss rate can be computed as:
(1 - EC_hit/EC_ref)*100%
Similarly, to watch the instruction cache references and hits, you can use this syntax:
% cputrack -fev -c IC_ref,IC_hit <command>;
You can also concatenate multiple -c options to cputrack or cpustat. That will make the tool cycle between the specified events. The above examples are for UltraSPARC-I and UltraSPARC-II. See UltraSPARC User's Manuals (http://www.sun.com/microelectronics/manuals/index.html) for detailed information about the UltraSPARC counters.
Frederic Pariente of Sun Microsystems/France has developed an interesting utility called Hardware Activity Reporter (HAR), which computes many useful UltraSPARC CPU statistics such as L1-cache miss rate and data stall rate. See Hardware Performance Counters, Hardware Statistics Tool: http://www.sunmde.com/perf_tools/har/.
Improving Memory Efficiency
·        Using the tools described in the previous sections, measure how much memory your application uses and how much paging to disk is occurring.
·        Collect statistics about the memory consumption and paging to disk over a period of time. Configure your system with the optimal amount of RAM and disk swap amount best suited to your needs.
·        Use the cputrack or HAR tool to measure the CPU cache miss and data stall rates during specific application operations. Provide feedback to application developers, such that they can improve their algorithms and data structures to take better advantage of CPU caches. Improving locality of reference and thus increasing the number of cache hits can dramatically enhance application performance.
·        Use the application features that generate many cache misses as little as necessary.
Summary
Now that you have some memory measurement tools, you can apply them in your own environment to configure the system's hardware and provide useful feedback to the application developers. Since memory efficiency is such a large issue, its further discussion should be useful to everyone involved with large applications.
Acknowledgments
I would like to thank my Sun Microsystems colleagues Tom Gould, Morgan Herrington, Peter Nurkse, and Pramod Rustagi for their advice and encouragement.
Greg Nakhimovsky is a member of the technical staff at Sun Microsystems. He works with independent software vendors making sure that their applications run well on Sun systems. He has 20 years of industry experience developing, performance tuning, and supporting technical computer applications on various computer systems.

汉字输入加拼音声调
智能ABC下面输入v8就可以了

我的六个系统安装方法及其应用(solaris,freebsd,linux,windows98,2k,xp)
  小弟这里把自己装系统的过程及考虑的事情都写下来,另外也写了一些与这个主题无关的,有些东西很简单也提了一下,是给不太了解的朋友写的,希望对对这方面感点兴趣的朋友有点参考作用。
  我的硬盘是80G,现在装有windows系列98,2k,xp,redhat,solaris,freebsd共六个操作系统。在分区的时候就考虑到要装多系统,所以分区的时候就计划好了。
  首先,先制定出分区计划,计划我的硬盘分区如下:
Primary 1: FAT 1.8G   (label:win9
Primary 2: Solaris 8 x86 5.6G
Primary 3: Extend (剩余的全给这个扩展分区了)
Primary 4: FreeBSD 4.6G
Extend :
Reiserfs:5G redhat 系统分区
swap:300M linux交换分区
Reiserfs:4G 备用分区
FAT32   :6G 主要是装程序文件  (label:prog)
FAT32:10G(label:soft)
FAT32:10G(label:doc)
NTFS:2G(label:mydoc)
NTFS:2G win2k advance server(label:win2k)
NTFS:7G(label:server)
NTFS:5G winxp(label:winxp)
FAT32:2G(label:swap)
FAT32:14G(label:vidio)
  现在把考虑的事情说一下。
  win98主要用于系统维护,给1.8G足够了,安装win98大约需要不到400M的空间,剩余的空间用于紧急时候存储一些东西,另外也可以利用这个空间和solaris交换文件,后面另述。之所以把这个分区划为FAT,是为了以后装DOS622考虑,因为DOS622不认FAT32,而装好了98以后,如果想再装DOS6.22,完全可以把DOS6.22装在这个分区,然后修改相应的启动文件,使98和dos622双启,这方面的技术文章在网上比较容易找到,不再另述。
  把NTFS分区划在后面是为了在98和2k,xp里前面的一些分区有个统一个分区名,比如prog在三个windows系统里全是D盘,对一些应用比较方便。
  之所以划出一个2G的label为swap的fat32分区,是为了这个分区在linux下挂接为可写,可以和windows交换数据,其它fat32视情况可以挂在linux下,建议为只读,防止误操作。
  最后一个label为vedio的盘划在扩展分区的最后面,可以视情况以后用作扩展用途,或划定为其它类型的分区用,由于在扩展分区的最后,改变分区类型及大小时对前面系统影响最小。
  
  需要准备的工具有,可以光盘启动带pqmagic的盘,diskman。pqmagic用于分区,diskman用于装完一个系统后保存分区表,以备不测时可以快速恢复。下面装完一个系统就diskman一把吧,出了事再diskman 回来。关于diskman下面就不述了。
  
  首先分区,用光盘启动,进入pqmagic,按如上分区分好区,注意pqmagic不能划定solaris,freebsd及reiserfs类型的分区,在分区的时候全指定为linux native (ext2)即可,主要是为了先占个地方。
  
  安装的时候,安装顺序如下:win98,redhat,win2k,winxp,freebsd,solaris,注意这里redhat一定要作一张启动盘,稍后要用到,而且,我们把grub装到mbr里,用他来引导其它操作系统。solaris最好是最后装,因为solaris要修改硬盘分区的CHS值,装完了solaris,PQMAGIC认为硬盘参数出了错误,认不出硬盘来了。这时候启动pqmagic的时候,他会提示你是否修正,你可千万别修正,修正完了,发现硬盘就成了一个大的没分的区了,再重启可能就出事了,弄不好什么也启动不了了,我试过一次,就这一次,害我终身难忘啊,呵呵。保留改动后的CHS事实上也没什么影响,不用pqmagic不就行了,只是硬盘分区参数不规范,也不影响其它系统的启动等等,无所谓了。
  
  先装win98,不用说了.再装redhat,我的redhat7.3全安装,大约占了3G的硬盘空间。然后装win2k ,再装winxp,注意要先装win2k,再装winxp,否则winxp不能启动,最后还得把winxp的引导系统换到c盘去。
  最后装freebsd,装freebsd的时候,不要装bootloader,保留mbr不变即可。最后用红帽那张启动软盘启动红帽,执行如下命令:
cd /boot/grub
grub
grub>;root(hd0,4)
grub>;setup(hd0)
grub>;quit
这样就成功的把grub安装到mbr里面了,再修改一下grub的配置文件,即可完成多系统的启动。
vi /boot/grub/menu.lst
填加如下几行:
title DOS/Windows
rootnoverify (hd0,0)
chainloader +1
title freebsd
rootnoverify (hd0,3)
chainloader +1
删掉引导ntfs分区的那几行,保留引导红帽的那几行,OK,保存,reboot,至此未安装solaris其它五个系统便安装完成了。重启系统,首先是grub菜单,如果选windows,那么便进入windows系统的启动菜单,这个菜单是c盘的引导分区及C盘根目录下的NTDETECT.COM,ntldr,bootsect.dos,boot.ini来引导的。

然后如果不愿装solaris呢,就完事了,如果你要装solaris,就往下看,提前说好了,出事别找我,呵呵,主要是solaris毛病太多,容易出事。2000年6月版的不支持大硬盘,2002月2月版的没问题了,拿2000年6月版的,认我的硬盘认成了11G多,再往下装说什么它也不干了。如果硬盘N大,那就使2002年2月版的,而且它也支持P4
solarisx86的分区号是82,linux的native分区号是83,linux的swap分区号是82,正好和solaris的分区号一样,先装solaris再装linux容易出问题,弄不好把solaris分区当swap分区给处理一下,可就惨了,所以后装吧。
注意,下面要进行一些处理,这个处理很关键。
用光盘启动,进入pqmagic,找到准备划给solaris的那个分区,现在那个分区类型是ext2,删掉这个分区,只是删除掉,让他处于未分配状态即可,应用,退出。稍后我们说这一步为什么重要。如果后来发现win2k,winxp都启动不了,自己改一下boot.ini吧。启动不了的原因就是boot.ini文件中的这一行:multi(0)disk(0)rdisk(0)partition(13)\WINDOWS="Microsoft Windows XP Professional" /fastdetect   partition后面的参数不知道给改成几了,改成正确的即可。
下面进入solaris的安装,用software 1那张光盘启动,注意不是multilangue install那张盘,那张盘老让建个x86boot分区,而x86boot分区得在主分区里,现在主分区已经没地方了。software1不用建x86boot,直接装在一个主分区里就行了。启动系统,安装,刚删掉的那个分区安装时程序会划给solaris,到时候一看就明白了。直接一路装下去就OK了。
装完了solaris会用它的多系统引导管理器来替代mbr,也能引导win98,但是不能引导扩展分区里的东西,所以不能引导linux,那么我们还得用grub来引导。方法如上,这时候/boot/grub/menu.lst中引导solaris的代码为:
title solaris
rootnoverify(hd0,3)
chainloader +1
引导bsd的代码为
title freebsd
rootnoverify(hd0,2)
chainloader +1
细心的朋友会问,solaris不是在第二个主分区吗,应该为 rootnoverify(hd0,1)呀,怎么这里写成rootnoverify(hd0,3)了?而freebsd怎么写成rootnoverify(hd0,2)了,呵呵,这里得解释一下。(以下我没有确凿的技术证据,完全是个人的推测,不知道对不对)grub是按照在mbr里四个分区应占的格子的先后顺序来引导的,我们用pqmagic删除了原来准备划给solaris的分区,然后应用,相应的它会调整mbr里的对应参数,使extend和freebsd都向前提一个格,把四个位置中的最后一个空出来,当安装solaris的时候,它把自己的分区信息就填在这个位置上了,自成变成了四个主分区中的“最后一个”了。
如果不按照上述方面,solaris在硬盘分区表中还是第二个分区,那就坏了,linux说什么也启动不了了,不信你试试吧(可能改别的地方也可以,不过我不会现在,我已经试过很多方法了,还是不行,哪位找到方法说一声)原因是什么呢, linux在启动的时候,会识别出solaris分区中的slice,将这些也视为一个分区,例如,在我按上述方式装好后,在linux下键入“dmesg|grep hda”命令,会返回如下结果:
hda: hda1 hda2 < hda5 hda6 hda7 hda8 hda9 hda10 hda11 hda12 hda13 hda14 hda15 hda16 >; hda3 hda4
hda3: <bsd: hda17 hda18 >; hda4: <solaris: [s0] hda19 [s1] hda20 [s2] hda21 [s7] hda22 >;
如果solaris为第二个分区,那么相应的原来的红帽系统分区hda5就要变为hda9了,grub的配置菜单里怎么填,他又是怎么识别?linux的fstab里怎么填?很麻烦的,我试了好几种办法都不能协调好,linux不能正常启动,所以只好想出这个办法来了。
有的朋友会问,把solaris直接划成第四个区不就行了?呵呵,我还真想,用2002年2月版software1刚装的时候就是想把他装在BSD那里,先不用BSD了,没想到,后来提示,得在1024柱面以前,要不不往下进行了,哎,没办法呀。不过原先20G硬盘的时候用2000年6月版的装过,也是software1安装,安装在15G之后的最后一个分区里,挺正常的。具体我也搞不清,反正这样装是肯定没问题,至于1024柱面的问题,搞不清。
下面说一下solaris里面访问win98那个区的问题,用如下命令即可挂下win98的分区
mount -F pcfs /dev/dsk/c0d0p1 /mnt
这样/mnt里面的内容就是原来的win98分区了,交换数据挺方便的。
solaris下如何挂接一个ISO文件呢?不少同学网络条件挺好,从网上下载的solaris安装文件都为ISO文件形式,其实只要把software1刻成光盘,其它的仍然在windows分区里就行了。需要的时候,把那个ISO拷到win98分区里,然后启动solaris再把那个ISO挂到一个目录下就可以了,我装software2,language package,asia那几张盘的时候就是用的这个方法。
具体要用lofiadm命令,software1装好了就有这个命令,这个命令把一个ISO文件模拟成一个块设备。
假设software2安装ISO为c:\SOL_8_202_IA_2.iso,如下命令序列可完成安装过程。
进入solaris
#mount -F pcfs /dev/c0d0p1 /mnt
#lofiadm -a /mnt/SOL_8_202_IA_2.iso
/dev/lofi/1 /*这一行是上一行命令的处理结果,不是我键入的*/
#mkdir /tempiso
#mount -F hsfs -o ro /dev/lofi/1 /tempiso
#cd /tempiso
……自己安装吧,已经是ISO里面的内容了。
#umount /tempiso
#lofiadm -d /dev/lofi/1
现在就把SOL_8_202_IA_2.iso与/dev/lofi/1分离了,同上方法可以安装其它ISO,
lofiadm的具体用法请参见man lofiadm
呵呵,现在solaris就装好了。试试手吧。
在红帽下挂接windows分区,注意键入以下选项codepage=936,iocharset=gb2312或codepage=936,iocharset=cp936,否则不能正常显示中文。
当时redhat选reiserfs主要是由于宿舍的同学晚上爱看片,不过晚上到点停电,系统老没事掉电可不好玩,于是整了个reiserfs文件系统,省得文件系统容易崩溃了。
redhat7.3的内核好像不支持solaris的文件分区,挂不上,估计重新编译内核就行了。原来在蓝点2.0里面用下面的命令可以挂上solaris的分区,对于上面的grep hda的结果,用如下命令可以挂接上solaris的s7分区
mount -t ufs -o ufs=sunx86 /dev/hda22 /mnt/s7
上面的划分区的时候有一个NTFS分区server,是给vmware和virtual pc用的,在winxp里,virtualpc里装上solaris(划给32M内存),freebsd(minimal选项,划给16M内存),redhat(字符终端,划给16M内存),vmware里装上路由型linux(划给8M内存,双网卡,起网关作用),mandrake等。virtualpc不能装双网卡,vmware可以,自己组个小局域网玩吧。这个分区建议用NTFS,为什么呢,我的virtualpc里的solaris装好了,六张盘全让我塞进去了,包括GNUtools等,对应的virtualpc中的solaris的硬盘文件为4,405,129,216 字节,不过启用了NTFS的压缩功能,占用硬盘空间为:1,603,891,200 字节。FreeBSD为358,735,359 字节,占用硬盘为160,432,128 字节。类似,硬盘利用率高啦,得益于NTFS的压缩功能。
访问solaris的图形界面在winxp下装个exceed吧,省点虚处理机的资源,呵呵。

如果是小硬盘,只想装dos622,win98,solaris,建议C盘为FAT区,先装win98于C:\windows目录,然后用software1装solaris,这时候启动管理器是solaris的,开机后启动界面第一项就是win98的启动。装好了重启机器,用dos622的启动盘启动,装dos622于C盘,然后修改win98的一些配置文件即可完成双启,具体可参见下文:
http://www.lixiang.gd.cn/computer/system/Win98-dos6.22/   
这种装法我没试过,不知道dos622会不会修改C盘的引导扇区,真怕修改,就先把C盘引导扇区保存下来,装完了再恢复就行了。
可以用一下下面的命令:
在还没装dos622的时候里,进入win98的command.com
c:\>;debug
-l 100 2 0 1
-n c:\testtest
-r cx
CX 0000
:200
-w 100
Writing 00200 bytes
-q
c:\testtest就是C盘的引导扇区。
恢复的时候可以如下,先进入command.com:
c:\debug
-n c:\testtest
-l 100
-w 100 2 0 1
-q
debug全干了,不用别的工具.
如果只是为了学汇编而用dos622,建议可以在vmware或virtualpc里装dos622,全屏了以
后和裸机上装dos622感觉一样,原来学汇编的时候我就是在vmware里装的dos622,省了
不少麻烦。         

一块网卡两个ip
方法一:
编辑/etc/hostname.iprb0:1
编辑/etc/hosts
方法二:
把下列内容加到/etc/rc2里
ifconfig iprb0:1 192.168.2.57.netmask 255.255.255.0
一块网卡帮定三个ip,并且子网掩码不同
作者:zico
搞定!如下:
/etc/hosts
127.0.0.1 localhost
210.xxx.xx1.xx dbs loghost
192.168.9.15 mytestip
192.168.9.65 mytestip2

/etc/netmasks
210.xx.xx.0 255.255.255.0
192.168.9.0 255.255.255.192
192.168.9.64 255.255.255.252
/etc/hme0
dbs
/etc/hme0:1
mytestip
/etc/hme0:2
mytestip2

#init 6

...

#ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843 mtu 1500 index 2
inet 210.xxx0.2xx.xx netmask ffffff00 broadcast 210.82.31.255
hme0:1: flags=1000843 mtu 1500 index 2
inet 192.168.9.15 netmask ffffffc0 broadcast 192.168.9.63
hme0:2: flags=1000843 mtu 1500 index 2
inet 192.168.9.65 netmask fffffffc broadcast 192.168.9.67
sun官方网站
1. How can I bind multiple (virtual) IP addresses to a single network interface card ?
The following steps demonstrate how to configure the ethernet (elx0) device to support more than one IP address.
Create a text file in the /etc directory called hostname.elx0:1 and add this entry to file:
virtual
Add this IP address and hostname in the /etc/hosts file:
10.0.0.1 virtual
Create a new script file in the /etc/rc2.d directory called S70virtual, and add these entries in this file (for permanent change):
ifconfig elx0:1 10.0.0.1 up netmask 255.255.255.0
Reboot the system.
To delete a logical interface, use the unplumb command . For example,
example% ifconfig elx0:1 down unplumb will delete the logical interface elx0:1.

        3.配置DNS服务器
在Solaris 中,in.named 进程域名服务器。通过网络初始化脚本S72inetsvc在level 2级上启动的,启动后,它读取/etc/named.conf以获取它所管理的区域和区域数据库文件。区域文件除了包含主机名到IP地址的映射外,还包含其他内容。
域名服务器的配置过程包括下列步骤:
1)注册一个域名
2)创建一个主机名和ip地址的列表
3)创建/etc/named.conf文件
4)创建区域数据文件
3.1资源记录类型
在区域数据文件中,信息是以特定的格式存储的。这些信息被定义为资源记录类型(RR)。
标准的资源记录
1.SOA(管理开始)资源记录
@    IN  SOA  X86_DNS.sunmarmot.com  postmaster. sunmarmot.com (
2001041602 ; Serial         
10800 ; Refresh - 180 Minutes
1800 ; Retry - 30 minute
1209600 ; Expire - 2 Weeks
43200) ; Minimum TTL - 12 Hours
X86_DNS.sunmarmot.com  postmaster. sunmarmot.com
主DNS名字是X86_DNS.sunmarmot.com 技术支持者为postmaster. sunmarmot.com
2002101602   SOA序列号,2002年10月16号的02版本
10800        刷新时间,次DNS从主DNS上刷新数据库文件的时间间隔。它寻找主DNS上的SOA序列号,如果序列号发生了改变,名字服务器需要更新数据库。
1800        重试时间,次DNS与主DNS联系更新数据库失败时,再次与主域名服务器联系的时间间隔。
1209600     如果次DNS不能从主DNS上更新后到它自动失效的时间。
43200       不需要更新数据库而使主机名维持有效的时间。
2.NS(名字服务器)资源记录
列出了域或区域中的名字服务器
;
; Nameservers
;
sunmamot.com.  IN  NS   X86_DNS.sunmarmot.com
IN  NS   dns2.sunmarmot.com
   
3.A (地址)资源记录
地址资源记录用于说明DNS 数据库中主机的IP地址。它可能即使用到绝对主机名(FQHN),也可能使用相对的主机名(短主机名)。
;
; use  of  absolute  hostname
X86_DNS.sunmarmot.com   IN  A    192.168.9.1
; use  of  relative  hostname
;jin                       IN  A    192.168.9.2
;则jin相当于jin.sunmarmot.com
;--------------------------------------------------------------------------
; 同一个机器(一个网卡), 但有两个不同的 hostname/FQDN.
;---------------------------------------------------------------------------
NS       IN    A       140.113.250.135
        IN    MX     0    mail.sunmarmot.com..
dnsrd    IN    A       140.113.250.135
注意:在使用短主机名时,不要在主机名后加(.),在使用 绝对主机名时要加(.)
4.MX(邮件交换服务器)资源记录
MX资源记录负责域内的主机之间的邮件交换服务。
;
email    IN   A     192.168.9.1
email2   IN   A     192.168.8.1
IN    MX   5    email     <------5表示优先级,值高的服务器优先使用。
IN    MX  10   email2
5.PTR (指示器)资源记录      The Pointer Resource Record
通常用于逆向主机名的解析
6.CNAME  用于定义主机的别名
www    IN     A     192.168.9.1
ftp      IN     CNAME  www
7.HINFO 主机信息记录
www    IN    HINFO   ultra-10   Solaris
8.TXT 文本资源记录
用来记录主机文本信息
www    IN    TXT   “this host is www in marmot home”
9.WKS (知名服务)资源记录
说明主机能提供的可用的知名服务的信息,从安全的角度讲,不要写这项。
www    IN       WKS    192.168.8.1   TCP ( smtp netstat nntp)
参考英文如下:
DNS RESOURCE RECORDS
Resource Record Description
SOA Start of Authority RR
NS Name Server RR
A The Address RR
MX The Mail Exchanger RR
PTR Pointer RR
CNAME Canonical Name RR
HINFO Host Info RR
TXT Text RR
WKS Well-Known Services RR
3.2委托子域
使用NS类型的资源记录可以将子域委托给其他的DNS,如:子域wife.sunmarmot.com将被委托给名字服务器husband.sunmarmot.com.
wife.sunmarmot.com.       IN   NS   husband.sunmarmot.com.
3.3 /etc/named.conf关键词
3.3.1 acl
定义一个访问控制列表,哪些客户可以使用该服务器
要想为本地网络(192.168.9.*)上的所有主机定义一个acl可以插入声明
acl local_network {
192.168.9/24
};
24表示子网掩码255.255.255.0,如果路由器是主机192.168.9.88,并且希望这个地址对DNS服务器进行任何访问,则可以将前面的声明形式修改如下:
acl local_network {
! 192.168.9.88;192.168.9/24
};
注意:如果要拒绝一个被允许的的子网中的某个特定地址,那么必须在声明中将该地址放在子网定义的前面。
3.3.2  include
可以把指定文件中的内容插入/etc/named.conf中。
因为大型网络的定义DNS区域可能很长,管理员经常将他们放到一个单独的文件中,这样就可以使用acl定义和系统选项分别管理它们。因此要想从文件/var/named.conf中包括所有的定义,需要在/etc/named.conf文件中插入下面的声明:
include “/var/named/zones.conf”
3.3.3 options
options部分定义存储区域数据库的目录及存储命名进程的进程ID文件。
options {
directory “/var/named”;
pid-file “/var/named/pid”;
}
3.3.4 server
server 声明定义远程DNS服务器的特征。对于服务器的,可以设置两个主要的选项:远程服务器是否传送了不正确的信息,以及远程服务器是否能够在一个单独的请求中回答多个查询。
server 10.10.12.1
{
       bogus yes;
       transfer-format many-answers;
}
3.3.5 zone
对于DNS服务器管理的每一个网络或子域,都必须创建一个区域。区域可以创建为主区域(主域名服务器)或辅助区域(次域名服务器)。必须包括IP-域名及域名-IP的映射条才能正确解析IP地址和域名。对于sunmarmot.com域,需要创建下列区域条目
zone “sunmarmot.com”
{
        type master;
file “sunmarmot.com.db”;
}
zone “9.168.192.in-addr.arpa”
{
        type master;
        file “sunmarmot.com..rev”;
}
在这个例子中需要使用主机信息填写两个区域文件/var/named/sunmarmot.com.db和/var/named/sunmarmot.com.rev。
示例文件/var/named/sunmarmot.com.db如下:
;File start: 89606
; The use of the Data contained in Verisign Inc.' aggregated
; .com, .org, and .net top-level domain zone files (including the checksum
; files) is subject to the restrictions described in the access Agreement
; with Verisign Inc.
@ INSOAsunmarmot.com.  root.sunmarmot.net (
2002101501 ;serial
1800 ;refresh every 30 min
900 ;retry every 15 min
604800 ;expire after a week
86400 ;minimum of a day
)
IN    NS   ns.sunmarmot.com.
IN    MX  10   friewall.sunmarmot.com
firewall   IN   A   192.168.9.1    ; firewall
sta      IN   A   192.168.9.2    ; webserver
jin      IN   A   192.168.9.3    ;webserver
wife       IN   A   192.168.9.4    ;Kerberos
security     IN   CNAME  wife
文件/var/named/sunmarmot.com..rev用于反向查询,示例如下:
@    IN    SOA    9.168.192.in-addr.arpa  root.sunmarmot.net (
                    2002101516  ; serial
                          1800  ; refresh
                           900  ; retry
                        691200  ; expire
                         10800  ; negative cache
                    )

            IN           NS    ns.sunmarmot.com.
1            IN           PTR   firewall.sunmarmot.com.
2            IN           PTR   sta.sunmarmot.com.
3            IN           PTR   jin.sunmarmot.com.
4            IN           PTR   wife.sunmarmot.com.
3.3.3 key
用于签名和授权的安全关键字
3.3.4 loggging 用于记录服务器信息
什么命令能看到每个用户分别用了多少空间
find $directory -user username | wc
repquota –a

        前一段时间曾经在这里寻找sun solaris作为PDC(主域控制器)的解决方案;没有得到答案;我经过这两个星期的时间找到了它的解决方案,在这里跟大家分享以下:
Sun Solaris 环境下构建主域控制器(SUN Solaris PDC)
声明:本文档只是一种参考性的指南文档,相关技术问题可以参见相应的管理员指南文档。
Sun公司Solaris PC NetLink,该工具允许Windows用户运行Sun服务器和Solaris环境的目录、管理和验证服务。最多支持2000个用户同时使用,并增加了管理文件和打印环境的服务器功能。其他新特征还有支持Windows 2000和改良的备份工具。Solaris PC NetLink可以将几台NT服务器统一成一台Sun服务器,提供了灵活性,节约了成本,简化了管理。SUN的PC NETLINK软件可以把SUN的服务器模拟成NT服务器,包括作为主域控制器。 PC NetLink 1.2是免费软件,捆绑在所有Sun企业服务器软件中,也可以从Sun下载中心下载。
下载的源文件名称是PCNL_1_2.tar.Z,版本是1.2(目前最新版本是2.0),文件大小为大约250M。下载完成后首先用下面的命令解压缩:
uncompress -v PCNL_1_2.tar.Z
在上述命令执行完成之后,PCNL_1_2.tar.Z 将会被 PCNL_1_2.tar所替代。然后将此tar压缩包解开,确信有足够的空间能够存放这些展开后的文件;完全展开大约需要空间340M。用下面的命令解开压缩包
tar  xvf PCNL_1_2.tar
运行安装文件install(在图形界面上),首先出现安装界面的选项;可选择进行“快速安装”或者“自定义安装”。快速安装将在新域中创建PDC并安装以下组件:
所有PC NetLink服务器组件
PC NetLink Server Manager管理工具
所有必需的增补程序和Java 组件
Windows NT Server Tools和其他客户机工具
在快速安装过程中,如果不想使用缺省名称,则需要输入服务器名称、域名和管理员帐户名及其口令。安装完成后,可运行Server Manager 或者 NT Server Tools来更改此配置。
自定义安装可以在安装和配置PC NetLink过程中具有更大的选择控制权。自定义安装的时候需要指定:
需要安装的组件——服务器、管理工具或者全部
如果要安装服务器组件,需要指定服务器是充当PDC(Prime Domain Controller)、BDC(Backup Domain Controller)还是成员服务器。
有关服务器/域名称和口令的信息
要使用的NetBIOS的配置类型(注:没有NetBIOS,安装将被终止)
l 是否安装Windows NT Server Tools和客户机工具
安装过程中需要输入域名domainname和主域控制器的名称PDCname,以及管理该域的管理员口令administrator password。然后根据提示的选项一步步安装PC NetLink直至安装结束。
如果不打算保留现有配置和数据,运行卸载脚本:
               /opt/lanman/sbin/uninstall
安装结束后,系统将自动把下列目录共享:

其中tools目录下面包含着Windows NT Server Tools。进入目录TOOLS\winnt.40\i386,里面有srvmgr.exe和usrmgr.exe这两个可执行文件是我们管理服务器的主要工具,usrmgr.exe主要管理服务器上的用户和用户组,srvmgr.exe主要管理服务器的一些共享信息(添加删除共享目录)。要安装 PC NetLink Server Manager,双击 pcnlmgr_setup 文件夹中的 setup 程序。setup 程序将根据您的语言环境安装正确的版本。
安装完成之后,首先在客户端需要将服务器添加到 PC NetLink Server Manager。具体操作过程是在操作菜单中选择“添加solaris服务器”。(如果这是首次启动,将自动显示“添加solaris服务器”对话框)。输入要添加到PC NetLink Server Manager中的PC NetLink系统的solaris名称(我这里写的是ip地址),输入系统的root口令然后点确认按钮。
接下来,要将PC NetLink 用户账号与Solaris系统用户账号相关联。要创建此关联,可以使用PC NetLink Server Manager工具或者mapuname命令。将PC NetLink用户帐户映射到Solaris系统用户帐户后,PC NetLink服务器用户创建的所有文件都将归Solaris系统用户账号所有,并且可以通过PC NetLink用户帐户访问。具体操作方法:
使用PC NetLink Server Manager,登陆到要更改其用户帐户映射策略的PC NetLink系统上
双击代表该服务器的图标
双击策略——双击“用户帐户映射”
建立或编辑用户帐户映射策略。按照下图所示进行选择:

l 点确定
这样就完成了建立帐户映射策略的设置。
最后就可以根据Windows NT Server Tools设置用户和共享目录了。
 已知问题:
1 PC NetLink软件无法复制大于2GB的文件,请尽量避免使用大文件或者使用压缩文件
2 使用Solaris PC NetLink加入Windows 2000域时,必须使用管理员的账户和口令。
3 管理员应该尽量避免用空口令创建用户帐户
4 客户机运行PC NetLink Server Manager管理工具的时候可能会无法显示汉字。这个可能与客户机的JRE(Java Runtime Environment)有关系。
如何关掉 不用的端口
关端口/etc/inetd.conf和/etc/rc2.d/,/etc/rc3.d,关掉相应的服务
上网机器设置
》修改以下文件:
      etc/hosts 为           10.91.24.252   the9
      etc/defaultrouter为    10.91.24.254               (我的网关)
      etc/netmasks           10.0.0.0    255.255.255.0
      etc/resolv.conf        nameserver   202.106.196.115
    重启动后发现网络以通,但仍不能上网,so
  #ping www.263.net   
     未知主机
  #ping 202.106.196.115
    202.106.196.115 is alive
10.18第n次上www.chinaunix.net
   得到众高手的指点。
修改etc/swwitch.conf 中的一行 host:    files  为
                               host:    dns   files
重新启动机器(reboot),打开netscape一切ok/

转1 Sun系统的基本安全配置V1.0(by GaoXiao)
1)防止堆栈溢出(*)
2)关闭不用的服务,关闭一些无用的端口(*)
3)给系统打补丁(*)
4)消除系统中的弱智用户,定期修改用户口令,提高口令强度。
5)检查系统中SUID、SGID文件
find / \( -perm -004000 -o -perm -002000 \) -type f –print
检查系统上部正常的隐藏文件,例如…目录文件/dev下是否有可疑文件;/etc/inetd.conf是否有被替换文件;cron和at中是否运行可疑进程。
6)如果系统中开放了Ftp、www服务,则首先升级提供该服务的软件版本;FTP进行严格的权限设定;www服务要求严格检查CGI目录的文件,删除所有无用的脚本,防止恶意用户利用某些漏洞进行缓冲区溢出攻击;DDOS攻击可以通过修改ndd /dev/tcp ?;ndd /dev/ip ?中关于队列长度、最大等待时间等参数来防止。当然主要的是在边缘路由器上进行流量过滤。
7)检查r系列命令,尽量关闭该权限。如果必须开放则必须进行严格的认证措施。例如/etc/host.equiv文件(首先检查);~/$HOME/.rhost文件;
8)检查系统的文件共享问题,利用showmount命令,另外使用rpcinfo命令可以查看开放的r系列服务;rusers、finger可以探测远程用户信息。
9)查看是否有网络sniffer 的标记(*)
10)执行命令尤其是涉及到权限的命令时,一定要主要环境变量,养成良好的习惯;定期对系统的可执行文件、配置文件进行检查,可以采用第三方检查工具:tripwire
11)定期审计系统日志文件,检查是否有可疑用户登陆、程序运行。附unix系统详细日志文件说明。(*)
12)其他安全问题:例如sendmail(低版本-8.9以前有很大的隐患)、bind(8.2.2以前的版本有严重的缓冲去问题)的配置问题都会带来安全隐患;另外对xwindow的非授权使用,也会带来安全隐患,例如可以捕捉到控制台的鼠标坐标甚至屏幕,尽量不要使用xhost+命令。如果安装数据的话,也要提高数据库的安全性,因为很多数据库实际上是以root权限运行的。
#1 防止堆栈溢出
至少90%以上的安全问题都是来自所谓的“堆栈溢出”。攻击者通过给一个以root身份运行的程序提供比它所预期的输入多得多的东西,使被攻击程序无法处理而改变执行流程去执行攻击者指定的代码。
Solaris 2.6和Solaris 7都具备把用户堆栈设成不可执行的能力,以使这种攻击不
能得逞。要使能这个特点:
0)变成root
1)对/etc/system文件做个拷贝
               cp /etc/system /etc/system.BACKUP
2)用编辑器编辑/etc/system文件
3)到文件的最后,插入以下几行:
set noexec_user_stack=1
set noexec_user_stack_log=1
4)保存文件,退出编辑器,一旦重启机器,这些改变就会生效。
#2 在inetd.conf中关闭用不着的服务
有许多用不着的服务自动的处于使能状态。它们中可能存在的漏洞将使攻击者甚至不需要一个账户就能控制你的机器。关闭这些不需要的服务来保护你的系统,你可以用如下方法来关闭:
0)变成root
1)对inetd的配置文件/etc/inetd.conf做个拷贝
              cp /etc/inetd.conf /etc/inetd.conf.BACKUP
2)编辑/etc/inetd.conf文件
未被激活的服务是在前面被“#“符号注释掉的,举个例子,你的部份inetd.conf可能是这样的:               
# Tnamed serves the obsolete IEN-116 name server prot

论坛徽章:
0
2 [报告]
发表于 2003-01-24 15:46 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

太感谢了。

论坛徽章:
0
3 [报告]
发表于 2003-01-24 15:47 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

# Tnamed serves the obsolete IEN-116 name server protocol.
#name   dgram   udp     wait    root    /usr/sbin/in.tnamed     in.tnamed
不需要这个服务,因为你们中的99.999%不会用到这个“已经被废弃的IEN-116名字服务协议“,把这个注释掉以后,这行看起来会象是:
# Tnamed serves the obsolete IEN-116 name server protocol.
##name   dgram   udp     wait    root    /usr/sbin/in.tnamed     in.tnamed
看到这个新的“#” 符号了吧
我建议注释掉几乎所有的服务,只留下:
ftp     stream  tcp     nowait  root    /usr/sbin/in.ftpd       in.ftpd
telnet  stream  tcp     nowait  root    /usr/sbin/in.telnetd    in.telnetd
time    stream  tcp     nowait  root    internal
time   dgram   udp     wait    root    internal
echo    stream  tcp     nowait  root    internal
echo    dgram   udp     wait    root    internal
discard stream  tcp     nowait  root    internal
discard dgram   udp     wait    root    internal
daytime stream  tcp     nowait  root    internal
daytime dgram   udp     wait    root    internal
rstatd/2-4  tli   rpc/datagram_v wait root /usr/lib/netsvc/rstat/rpc.rstatd rpc.rstatd
fs  stream  tcp     wait nobody /usr/openwin/lib/fs.auto    fs
100083/1  tli     rpc/tcp wait root /usr/dt/bin/rpc.ttdbserverd rpc.ttdbserverd
在只需要不多图形操作的服务器或是要保证相当的安全,你也许应该关掉字体服务fs,也可以关掉系统性能监视器rstatd和tooltalk服务器ttdbserverd。事实上在确实需要安全的机器上你甚至应该注释掉telnet和ftp。
3)在/etc/inetd.conf中做出改变之后,找到inetd进程的id号,用kill向它发送HUP信号来刷新它。
4)查看/etc/services文件,关闭一些无用服务的端口(可以采用第三方的端口扫描软件辅助查看)
#3  给系统打补丁
跟所有的复杂系统一样,SUN有它的漏洞,其中的一些从性质上来说是相当严重的。SUN公司有向它的客户甚至是没有技术支持的客户提供补丁的优良传统。这些补丁或者以集合包或者以单个补丁的形式存在的。不幸的是,要完全修补你的系统,既需要大的补丁集合包,又需要单个的补丁。
1) mget 7_x86_Recommended*
2)安装补丁
首先解压补丁包:
如果你用的是Solaris 2.6或更早的,
               uncompress 2*Recommended.tar.Z
               tar -xvf 2*Recommended.tar
如果用的是Solaris 7,
               unzip 7*Recommended.zip
其次,把所有的单个补丁移到你的建立的Recommended目录:
               mv 1* *Recommended
然后,进到保存有全部补丁的Recommended目录:
               cd *Recommended
16)到现在所有的补丁都准备好了,关闭计算机:
          /usr/sbin/shutdown -y -g0 -i0
启到到单用户模式,
对sparc:
               boot -s
对x86, 启动时, 键入:
               b -s
               
系统引导后,在提示符后输入root口令后,键入:
                       mountall
来mount所有的文件系统。
然后输入:
               cd /var/tmp/patch/*Recommended
进到保存所有补丁的目录,现在你可以键入以下命令来安装“所有”的补丁了:
               ./install_cluster
打完补丁后,关机重启,输入:
               /usr/sbin/shutdown -y -g0 -i6
#9当系统入侵发生时,入侵者可以在UNIX系统上暗地里安装一个网络监视程序,通常称sniffer(or packet sniffer),用于捕获用户账号和密码信息.对于NT系统,为达到相同目的,通常更多地使用远程管理程序检查sniffer是否被安装到系统中的第一步是看看是否有进程把任何网络设备置成混杂(promiscuous)模式.如果任一网络设备处于混杂模式,那系统中就有sniffer程序.如果在发现入侵的时候就重启机器或在单用户模式下操作,就不可能探测到处于混杂模式的网卡.
为此有一些工具可以使用.  
cpm - UNIX
ftp://coast.cs.purdue.edu/pub/tools/unix/cpm/  
ifstatus - UNIX
ftp://coast.cs.purdue.edu/pub/tools/unix/ifstatus/  
(ifconfig -i命令也可以报告网卡状态)
注意某些合法的网络监视和协议分析器会将网卡置成混杂模式.探测到某块网卡处于混杂模式并不就一定意味着系统中有入侵者的sniffer在运行.sniffer的记录文件大小通常会很快增长,使用诸如df之类的工具可以确定文件系统的哪部分增长超过预期.记住df,ifconfig,netstat这些命令通常在黑客安装sniffer程序的时候都被木马替换掉了,要使用干净的工具来检查网卡状态. 如果在系统中发现了sniffer,强烈建议检查sniffer的输出文件,以确定还有哪些主机处于危险境地.处于危险境地的主机是指那些出现在被捕获数据包目的域中的主机.但是如果口令跨系统使用或者源目的主机相互信任,则源主机也处于危险境地.
#11不同版本的Unix日志文件的目录是不同的,最常用的目录是:
/usr/adm 早期版本的
Unix /var/adm 较新版本的
Unix /var/log 用于Solaris,Linux,BSD等
/etc Unix system V早期版本
在这些目录下,或其子目录下,你可以找到以下日志文件(也许是其中的一部分):
lastlog 记录用户最后一次成功登录时间
loginlog 不良的登陆尝试记录
messages 记录输出到系统主控台以及由syslog系统服务程序产生的消息
utmp 记录当前登录的每个用户
utmpx 扩展的utmp
wtmp 记录每一次用户登录和注销的历史信息 wtmpx 扩展的wtmp
vold.log 记录使用外部介质出现的错误
xferkig 记录Ftp的存取情况 sulog 记录su命令的使用情况
acct 记录每个用户使用过的命令
aculog 拨出自动呼叫记录
下面按顺序仔细介绍一下
lastlog文件
Unix在lastlog日志文件中记录每一个用户注册进入系统的最后时间,在你每一次进入系统时,系统会显示出这个时间:
login: blackeyes
password: h3ll0
Last login :Tue Jul 27 09:55:50 on tty01
lastlog告诉用户,要核对一下最后注册进入系统的时间是否争确,若系统显示的时间与你上次进入系统的时间不符,说明发生了非授权用户注册,若这种情况发生了,用户应该马上修改帐户口令,并通知管理员。在每次注册时,lastlog新的内容冲掉老的内容。
标准版本的Unix没有提供服务程序可以阅读lastlog文件,有些程序可以提供这个服务,跟我们这里要 谈的东西关系不太大,以后再说了。
loginlog文件
Unix system V版本中,可以把不成功的登录行为记录在/var/adm/loginlog中。要登记不成功的注册行为,可以用下列命令建立/var/adm/loginlog文件:
#touch /var/adm/loginlog
#chmod 600 /var/adm/loginlog
#chown root /var/adm/loginlog
如果你知道一个系统的用户名,而你又想猜出密码,/var/adm/loginlog就会记录你的失败的登录尝试 管理员看看/var/adm/loginlog的内容,你的企图就露馅了:
#cat /var/adm/loginlog
hacker: from 202.88.88.xx: Tue Jul 27 02:40:50 1999
hacker: from 202.88.88.xx: Tue Jul 27 02:41:50 1999
hacker: from 202.88.88.xx: Tue Jul 27 02:42:50 1999
hacker: from 202.88.88.xx: Tue Jul 27 02:43:50 1999
hacker: from 202.88.88.xx: Tue Jul 27 02:44:50 1999
messages文件
记录输出到系统主控台以及由syslog系统服务程序产生的消息
先看看syslog问题syslog采用可配置的、统一的系统登记程序,随时从系统各处接受log请求,然后根据/etc/syslog.conf中的预先设定把log信息写入相应文件中、邮寄给特定用户或者直接以消息的方式发往控制台。值得注意的是,为了防止入侵者修改、删除messages里的记录信息,可以采用用打印机记录或跨越网络登记的方式来挫败入侵者的企图。
syslog.conf的详细说明
以Sun Solaris operating system, version 2.5.1. 为例
/etc/syslog.conf的一般格式如下:
设备.行为级别 [;设备.行为级别]        记录行为
设备                   描述
auth       used by authorization systems (login)           认证系统,即询问用户名和口令
cron       used for the cron and at systems                系统定时系统
daemon     system/netword daemon                           其他系统的daemons
kern       produced by kernel messages                     内核
lpr        printing system                                 打印机系统
mail       mail system                                     邮件系统
mark       internally used for time stamps                 定时发送消息的时标程序
news       reserved for the news system                    新闻系统
user       default facility, used for any program          正式用户处理程序
uucp       reserved for the uucp system                    uucp子系统
local0..7  reserved for local use                          留做指定站点使用
行为级别                描述
debug      normally used for debugging                     调试程序时的消息
info       informational messages                          信息消息
notice     conditions that may require attention           要注意的消息
warning    any warnings                                    警告
err        any errors                                      一般性错误
crit       critical conditions like hardware problems      严重情况
alert      any condition that demand immediate attention   应该立即被纠正的情况
emerg      any emergency condition                         紧急情况
none       Do  not  send  messages  from  the  indicated   指定的服务程序未给所选择的
          facility  to the selected file.                 文件发送信息

记录归属(举例)             描述
/dev/console          send messages to devices             控制台
/var/adm/messages     write messages to files              写入/var/adm/messages
@loghost              forward messages to a loghost        其他的日志记录服务器
fred,user1            send messages to users               传送消息给用户
*                     send messages to all logged-in users 传送消息给所有的在线用户   
下面是一个/etc/syslog.conf的模式

*.notice;mail.info     /var/log/notice
*.crit                 /var/log/critical
kern,mark.debug        /dev/console
kern.err               @server
*.emerg                *
*.alert                root,operator
*.alert;auth.warning   /var/log/auth

如果用打印机来记录日志文件,可以采用如下方法:
把打印机连接到终端端口/dev/ttya上,在/etc/syslog.conf中加入配置语句,例如:
auth.*  dev/ttya
这样就可以记录如不正确口令等信息了。
如果采用跨越网络登记,可以在/etc/syslog.conf中加入配置语句,例如:
auth.*  @loghost
可以采用非unix主机来作为日志记录机,这样的话入侵者就算是得到了root权限也没有办法修改日志文件。
在/var/adm/messages中的一些记录,可以找出入侵者的痕迹,举例如下:
1.Jun 21 06:17:55 youserver /usr/dt/bin/rpc.ttdbserverd[371]: _Tt_file_system::findBestMount.
  Jun 21 06:17:55 youserver inetd[146]: /usr/dt/bin/rpc.ttdbserverd: Segmentation Fault - cod
  Jun 21 06:17:58 youserver inetd[146]: /usr/dt/bin/rpc.ttdbserverd: Illegal Instruction - cd
入侵者利用rpc.ttdbserverd漏洞进攻服务器
2."Sep 8 09:08:03 xxx login: REPEATED LOGIN FAILURES ON /dev/pts/3 FROM xxxxx "
入侵者采用暴力试口令命令失败
3."Sep 8 09:08:03 xxx su: 'su root' failed for xxxxx on /dev/pts/2"
入侵者想利用su命令成为root失败
关于messages可以利用tail -f /var/adm/messages命令来查看

转2 Solaris安全FAQ
本文出自: 作者: quack(quack@antionline.org)
参考资料:The Solaris Security FAQ by Peter Baer Galvin   
1) (概述--略)
2) 怎样将Solaris配置得更加强壮?   
2.1) 哪些文件的许可权限需要改变?   
有个叫fix-modes的软件(ftp://ftp.fwi.uva.nl/pub/solaris/fix-modes.tar.gz)可以在
Solaris 2.4和2.5上运行并改变系统文件及目录的存取权限,这样会使非ROOT的用户更难
于更改系统文件或者取得ROOT权限。
2.2) 如何对ROOT的环境加以配置?   
将umask设为077或者027.   
查看你的环境中路径设置情况,不要有./
2.3) 我该更改哪些启动文件?   
通常情况下,你要检查所有在/etc/rc2.d和/etc/rc3.d以S开头的文件,所有并非必要的设备
或者服务都可以重命名(不要再以S开头),然后你可以重新启动,从/var/adm/messages中来
观察自启动的情况,并且从ps -elf的输出中加以检查。
2.4) 如何将ROOT的远程登陆取消?   
在/etc/default/login里加上 "CONSOLE"行,在/etc/ftpusers里加上root。
2.5) 如何取消rlogin/rsh服务?   
移去/etc/hosts.equiv和/.rhosts以及各home目录下的.rhosts,并且在/etc/inetd.conf中
把r系列服务都杀掉,然后找出inetd的进程号,重启它。
2.6) 哪些帐号是不必须的?   
移去或者锁定那些不是必须的帐号,比如sys\uucp\nuucp\listen等等,简单的办法是在
/etc/shadow的password域中放上NP字符。
2.7) 怎样保护我的设备?   
在文件/etc/logindevperm中包含了对系统设备的许可权限配置信息,应该检视里面的各项
设定并且手动赋予你所想要的许可权限。
对于抽取式的BSM设备需要设定只有single user允许进入。
2. 我应该将/etc的存取权限改为什么才安全?   
用chmod -R g-w /etc命令来移去组用户对/etc的写权限。
2.9) Solaris机器充当路由器?   
默认情况下,如果Solaris机器有超过一块的网卡的话,它将会在不同网卡间转发数据包,这一行为可
以在/etc/init.d/inetinit中得到控制。要在Solaris 2.4或者更低版本机器下关闭它,可以将
ndd -set /dev/ip ip_forwarding 0添加于/etc/init.d/inetinit的未尾。在Solaris 2.5
中,只要touch /etc/notrouter.   
2.10) 如何取消automounter?   
Automounter是由/etc/auto_*这些配置文件控制的,要取消它,只要简单地移去这些文件,
并且/或者将/etc/rc2.d/S74autofs改名。   
2.11) 如何取消NFS服务?   
NFS的共享输出是由/etc/dfs/dfstab文件管理的.可以删除它。要将NFS服务器的守护进程关闭
则可以重命名/etc/rc3.d/S15nfs.server。要防止一台机器成为NFS客户机,可以重命名文件
/etc/rc2.d/S73nfs.client——当重命名这些自启动文件时,要注意不要将文件的首字母设为
“S”。   
2.12) 对cron任务我该注意些什么?   
你得查看所有的cron任务——在/var/spool/cron/crontabs文件中你可以找到它们。还必须在
/etc/default/cron里设置了"CRONLOG=yes" 来记录corn的动作。   
2.13) 使用动态路由有什么风险吗?   
使用动态路由守护进程的机器用in.routed及in.rdisc来维护路由,这可能会大大增加路由协议的复杂程
度,而且路由更新会消耗相当大比便的可用带宽,因此在可能的情况下,还是建议你使用静态路由。
2.14) 何时及如何运用静态ARP?   
ARP是联系IP地址和以太网的协议(地址转换协议) 。默认地,Solaris机器动态地确定ARP地址,arp命令
可以用来静态地设定ARP表并且刷新它,如果你的系统里仅有少量无需更改的机器,那么这是一个很好的工具。
为了防止ARP欺骗,最好将受托机器的硬件地址作为永久条目保存在ARP的高速缓存中。
2.15) 运行rpcbind是不安全的吗?   
rpcbind是允许rpc请求和rpc服务之间相互连接的程序,但标准的rpc是不安全的,它使用的是"AUTH_UNIX"
验证, 也就是说它依靠的是远程系统的IP地址和远程用户的UID来验证。一般的系统可能需要某些rpc存在,但
对各种服务器如Web servers, ftp servers, mail servers, etc)最好将rpc服务关闭,你也可以通过
一些安全工具来确定rpc服务是否会影响到你系统的安全性。可以通过将/etc/rc2.d/S71RPC改名来禁止rpc。
2.16) /etc/utmp的权限应该如何设定?   
# chmod 644 /etc/utmp   
2.17) 哪些程序可以去掉SUID位?   
许多setgid和setuid程序都只是由root运行的,或者是由某些特定用户或组运行,那就可以将其setuid位
移去,下面是一个Solaris 2.6上setuid程序的列表,你应该根据自己的情况进行增减。
# find / -perm -4000 -print
/usr/lib/lp/bin/netpr
/usr/lib/fs/ufs/quota
/usr/lib/fs/ufs/ufsdump
/usr/lib/fs/ufs/ufsrestore
/usr/lib/fs/vxfs/vxdump
/usr/lib/fs/vxfs/vxquota
/usr/lib/fs/vxfs/vxrestore
/usr/lib/exrecover
/usr/lib/pt_chmod
/usr/lib/sendmail
/usr/lib/utmp_update
/usr/lib/acct/accton
/usr/lib/uucp/remote.unknown
/usr/lib/uucp/uucico
/usr/lib/uucp/uusched
/usr/lib/uucp/uuxqt
/usr/lib/sendmail.orig
/usr/openwin/lib/mkcokie
/usr/openwin/bin/xlock
/usr/openwin/bin/ff.core
/usr/openwin/bin/kcms_configure
/usr/openwin/bin/kcms_calibrate
/usr/openwin/bin/sys-suspend
/usr/dt/bin/dtaction
/usr/dt/bin/dtappgather
/usr/dt/bin/sdtcm_convert
/usr/dt/bin/dtprintinfo
/usr/dt/bin/dtsession
/usr/bin/at
/usr/bin/atq
/usr/bin/atrm
/usr/bin/crontab
/usr/bin/eject
/usr/bin/fdformat
/usr/bin/login
/usr/bin/newgrp
/usr/bin/passwd
/usr/bin/ps
/usr/bin/rcp
/usr/bin/rdist
/usr/bin/rlogin
/usr/bin/rsh
/usr/bin/su
/usr/bin/tip
/usr/bin/uptime
/usr/bin/w
/usr/bin/yppasswd
/usr/bin/admintool
/usr/bin/ct
/usr/bin/cu
/usr/bin/uucp
/usr/bin/uuglist
/usr/bin/uuname
/usr/bin/uustat
/usr/bin/uux
/usr/bin/chkey
/usr/bin/nispasswd
/usr/bin/cancel
/usr/bin/lp
/usr/bin/lpset
/usr/bin/lpstat
/usr/bin/volcheck
/usr/bin/volrmmount
/usr/bin/pppconn
/usr/bin/pppdisc
/usr/bin/ppptool
/usr/sbin/allocate
/usr/sbin/mkdevalloc
/usr/sbin/mkdevmaps
/usr/sbin/ping
/usr/sbin/sacadm
/usr/sbin/whodo
/usr/sbin/deallocate
/usr/sbin/list_devices
/usr/sbin/m64config
/usr/sbin/lpmove
/usr/sbin/pmconfig
/usr/sbin/static/rcp
/usr/sbin/vxprint
/usr/sbin/vxmkcdev
/usr/ucb/ps
/usr/vmsys/bin/chkperm
/etc/lp/alerts/printer
而且还应该建立一个setuid/setgid程序的列表,日后可以对比是否有新的setuid程序出现--这可能是
入侵者光临过的征兆。
2.1 哪些系统工具我可以去掉它?   
所有的网络工具你都应该检查并且确定它在你的系统环境里是否是必需的,如果答案为否的话,就
干掉它,下面这些工具有些可以在开始文件中找到它,有些则上在/etc/inetd.conf中被启动的,注
释掉那些不必要的服务,并且kill -HUP inetd守护进程——类似的东西有:
tftp         systat        rexd    ypupdated    netstat
rstatd         rusersd        sprayd    walld           exec
comsat         rquotad        name    uucp
最好把常规的inetd.conf替换掉——改成只开telnet和ftp服务——如果你真的需要它们的话(建议再
用防火墙建立阻塞)。
2.19) 我应该运行in.fingerd吗?   
in.fingerd在过去有一些安全问题,如果你想提供finger工具,用nobody来运行它。
2.20) 如何让syslog有更大作用?
默认情况下,syslog仅提供最精简的记录,你可以通过编辑/etc/syslog.conf文件来让syslog记
录更多的信息,然后你需要重启syslog以使它读取配置文件。
你还可以通过
touch /var/adm/loginlog
chmod 600 /var/adm/loginlog
chgrp sys /var/adm/loginlog
来建立login的记录。
2.21) 对EEPROM如何做才能更安全?   
将EEPROM设于安全的模式:通过设定对"ok setenv security-mode=command"的密码保护来实现。
当然这并不能真正地防止入侵,如果某人可以物理接触某控制台的话,它就能打开机器并替换掉EEPROM,
更改hostid........
2.22) 我的机器是处于“混杂模式”下吗?   
在Solaris下,你只能通过安装某些工具来判断是否机器是处于混杂模式下,可以参见第三部分。只有当你 运行诸如snoop或者某些网络监听软件时机器才会处在混杂模式下,如果你并没有监听整个网络,那极大的可 能性就是黑客已经侵入到你的系统中并且开始以监听来接收数据了。
2.23) 如果我必须运行NFS,如何使它更安全?   
在/etc/dfs/dfstab中的所有文件将被所有人共享,默认情况下,NFS客户会以"-o rw"或者"-o ro"选项
共享。   
必须使用"nosuid"参数来使setuid程序失效。
不要通过rpcbind来运行nfs mount。而是用更安全的rpcbind替代程序或者安装SUN最新的rpcbind补丁。
在可能的情况下,尽量使用secure-RPC。否则的话,你运行的是"AUTH_UNIX"认证,它仅仅依靠客户的IP地
址来进行验证,很容易有IP欺骗的情况发生。
在可能的情况下,不要使用NFS,因为它的信息传递是通过明文的(甚至你用了"AUTH_DES"或者"AUTH_KERB"来
进行认证)所以传输的任何文件对嗅探来说是及危险的。
有程序可以猜度ROOT所mountr的文件名柄,并且获得NFS server上的文件。   
2.24) 如何让sendmail更安全?   
sendmail总是不断地有新漏洞被发现,怎样才能使它更安全呢?
使用最新版本的Berkeley sendmail (see section 3)   
使用smrsh (section 3)   
从/etc/aliases里删除decode   
将/etc/aliases的权限设为644   
可以考虑使用代理防火墙来过滤SMTP中不必要的命令。
2.25) NIS是安全的吗,如何使其更强壮?   
NIS从来就不是一个安全的服务,如果配置得当的话NIS+会更好些,就象暴力破解密码一样,NIS域名
如果被猜出来,就会给入侵者提供相当丰富的信息,要关闭这个漏洞,可以将信任主机的地址放在
/var/yp/securenets中。并且考虑使用NIS+或者secure RPC。
2.26) 匿名FTP要怎样才会安全可靠?   
Solaris 2.5 ftpd(1M)包含了一个很好的FTP配置说明
cp /etc/nsswitch.conf ~ftp/etc   
确保包含~ftp的文件系统在被安装是没有用nosuid选项
在~ftp下任何文件的属主都不是"ftp"   
更详细的信息参见它的配置说明及FAQ
2.27) 如何将X配置得更安全?   
使用SUN-DES-1选项来调用Secure RPC来通过X鉴别,可以使用xhost +user@host来通过访问请求。
2.2 如何打开SUN-DES-1的鉴别机制?   
set DisplayManager*authorize: true   
set DisplayManager._0.authName: SUN-DES-1   
rm ~/.Xauthority   
增加对localhost的许可权限:通过xauth local/unix:0 SUN-DES-1 unix.local@nisdomain
                         xauth local:0 SUN-DES-1 unix.local@nisdomain   
Start X via xinit -- -auth ~/.Xauthority   
把你自己加入,并移去其他所有人:xhost +user@ +unix.local@nisdomain -local -localhost   
赋予用户foo进入主机"node"的权限:   
允许foo进入node:           xhost +foo@   
建立适当的foo的xauthority: xauth add node:0 SUN-DES-1 unix.node@nisdomain   
foo现在就能连上"node"了:    xload -display node:0   
2.29) 我需要安装哪些补丁?   
用showrev -p命令来察看补丁在系统里的安装情况,在你想保护的主机以及大众都可以访问的主机
上,你应该到SUN公司的主页上去查找相关的补丁包来安装,并且应该常常查看最新的补丁发布情况。
2.30) 如何防止在堆栈中执行代码?   
入侵者常常使用的一种利用系统漏洞的方式是堆栈溢出,他们在堆栈里巧妙地插入一段代码,利用
它们的溢出来执行,以获得对系统的某种权限。
要让你的系统在堆栈缓冲溢出攻击中更不易受侵害,你可以在/etc/system里加上如下语句:
set noexec_user_stack=1
set noexec_user_stack_log =1
第一句可以防止在堆栈中执行插入的代码,第二句则是在入侵者想运行exploit的时候会做记录
3) 应该增加或者替代哪些程序?   
3.1) inetd   
   
inetd可以用xinetd代替,以增加日志功能。   
xinetd:   
ftp://qiclab.scn.rain.com/pub/security/xinetd*   
或 ftp://ftp.dlut.edu.cn/pub/unix/sun-source/xinetd-2.1.tar.Z(不知是否为最新版本).   
3.2) ifstatus   
ifstatus可以确定你的网卡是否工作于混杂模式(有人进行网络监听?)   
url:   
ftp://coast.cs.purdue.edu/pub/tools/unix/ifstatus/   
3.3) xntp   
xntp是有个更安全的网络时间协议(Network Time Protocol).   
URL:   
ftp://ftp.udel.edu/pub/ntp/xntp3-5.93.tar.gz (1907KB)      
3.4) sendmail   
用Berkeley Sendmail(http://www.sendmail.org/)替代Solaris自带的sendmail.   
3.5) rpcbind   
可以用如下URL中的rpcbind替换Solaris自带的rpcbind, 这个rpcbind包含了类似   
于tcpwrapper的功能并关闭了通过rpcbind访问NFS.   

ftp://ftp.win.tue.nl/pub/security/rcpbind_1.1.tar.Z   
3.6) 口令检查程序   
很不幸,Solaris 上还未发布passwd+及npasswd, 这两个程序可以用于检查在UNIX   
上那些愚蠢的口令。   
3.7) crack   
crack可以找出/etc/shadow中那些容易猜测的口令,虽然运行crack将会使CPU的   
负载加重,但它在第一次运行时就可以给出10%系统帐号的口令。   
URL: (我想国内很多站点已有此程序了。)   
ftp://sable.ox.ac.uk/pub/comp/security/software/crackers/   
3. ftp   
不用多说,使用wu-ftpd, 国内站点上有的是,如果找不到,试试:      
URL:   
ftp://ftp.dlut.edu.cn/pub/unix/ftp/wu-ftpd/   
OR:   
ftp://wuarchive.wustl.edu/packages/wuarchive-ftpd   
3.9) fix-modes   
用于纠正Solaris 2.2 ~ 2.6系统中敏感文件及目录的属性,以适应安全性需要。   
URL:   
ftp://ftp.dlut.edu.cn/pub/unix/security/fix-modes.tar.gz   
OR:   
http://www.fwi.uva.nl./pub/comp/solaris/fix-modes.tar.gz   
3.10) noshell   
可用于不希望登陆系统的用户的shell, 能够记录发生的事件并防止用户login.   
   
3.11) bind
标准的Solaris里带的bind有着众所周知的安全问题(参见CERT第4部份),现在的发行版已经做
了修补。
3.12) netcat
NetCat对系统管理员和入侵者来说都是很实用的工具,它可以在两个系统间建立灵活我TCP连接。
5) 如何使我的Solaris Web server更安全?   
下面的方法可以令你的以Solaris为基础的系统十分安全,你同时还可以配以利用防火墙及过滤路由
器来组成一个完整而强大的网络拓扑,但是,没有任何系统是完美的,所以你除了关注安全动态,给机
器作好防范之外,也不应该在机器上装载其他无关的第三方的软件--webserver需要的是安全,而不是
对管理员的方便。
5.0) Web server安全检查
用下面的安全检查列表来察看你的系统是否是安全地安装的,当然如果你有特殊的安全需求则不一定以此为准:
在完成一切安全设置前将系统与互联网断开
仅仅安装系统的核心部分以及需要的软件包
安装推荐的安全补丁
修改系统的开始文件来进行
在/etc/init.d/inetinit中关闭IP转发
改变/tmp的存取权限(可以在系统的开始文件中加入脚本
用ps检查进程情况
Invoke sendmail from cron to process queued mail occasionally.   
安装配置tcp_wrappers, S/Key, wu-ftp及tripwire于你的系统环境。
编辑/etc/hosts.allow来确定可进入的机器,并且编辑/etc/inetd.conf注释掉所有不需要的服务
用syslog记录下所有的telnet连接通信
Mount上的文件系统要是只读而且是no-suid的
确定/noshell是除了root之外所有不希望进入的帐号的默认shell
删除/etc/auto_*, /etc/dfs/dfstab, p/var/spool/cron/crontabs/* (except root).   
使用静态路由
测试你的系统,包括允许及拒绝访问的配置及记帐系统
考虑使用更安全版本的sendmail, syslog, bind以及crontab来替代现有的   
安装xntp来有更精确的时间戳
考虑更详细地系统记帐
保持监听和测试Web server的习惯   
在你完成上面的配置之后,你的系统已经会比安装一个标准的UNIX系统,并配以标准配置更安全了。
5.1) 硬件上......
在系统完全安装好并且配置得更安全之前,不要将它放到互联网上——从理论上说,一些入侵者喜欢
在你把系统弄得完美之前溜进去放几个后门——而且最好从CD-ROM安装你的系统并且将二进制文件
加载在磁带机或者软盘上物理写保护.......
5.2) 安装系统
从最新的,可靠的Solaris2.x版本安装,每一版本的Solaris都会比前一版更安全一些的。
Solaris是非常灵活并且包含了大量工具可供使用的。但不幸的是,这些外带的功能软件包可能也会
导致一些潜在的危险,所以要建立一个安全的系统,最好的办法是,只安装基本的OS部份,其余的软件
包则以必要为原则,非必需的包就可以不装——这样还可以使机器更快和更稳定
在Solaris的安装程序里,你可以选择Core SPARC installation cluster来安装,事实上,就连
这个选项都还有些东西是不必要的确良,但它的确是一个安全的系统基础,另一个好处是,它需要的空
间很少,看看下面你就知道了:
s0:    /         256 megabytes
s1:    swap        256 megabytes
s2:    overlap
s3:
s4:     
s5:     
s6:    /local        ??? megabytes (rest of the drive)
s7:
/var要足够大以放置审核记录文件,而swap分区则与你的硬件(内存)相适应就行了,当然大的swap
分区可以在应付DoS攻击时更强有力。
现在可以用另外的机器,ftp到sunsolve.sun.com:/pub/patches并且下载最新的推荐补丁,将它放
在磁带机中转到你的“安全主机”上,然后安装这些补丁,当然有些补丁可能安装不上,因为它所
要补的那个软件你没有安装
5.3) 系统里的Strip   
在Solaris下,你可以通过对/etc/rc[S0-3].d文件来修改启动时自引导的动作:
考虑移去/etc/rc2.d中在你系统中用不到的服务,我还建议你移除/etc/init.d里除下以下列表中
文件外的所有东西:
K15rrcd         S05RMTMPFILES   K15solved       S20sysetup
S72inetsvc      S99audit        S21perf           
S99dtlogin      K25snmpd        S30sysid.net    S99netconfig
K50pop3         S74syslog       S75cron         S92rtvc-config   
K60nfs.server   K65nfs.client   S69inet                       
K92volmgt       README          S95SUNWmd.sync
S01MOUNTFSYS    S71sysid.sys    S88utmpd        S95rrcd
这些文件可能会与你的不同--这取决于你机器里的图形卡/是否使用Solaris DiskSuits等等。
移除/etc/rc3.d里的文件........
举例来说,在Solaris 2.4中,你应该编辑/etc/init.d/inetinit在文件的尾部增加以下行:
ndd -set /dev/ip ip_forward_directed_broadcasts 0
ndd -set /dev/ip ip_forward_src_routed 0
ndd -set /dev/ip ip_forwarding 0
并且通过设定ndd -set /dev/ip ip_strict_dst_multihoming 1来关闭"ip_strict_dst_multihoming"   
核心变量。solaris机器就不会在两块网卡间转发IP包,这可以防止host spoof。
* 在Solaris 2.5下,只要建立一个叫/etc/notrouter的文件就能阻止IP转发,要重新打开它,只要移除
/etc/notrouter并重启动系统就行了。It's important to note that there is a small time   
window between when this file is created and when routing is disabled,   
theoretically allowing some routing to take place.   
在Solaris 2.4下,添加一个新的脚本名为/etc/init.d/tmpfix:   

#!/bin/sh
#ident  "@(#)tmpfix 1.0    95/08/14"
if [ -d /tmp ]
then
  /usr/bin/chmod 1777 /tmp
  /usr/bin/chgrp sys /tmp
  /usr/bin/chown root /tmp
并且连接/etc/init.d/tmpfix到/etc/rc2.d/S79tmpfix,这样这个脚本就会在系统启动时执行了。
这可以使入侵者更难在系统里夺取root权限。在Solaris 2.5则不必如此。
另外还有一些好的建议,就是在启动时为用户设定安全的umask,下面的script就是做这事儿的:
   umask 022  # make sure umask.sh gets created with the proper mode
   echo "umask 022" >; /etc/init.d/umask.sh
   for d in /etc/rc?.d
   do
       ln /etc/init.d/umask.sh $d/S00umask.sh
   done
Note: 脚本名称中的".sh"是必需的,这样脚本才会在本shell而不是它的子shell中执行。
删除/etc/auto_*文件,删除/etc/init.d/autofs可以防止automounter在启动时就运行。
删除/etc/dfs/dfstab,清除/etc/init.d以防止机器成为NFS服务器。
删除crontab文件,你可以将/var/spool/cron/crontabs中属主root以外的文件全部删除。
使用静态路由,建立/etc/defaultrouter来维护之,以避免spoof。如果你必须通过不同的网关,考虑增
加/usr/bin/route命令于/etc/init.d/inetinit以取代运行routed。   
当地切完成时,重启机器,彻底地查看进程,ps -ef的输出应该是这样的:
   UID   PID  PPID  C    STIME TTY      TIME COMD
  root     0     0 55   Mar 04 ?        0:01 sched
  root     1     0 80   Mar 04 ?       22:44 /etc/init -
  root     2     0 80   Mar 04 ?        0:01 pageout
  root     3     0 80   Mar 04 ?       33:18 fsflush
  root  9104     1 17   Mar 13 console  0:00 /usr/lib/saf/ttymon -g -h -p myhost console   
   login:  -T sun -d /dev/console -l co
  root    92     1 80   Mar 04 ?        5:15 /usr/sbin/inetd -s
  root   104     1 80   Mar 04 ?       21:53 /usr/sbin/syslogd
  root   114     1 80   Mar 04 ?        0:11 /usr/sbin/cron
  root   134     1 80   Mar 04 ?        0:01 /usr/lib/utmpd
  root   198     1 25   Mar 04 ?        0:00 /usr/lib/saf/sac -t 300
  root   201   198 33   Mar 04 ?        0:00 /usr/lib/saf/ttymon
  root  6915  6844  8 13:03:32 console  0:00 ps -ef
  root  6844  6842 39 13:02:04 console  0:00 -sh
/usr/lib/sendmail守护程序并没有打开,因为你不必总在25端口监听mail的列表请求,你可以在root的
crontab文件中增加:
0 * * * * /usr/lib/sendmail -q >; /var/adm/sendmail.log 2>;&amp;1
这条命令要以每小时调用sendmail进程处理排队中的邮件。   
5.4) 安装第三方软件
你需要的第一个软件是TCP Wrappers软件包——由Wietse Venema写的,它提供了一个小的二
进制文件叫tcpd,能够用它来控制对系统服务的进出——比如telnet及ftp,它在/etc/inetd.conf
中启动,访问控制可以由IP地址、域名或者其它参数来限制,并且tcpd可以提升syslog的记录
级别,在系统遇到未经认证的连接时,发送email或者警告给管理员。   
然后安装S/Key来控制远程连接的安全性,可以在Q5.6中看到详细的配置方法。
如果你打算打开ftp服务(不管是匿名ftp或者是出了管理目的),你需要取得一份WU-Archive ftp,
最好要拿到它的最新版本,否则会有一些安全漏洞存在,如果你认为需要管理员的远程登陆服务的
话,可能得修改S/Key来支持ftp daemon。在Crimelabs S/Key的发行版本中,你可以在找到
S/Key/misc/ftpd.c,这个C程序示范了如何让S/Key支持WU-Archive ftp,你可以对新版的WU-FTP
做类似的改动,当然你可能要阅读wu-ftp FAQ以增加了解。
编译并且安装了这些二进制文件后(tcpd, wu-ftpd及keyinit, keysu,keysh),它们会被安装在
/usr/local/bin中,当编译wu-ftpd时你需要指定一个配置文件及日志的存放目录,我们推荐你将
配置文件放在/etc下,将日志文件放在/var下,Q5.7更详细地说明了wu-ftp的配置。
用/noshell来阻止那些不想让他们进入的帐号,让/noshell成为那些人的shell。这些帐号不允许登陆
并且会记录下登陆的企图,入侵者无法通过这种帐号入侵。
5.5) 限制通过网络进入系统   

telnet和ftp守护进程是从inetd进程启动的,inetd的配置文件是/etc/inetd.conf,还包含了其它
的各种服务,所以你可以干脆移去这个文件,新建一个只包括以下两行的文件:
ftp stream tcp nowait root /usr/local/bin/tcpd /usr/local/bin/wu-ftpd
telnet stream tcp nowait root /usr/local/bin/tcpd /usr/sbin/in.telnetd
当然这是基于你需要telnet及ftp的基础上的,如果你连这两个服务都不用的话,你就可以将它注释
掉或者删除,这样在系统启动的时候inetd甚至就起不来了
tcpd的访问控制是由/etc/hosts.allow和/etc/hosts.deny文件控制的,tcpd先查找/etc/hosts.allow
,如果你在这里面允许了某几台主机的telnet或ftp访问的话,那么deny访问就是对其它所有机器的了。
这是“默认拒绝”的访问控制策略,下面是一个hosts.allow文件的样本:
ALL: 172.16.3.0/255.255.255.0
这将允许172.16.3.0网络的主机上任何用户访问你的telnet及ftp服务,记住在这里要放置IP地址,因
为域名比较容易受到欺骗攻击……   
现在我们准备拒绝其余所有人的连接了,将下面的语句放在/etc/hosts.deny中:   
ALL: ALL: /usr/bin/mailx -s "%d: connection attempt from %c" root@mydomain.com
这条指令不仅拒绝了其它所有的连接,而且能够让tcpd发送email给root——一旦有不允许的连接尝试
发生时。
现在你可能希望用syslog记录下所有的访问记录,那么在/etc/syslog.conf放进如下语句:
auth.auth.notice;auth.info           /var/log/authlog
注意两段语句间的空白是tab键,否则syslog可能会不能正常工作。
Sendmail将用以cron来调用sendmail来替代。
5.6) 配置S/Key   
S/Key是一个用于实现安全的一次性口令方案的软件,它根据一系列信息(包括一个秘密口令)通过MD4
处理而形成的初始钥匙,该初始钥匙再交给MD4进行处理,资助将128位的数字签名缩成64位,该64位信息
再次传给MD4函数,这个过程一直持续直到达到期望值……

论坛徽章:
0
4 [报告]
发表于 2003-01-24 15:48 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

开始使用S/Key时,要建立一个以/usr/local/bin/keysh为shell的帐号:
在/etc/passwd中加入
access:100:100:Access Account:/tmp:/usr/local/bin/keysh
并且在/etc/shadow中加入
access:NP:6445::::::
然后使用passwd access命令来设定用户的访问密码。
由于/usr/local/bin/keysh不是一个标准的shell,所以你的/etc/shells文件中内容如下:
/sbin/sh
/usr/local/bin/keysh
只有使用这两种login shell的用户才允许接入。
然后建立一个文件/etc/skeykeys并赋予一定的许可权限:
touch /etc/skeykeys
chmod 600 /etc/skeykeys
chown root /etc/skeykeys
chgrp root /etc/skeykeys
使用keyinit access命令来初始化S/Key秘密口令。
现在你可以配置允许用户通过keysu命令来成为超级用户,首先改变/etc/group:
root::0:root,access
只有在这里列出来的用户才允许通过keysu成为超级用户。现在你可以使用不着keyinit root命令来初
始化超级用户的S/Key秘密口令,我建议该口令要与user的有所区别。
本来你可以将/bin/su删掉以确定用户只能使用keysu……,但不幸的是,许多脚本使用/bin/su来开启
进程,所以你只需用chmod 500 /bin/su来改变它的权限就行了。

5.7) 配置wu-ftp   
配置wu-ftp需要经验,当你编译wu-ftpd时,你需要指定一个存放配置文件的地方,这个文件夹里将
包含一个pid文件夹和三个文件,一个ftp conversions文件可以是空的,但不能没有,还有ftpusers文
件包含了所有在password文件中存在但不允许登陆系统ftp的用户名称,也就是如uucp、bin之类的系统
帐号都将应该被限制。root最好是永远都被扔在这里面
最后一个文件是ftpaccess:
class users real 172.16.3.*
log commands real
log transfers real inbound,outbound
这将允许从172.16.3.0的任何用户ftp而拒绝所有其它的,所有的文件与命令将被记录下来,并且存放
在你指定的记录文件目录。
至于建立匿名FTP,你要小心,因为很容易配置错误。
建立一个特殊帐户如:
ftp:*:400:400:Anonymous FTP:/var/spool/ftp:/bon/false
因为使用了chroot()功能,必须建立一个小的文件系统,包含了bin\etc\pub目录:
这里面要注意的有:
确保bin及etc下的所有文件属主都是root,且任何人不可写,只有执行权限,最好另外拷贝
一份passwd到ftp的etc中,即使被入侵者得到了,也不会泄露太多信息。
详细配置情况还需要看关于wu-ftp的faq。
5. 限制对文件及文件系统的存取权限
下载并使用fix-modes,这个程序会将系统里不安全的文件存取权限(文件/目录)找出来。
使用nosuid参数来配置/etc/vfstab,以防止setuid程序从UFS文件系统执行
/proc               -       /proc      proc    -   no   -
fd                  -       /dev/fd    fd      -   no   -
swap                -       /tmp       tmpfs   -   yes  -
/dev/dsk/c0t3d0s1       -       -          swap    -   no   -
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0  /       ufs  1   no   remount,nosuid
/dev/dsk/c0t3d0s4 /dev/rdsk/c0t3d0s4  /usr    ufs  1   no   ro
/dev/dsk/c0t3d0s5 /dev/rdsk/c0t3d0s5  /var    ufs  1   no   nosuid
/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6  /local  ufs  2   yes  nosuid
5.9) 测试配置
重启你的机器,确定下面这些东西:
你可以从你配置为允许tcpd连接的机器telnet及ftp到你的server。
尝试从其它未被允许的机器进入,应该会拒绝并email告知当事人。
你只能以user的身份远程telnet或者ftp上站,不能以root登陆。   
用户可以通过/usr/local/bin/keysu成为超级用户。
ps -ef只有少量的进程显示,最好不要有sendmail和各种NFS进程。
touch /usr/FOO会得到错误提示,因为文件系统是ro的。
成为超级用户,将ps命令复制到/,要保持它的setuid位,然后删除它的二进制文件。
好了,祝贺你,你已经建立了一个比较安全的系统了
5.10) 最后:一些建议
使用XNTP来确定精确的时间。
在你把机器放到网上前,用tripwire和MD5做一个校验,如果系统被入侵,你可以通过保存的校验和
来判断哪些程序被替换掉了。
考虑使用进程记录来记来系统里占用资源的情况。
定期改变你的S/Key secrets并且选择一个好的密码,在各地方的密码最好不要一样……

转3 from linux技术中坚站
Solaris的安全配置
希望对大家能有点用吧。
Solaris的安全配置可以从以下几个方面来考虑:
1. 本地安全增强
包括: 限制某些强大命令的访问
设置正确的文件权限
应用组和用户的概念
suid/sgid的文件最少
rw-rw-rw的文件最少等
2. 网络安全增强
包括: 使用安全的协议来管理
禁止所有不需要的服务
禁止系统间的信任关系
禁止不需要的帐号
增强认证需要的密码
保护存在危险的网络服务
限制访问等
3. 应用安全增强
包括: 限制用户的权限
限制进程所有者的权限
检查应用相关文件权限
限制访问其他系统资源
应用所依赖的suid/sgid文件最少
使用应用本身的安全特性
删除samples和其他无用的组件
4. 监控与警报
包括: 日志、完整性、入侵检测等一些使用工具等
下面就详细讲述具体的配置过程。

一、 操作系统配置
1. 安装
1.1 安装最新的补丁
安装patches对系统稳定和安全十分重要。
看系统中安装了那些补丁 #showrev –p
更新更安全的补丁在 http://sunsolve.sun.com
1.2 初始安装时需要创建 /var分区,/var分区是存放logfile以及系统变动文件的文件系统,因为它的易变化性,以及在系统运作过程中的不断扩大,所以不要把/var文件系统包括再root分区里,以免有恶意程序恶意扩大日志文件来dos根分区。
1.3 安装最小的系统
安装Solaris时,最好先最小化安装,然后再加上必要的软件,这样可以减小某个程序出现安全隐患的可能。
2. 打开审计功能
审计包括很多的内容,可以根据需求设置。可以参考本文档中的日志和监控部分。
3. 系统参数安全配置
3.1 OpenBoot的安全
OpenBoot是所有Sun SPARC启动PROM的固件部分,它包括关于SPARC系统如何启动的信息,以及用来检测SPARC系统硬件的内嵌命令。
注意:绝对不能让用户接触OpenBoot,能够访问OpenBoot的聪明用户可以从几乎所有的SCSI设备(外部硬盘或者CD-ROM)上启动系统,如果用户可以从他自己的媒体上启动系统,那么他将获得对系统的完全控制。OpenBoot的安全级别有3种:none、command和full。Sun系统在出厂的时候将OpneBoot安全级别设置为none,即不需要口令,所以必须要采用口令来保护系统的OpenBoot安全。
(1) 如何在Solaris中设置OpenBoot口令(作为超级用户)
# eeprom security-password
Changing PROM password:
New passwordxxxxxxx
Retype new passwordxxxxxxx
(2) 如何在OpenBoot提示符下设置OpenBoot口令
ok password
ok New password (only first 8 chars are used) xxxxxxx
ok Retype new passwordxxxxxxx
ok
(3) 如何在Solaris中设置OpenBoot的安全级别
下面这个例子将把安全级别设置为command(作为超级用户)
# eeprom security-mode=command
#
(4) 如何在OpenBoot提示符下设置OpenBoot安全级别
下面这个例子将把安全级别设置为command
ok setenv security-mode command
ok
下面这个例子将把安全级别设置为full
ok setenv security-mode full
ok
3.2 将coredump大小设置为0
在/etc/system中加入如下一行:
set sys:coredumpsize = 0
将每次重启产生的coredump大小设置为0,不需要无用的信息。
3.3 修正堆栈错误,防止溢出(只对2.6后有效)
黑客进入系统后大部分是利用buffer overflow取得root shell
为了防止基于堆栈的缓冲区溢出,在/etc/system文件中加入
set noexec_user_stack=1 ?防止在堆栈中执行
set noexec_user_stack_log=1 ?当某人试图运行增加一个记录。
然后改变文件权限:#chmod 644 /etc/system
3.4 只允许root进行电源管理(只对2.6及以后版本有效)
编辑/etc/default/sys-suspend:
将 PERMS=console-owner
改为 PERMS=-
并做 #/bin/chmod 0755 /usr/openwin/bin/sys-suspend
此项防止SYN Flood攻击
3.5 设置/tmp目录粘滞位,mode 1777
创建文件/etc/rc3.d/S79tmpfix:
/bin/cat << EOF >;/etc/rc3.d/S79tmpfix
#!/bin/sh
#ident "@(#)tmpfix 1.0 95/09/14"
if [ -d /tmp ]
then
/usr/bin/chmod g-s /tmp
/usr/bin/chmod 1777 /tmp
/usr/bin/chgrp sys /tmp
/usr/bin/chown sys /tmp
fi
EOF
改变S79tmpfix文件权限:
#/usr/bin/chmod 755 /etc/rc3.d/S79tmpfix
此项给/tmp加上粘滞位,只允许写而不允许删除。这样,当黑客往/tmp写.socket文件时不允许删除。
3.6 禁止stop-‘A’键
在/etc/default/kbd中,改变或加入“KEYBOARD_ABORT=disable”此项防止启动后,按stop-A或L1-A得到ok提示符,使用启动盘可以进入单用户模式,防止黑客物理接触机器。但此项不禁止可以作为密码丢失时的应急处理。
3.7 密码设置配置
(1) 添加或编辑/etc/default/passwd文件如下入口:
PWMIN= 1 #密码可以被改变的最小时段。
(2) 添加或编辑/etc/default/passwd文件如下入口:
PWMAX= 13 #密码的最大生存周期。
(3) 添加或编辑/etc/default/passwd文件如下入口:
PWWARN= 4 #设定离用户密码过期的天数,当系统启动时提醒用户。
(4) 添加或编辑/etc/default/passwd文件如下入口:
PWLEN= 8 #设定最小用户密码长度为8位。
3.8 登陆的安全配置
3.8.1 防止远程的root登陆
解决方法:
添加或编辑/etc/default/login文件如下入口:
CONSOLE=/dev/console #这样root只能从/dev/console这个设备登陆。
3.8.2 纪录所有root的登陆情况
添加或编辑/etc/default/login文件如下入口:
SYSLOG= YES #syslog纪录root的登陆失败,成功的情况。
3.8.3 设置登陆会话超时时间
添加或编辑/etc/default/login文件如下入口:
TIMEOUT= 120
3.8.4 确定登陆需要密码验证
添加或编辑/etc/default/login文件如下入口:
PASSREQ= YES
参考脚本:
defloginparams.sh
3.9 设置屏蔽掩码和umask
(1)设置屏蔽掩码:
添加或编辑/etc/default/login文件如下入口:
LUMASK= 027 #这将设定标准掩码为:750,也可以将这行加到/etc/.login /etc/profile /etc/skel/local.cshrc /etc/skel/local.login /etc/skel/local.profile这些文件里。
(2)设置umask
确定root的umask是027或077
检查root的.profile
3.10 设置shell的环境变量
添加或编辑/etc/default/login文件如下入口:
ALTSHELL= YES
参考脚本:
defloginparams.sh
3.11 查是否每个用户都设置了密码
检查/etc/passwd和/etc/shadow,每个用户的密码栏是否为空。
3.12 编辑使用useradd的缺省配置,满足密码策略
编辑/etc/sadm/defadduser需要满足密码策略,例如:
defgroup=15
defgname=users
defparent=/export/home
defskel=/etc/skel
defshell=/usr/bin/ksh
definact=30
defexpire=
3.13 在所有path中,去掉所有”.”路径
检查所有缺省启动脚本和root启动脚本,在所有路径变量中删除“.”路径, 包括以下文件:
/.login
/etc/.login
/etc/default/login
/.cshrc
/etc/skel/local.cshrc
/etc/skel/local.login
/etc/skel/local.profile
/.profile
/etc/profile
3.14 使用sugroup来限制su
将可以su的用户添加到这个组,在 /etc/group中创建特殊的组sugroup,将你的管理员帐号加到这个组。
改变 /bin/su 的权限为: r-sr-sr-x 1 root sugroup
#chmod 550 /bin/su
#chmod +s /bin/su
#chown root:sugroup /bin/su
#ls -al /bin/su
-r-sr-s--- 1 root sugroup 18360 Jan 15 1998 /bin/su
#grep sugroup /etc/group
sugroup::600:root,httpadm,wspher
这样,只有sugroup组中的用户可以使用su,提升为超级用户
另外一个可行的方法是使用sudo来替代su。
4 网络安全配置
4.1 禁止所有不需要的服务
用grep -v “^#”/etc/inetd.conf命令来察看你当前没有注释的服务
# vi /etc/inetd.conf
在/etc/inetd.conf中注释掉左右不需要的服务,比如:
name、shell、login、exec、comsat、talk、rusersd、printer、finger、uucp 所有以“r”开头的服务,对必须提供的服务采用tcpwapper来保护。
4.2 编译安装Tcp wapper
安装tcpd,编辑inetd.conf中的服务为:
ftp stream tcp nowait root /usr/local/bin/tcpd in.ftpd
telnet stream tcp nowait root /usr/local/bin/tcpd in.telnetd
4.3 Tcp_Wrappers
在默认情况下,Solaris允许所有的服务请求。用Tcp_Wrappers来保护服务器的安全,使其免受外部的攻击,比想像的要简单和轻松的多。
在/etc/hosts.deny 文件中加入 ALL:ALL以禁止所有计算机访问服务器,然后在/etc/hosts.allow 文件中加入允许访问服务器的计算机。这种做法是最安全的。
Tcp_Wrappers是由两个文件控制的,它们是/etc/hosts.allow 和 /etc/hosts.deny。
第一步 编辑/etc/hosts.deny 文件
# vi /etc/hosts.deny
加入下面这些行:
ALL:ALL
这样做的目的是:所有的服务、访问位置,如果没有被明确的允许,也就是在/etc/hosts.allow 中找不到匹配的项,就是被禁止的。

第二步 编辑/etc/hosts.allow 文件
# vi /etc/hosts.allow
例:我们只希望允许同一个局域网的机器使用服务器的telnet功能,而禁止互联网上面的telnet服务请求,本地局域网由 202.39.154. 、202.39.153. 和202.39.152. 三个网段组成。在hosts.deny文件中,我们定义禁止所有机器请求所有服务: ALL:ALL。 在hosts.allow文件中,我们定义只允许局域网访问telnet功能:
in.telnetd: 202.39.154. 202.39.153. 202.39.152.
这样,当非局域网的机器请求telnet服务时,就会被拒绝。而局域网的机器可以使用telnet服务。
4.4 启动时提供的服务(rc.x)
4.4.1 禁止所有不需要的服务
在rc.x目录中将不需要的服务改名,比如:
# mv /etc/rc3.d/S92volmgt /etc/rc2.d/not_usedS92volmgt
以下服务应该禁止(根据需要自己决定):
snmpdx
autofs (Automounter)
volmgt (Volume Deamon)
lpsched (LP print service)
nscd (Name Service Cache Daemon)
Sendmail
keyserv (Keyserv Deamon is only used if NIS+ or NFS are installed, if used start with
–d option so that the defaults “nobody” key is not allowed)
rpcbind提供远程呼叫,依靠远程系统的ip地址和远程用户的ID进行验证,这样很容易伪造和改变。
4.4.2 禁止所有DMI服务
禁止所有DMI服务:
# mv /etc/rc3.d/S??dmi /etc/rc3.d/K??dmi
/etc/init.d/init.dmi中启动的dmi服务有:
/usr/lib/dmi/dmispd
/usr/lib/dmi/snmpXdmid
/etc/dmi/ciagent/ciinvoke
4.4.3 去掉mount系统的suid位
在/etc/rmmount.conf中加上:
mount hsfs -o nosuid
mount ufs -o nosuid
4.4.4 检查所有的.rhosts文件
.rhosts允许不要密码远程访问
预先生成$HOME/.rhosts文件,并且设置为0000,防止被写入”+ +”。(攻击者经常使用类似符号链接或者利用ROOTSHELL写入)。
注:这种情况会导致一些如SSH的RCP命令无法使用(需要使用$HOME/.rhosts文件的一些命令)
touch /.rhosts ;chmod 0 /.rhosts
.rhosts可以被普通用户所创建在个人目录下。推荐使用脚本来发现.rhosts文件。并且利用cron自动检查,报告给特定用户。
Script for Find.rhost:
#!/bin/sh
/usr/bin/find /home -name .rhosts | (cat < this only find .rhost:
EOF
cat
) | /bin/mailx -s "Content of .rhosts file audit report" yourmailbox
4.4.5 禁止使用.rhosts认证
在/etc/pam.conf中删除
rlogin auth sufficient /usr/lib/security/pam_rhosts_auth.so.1
将rsh的行改为:
rsh auth required /usr/lib/security/pam_unix.so.1
4.4.6 检查信任关系
检查/etc/hosts.equiv文件,确保为空。
4.5 网络接口调整和安全优化
4.5.1 /etc/rc2.d/S??inet参数调整
在/etc/rc2.d/S??inet中做如下参数调整:
缩短ARP的cache保存时间:
ndd -set /dev/arp arp_cleanup_interval 60000 /* 1 min (default is 5 min)*/
缩短ARP表中特定条目的保持时间:
ndd -set /dev/ip ip_ire_flush_interval 60000 /* 1 min (default is 20 min)*/
关闭echo广播来防止ping攻击
ndd -set /dev/ip ip_respond_to_echo_broadcast 0 # default is 1
关闭原路由寻址
ndd -set /dev/ip ip_forward_src_routed 0 # default is 1
禁止系统转发IP包
ndd -set /dev/ip ip_forwarding 0 # default is 1
禁止系统转发定向广播包
ndd -set /dev/ip ip_forward_directed_broadcasts 0 # default is 1
使系统忽略重定向IP包
ndd -set /dev/ip ip_ignore_redirect 1 # default is 0
使系统限制多宿主机
ndd -set /dev/ip ip_strict_dst_multihoming 1 # default is 0
再次确保系统关闭ICMP广播响应
ndd -set /dev/ip ip_respond_to_address_mask_broadcast=0 # default is 1
关闭系统对ICMP时戳请求的响应
ndd -set /dev/ip ip_ip_respond_to_timestamp=0 # default is 1
关闭系统对ICMP时戳广播的响应
ndd -set /dev/ip ip_ip_respond_to_timestamp_broadcast=0 # default is 1
禁止系统发送ICMP重定向包
ndd -set /dev/ip ip_send_redirects=0 # default is 1
4.5.2 改变TCP序列号产生参数
在/etc/default/inetinit中改变
TCP_STRONG_ISS=2
4.5.3 设置in.routed运行在静态路由模式
按如下步骤建立in.routed -q(静态模式):
mv /usr/sbin/in.routed /usr/sbin/in.routed.orig
创建文件/usr/sbin/in.routed为以下内容:
#! /bin/sh
/usr/sbin/in.routed.orig –q
改变文件属性:
chmod 0755 /usr/sbin/in.routed
#动态的路由模式容易遭受到恶意的路由信息的亲篇和攻击,所以建议宁愿用静态路由,(路由的增加通过启动文件的route命令)也不建议用动态路由守护进程。

4.5.4 禁止路由功能
创建空文件notrouter:
# touch /etc/notrouter
4.5.5 利用ip-filter
ip-filter是Solaris系统的内核模块,可以完成简单包过滤
二 应用程序安全配置
1. 总体安全考虑
应用程序以非特权用户运行
定义应用程序属主
删除所有的samples
chroot,改变进程的root目录
具体应用考虑
2. NFS服务
2.1 禁止nfs服务
杀掉如下NFS进程: lockd、nfsd、statd、mountd
NFS是由/etc/dfs/dfstab文件控制,为了禁止NFS服务的后台程序
将/etc/rc2.d/S15nfs.server文件改名 K15nfs.server
将/etc/rc2.d/S73nfs.client文件改名 K13nfs.client
/etc/dfs/dfstab 文件有几个选项
share –F nfs –o [rw/ro] /目录名
client端有读写权限, ro是client端只有读权限 [建议使用ro选项]
2.2 如必须使用,则设置nfs特殊tcp、udp端口
ndd -set /dev/tcp tcp_extra_priv_ports_add 2049(设置TCP端口)
ndd -set /dev/udp udp_extra_priv_ports_add 2049(设置UDP端口)
2.3 打开nfs port monitoring功能
在/etc/system中加入:
set nfssrv:nfs_portmon = 1
set nfs:nfs_portmon = 1
确定你的/etc/system文件的访问权限为644:
# chmod 644 /etc/system

2.4 一些nfs相关的服务
解决方法:
nfsd
mountd
rpc.boot
in.rarpd
rpld
3 NIS,NIS+
3.1 去除NIS,NIS+
建议不要运行NIS,NIS+服务,所以按一下步骤移除它:
在文件/etc/domainname里移除域名:
可以察看NIS大体的服务列表:
# pkginfo |grep NIS
# pkgrm
system SUNWypr NIS Server for Solaris (root)
system SUNWypu NIS Server for Solaris (usr)
3.2 移除NIS,NIS+,DNS Lookup
解决方法:
编辑/etc/nsswitch.conf如下:
passwd: files
group: files
hosts: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
netgroup: files
automount: files
aliases: files
services: files
sendmailvars: files
如果需要dns的话,可以再次修改这个文件。
4 Mail
4.1 停止绑定在25端口的sendmail服务
解决方法:
禁止sendmail服务,系统用户依然可以发信。含义是:sendmail仍然安装了,只是不要作为守护进程存在,你可以在sendmail.cf文件里限制系统的用户的权限。
# mv /etc/rc2.d/S88sendmail /etc/rc2.d/not_usedS88sendmail
4.2 注释所有的并行邮件别名
解决方法:
检查 /ect/aliases |可以并列。用#号注解。
4.3 限制sendmail的expn和vrfy两个命令来收集系统信息
解决方法:
在/etc/senmmail.cf文件中修改如下限制远程连接25端口使用expn和vrfy命令:
# O PrivacyOptions=authwarnings, goaway
Opgoaway
# O PrivacyOptions=noexpn, novrfy, authwarnings
O LogLevel=5
4.4 隐藏smtp版本信息
解决方法:
在/etc/mail/sendmail.cf文件里找到smtp版本信息,修改如下:
# SMTP login message
4.5 禁止邮件转发
解决方法:
普通用户不可以选择转发者,而root可以通过/usr/local/forward/.forward.$u来控制邮件转发,修改/etc/sendmail.cf如下行:
O ForwardPath=/usr/local/forward/.forward.$u
设置/usr/local/forward正确的权限。
4.6 接收邮件
解决方法:
如果真要在系统上接收外来的邮件(监听在25端口)。建议利用spam或smtpd/smtpfwdd来保证邮件服务的安全(加上anti-spam,安全配置)。
5 Ftp安全配置
5.1 安全FTP
解决方法:
建立或修改/etc/default/ftpd文件增加屏蔽码和ftp标志信息:
UMASK= 077
BANNER="/bin/cat /etc/ftp-banner"
修改/etc/default/ftpd权限:
chmod 644 /etc/default/ftpd
5.2 建立ftp标示信息
解决方法:
建立/etc/ftp-banner文件满足如下:
例如:This system is for authorized users only. Monitoring may occur
修改/etc/ftp-banner文件的权限:
chmod 644 /etc/ftp-banner
5.3 在/etc/passwd文件中
ftp:x:30000:30000:Anonymous FTP:/ftp目录:/nosuchshell
5.4 在/etc/shadow文件中
ftp:NP:6445::::::
5.5 FTP-server的配置文件/etc/ftpaccess
class local real * ?重定义真实用户为local
class remote guest,anonymous * ?重定义匿名用户为 remote
limit local 100 Any /ftp目录/msgs/limit.local限制登录用户数
limit remote 100 Any / ftp目录/msgs/limit.remote 限制登录用户数
banner /ftp目录/msgs/msg.banner
loginfails 2 重试次数
readme README* login
readme README* cwd=*
message /ftp目录/msgs/welcome.msg login local remote
message /ftp目录/msgs/cwd.msg cwd=* remote
compress yes local,remote
tar yes remote,local
log commands real
log transfers anonymous,real,guest inbound,outbound
shutdown /ftp目录/msgs/shutmsg
5.6 创建ftp banner
创建Banner文件 /etc/ftp-banner
5.7 创建/etc/ftpusers文件
把所有的系统账户加入到这个文件里:
root daemon sys bin adm lp smtp uucp nuucp listen
nobody noaccess news ingres audit admin sync nobody4
修改/etc/ftpuser文件的权限:
# chmod 644 /etc/ftpusers
6 Telnet安全配置
6.1 防止telnet程序显示系统版本信息
解决方法:
移除/etc/default/telnetd文件里的信息:Banner=””
假如/etc/default/telnetd文件不存在,按如下步骤操作:
# touch /etc/default/telnetd
# echo "BANNER=\"\"">;>; /etc/default/telnetd
# chmod 444 /etc/default/telnetd
6.2 最好采用SSH代替Telnet
7 X-Windows
设置CDE为不接受任何XDMCP登陆连接
假如/usr/dt/config/Xaccess存在,则如下操作:
cat </usr/dt/config/Xaccess
# disable all XDMCP connections
!*
EOF
假如/etc/dt/config/Xaccess存在,则如下操作:
cat </etc/dt/config/Xaccess
# disable all XDMCP connections
!*
EOF
三 文件权限
1 删除所有不使用的suid文件
列出系统中所有 suid 文件
find / -type f \( -perm -4000 \) –exec ls –al {} \;
find / -type f \( -perm -4000 \) –exec ls –al {} \; >; $HOME/search-4-suid-files.txt
首先备份 suid 文件
# mkdir /opt/backup/suid
find / -type f \( -perm -4000 \) -print |cpio -pudm /opt/backup/suid
删除前建立tar备份,不要删除suid-files.tar!!
cd /opt/backup; tar –cvpf suid-files.tar /opt/backup/suid/*
rm –r /opt/backup/suid
去除所有suid 文件中的suid 位
find / -type f \( -perm -4000 \) –exec chmod –s {} \;
再查一遍
find / -type f \( -perm –4000 \) –exec ls –al {} \;
对一些常用文件建立suid 位
chmod u+s /usr/bin/su
chmod u+s /usr/bin/passwd
chmod u+s /usr/bin/ps
2 删除所有不使用的sgid文件
列出系统中所有 suid 文件
find / -type f \( -perm -2000 \) –exec ls –al {} \;
find / -type f \( -perm -2000 \) –exec ls –al {} \; >; $HOME/search-4-sgid-files.txt
首先备份 sgid 文件:
mkdir /opt/backup/sgid
find / -type f \( -perm -2000 \) -print |cpio -pudm /opt/backup/sgid
删除前建立tar备份,不要删除sgid-files.tar!!
cd /opt/backup; tar –cvpf sgid-files.tar /opt/backup/sgid/*
rm –r /opt/backup/sgid
去除所有sgid 文件中的sgid 位
find / -type f \( -perm -2000 \) –exec chmod –s {} \;
再查一遍
find / -type f \( -perm –2000 \) –exec ls –al {} \;
对一些常用文件建立sgid 位。
3 删除/etc下所有组可写文件
find /etc -type f \( -perm -20 \) –exec ls –al {} \;
find /etc -type f \( -perm -20 \) –exec ls –al {} \; >; search-4-group-writeable-in-etc.txt
/etc下不应有组可写文件,去掉写权限
find /etc -type f \( -perm –20 \) –exec chmod g-w {} \;
4 删除/etc下所有用户可写文件
检查/etc目录下对用户可写文件:
find /etc -type f\( -perm 2 \) | xargs ls –las
不需要用户的可写权限,修改如下:
find /etc -type f\( -perm 2 \) | xargs chmod g-w
5 改变所有文件的rw-rw-rw权限为rw-r-r-
首先列出文件:
find / -type f -perm 666 |xargs ls -al >; perm-666-before-change.txt
改变权限:
find / -type f -perm 666 |xargs chmod 644
find / -type f -perm 666 |xargs ls -al >; perm-666-after-change.txt
6 改变rwxrwxrwx文件的权限
首先列出文件:
find / -type f -perm 777 |xargs ls -al >; perm-777-before-change.txt
改变权限:
find / -type f -perm 777 |xargs chmod 755
find / -type f -perm 777 |xargs ls -al >; perm-777-after-change.txt
7 找出系统可写的目录
解决方法:
find / -type d\( -perm 2 \)
改变所需要的权限设置
8 确定每个root启动的脚本属于root
检查启动脚本的文件属主:
find /etc -type f -print | grep rc | egrep -v "skel|tty|mail|snmp|Mail" | xargs ls -al >; rc-files-before-change.txt
改变这些文件的文件属主:
find /etc -type f -print | grep rc | egrep -v "skel|tty|mail|snmp|Mail" | xargs chown
root:root
find /etc -type f -print | grep rc | egrep -v "skel|tty|mail|snmp|Mail" | xargs ls -al >; rc-files-after-change.txt
ls -al /etc/init.d >; etc-init.d-before.change.txt
chown root:root /etc/init.d
ls -al /etc/init.d >; etc-init.d-after-change.txt
经过这样的改变,所有的rcX.d里的脚本的文件属主都为root,所有的/etc/init.d目录里的脚本的文件属主文件组都是root了,为了防止特洛伊木马。
9 确保所有cron行为有记录
确定/etc/default/cron文件里有如下行:
CRONLOG=YES
删除/var/spool/cron/crontabs 目录中除了root文件外所有文件。
10 检查utmp,utmpx的权限
检查/var/adm目录下的文件权限:
find /var/adm -type f\( -perm 2 \) | xargs ls -las
修改文件:
chmod 644 /var/adm/utmp

论坛徽章:
0
5 [报告]
发表于 2003-01-24 15:48 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

------------------------------------
3) Configuration files for each zone
There is a configuration file of each zone defined in named.conf.
These files are in /var/named . You have to create this directory.
a) /var/named/named.ca
This file is used when you are connected to internet.
I got this file on internet. It seems rather old, maybe you
can have a more recent one.
; Begin of file
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the \"cache . <file>;\"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Aug 22, 1997
; related version of root zone: 1997082200
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; temporarily housed at NSI (InterNIC)
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
;
; housed in LINX, operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; temporarily housed at ISI (IANA)
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; housed in Japan, operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File

b) /var/named/named.local
You must have an alias postmaster that points to the user root
or another one.
; Begin of file
$TTL 3D
@ IN SOA zarba.zerezo.org. postmaster.zarba.zerezo.org. (
1999112002 ;
28800 ;
14400 ;
604800 ;
86400 );
NS zarba.zerezo.org.
1 PTR localhost. ; Adresse IP reverse
; End of file

c) /var/named/zerezo.org
; Begin of file
$TTL 3D
@ IN SOA zarba.zerezo.org. postmaster.zarba.zerezo.org. (
1999112002 ; numero de serie
28800 ; rafraichissement
14400 ; nouvel essais
604800 ; expiration
86400 ); temps de vie minimum
; NS = server de nom de domaine
@ IN NS zarba
@ IN NS zarba.zerezo.org.
; MX = server de mail, numero = priorite
@ IN MX 10 zarba
@ IN MX 20 zarba.zerezo.org.
; localt dns server
@ IN A 127.0.0.1
@ IN A 192.168.0.51
; server IP
localhost IN A 127.0.0.1
zarba IN A 192.168.0.51
; IP of others machines of the network
karine IN A 192.168.0.52
yaf IN A 192.168.0.7
; aliases
www IN CNAME zarba
ftp IN CNAME zarba
mail IN CNAME zarba
; End of file

d) /var/named/db.192.168.0
; Begin of file
$TTL 3D
@ IN SOA zarba.zerezo.org. postmaster.zarba.zerezo.org. (
1999112002 ; numero de serie
28800 ; rafraichissement
14400 ; nouvel essais
604800 ; expiration
86400 ); temps de vie
; nameserver
IN NS zarba.zerezo.org.
; IP Reverses adresses
1 IN PTR zarba.zerezo.org.
2 IN PTR karine.zerezo.org.
3 IN PTR yaf.zerezo.org.
; End of file

------------------------
4) Configuration of rndc
rndc is used to administrate bind. His developpment is not
fisnished but i prefer to put it in this hint rather than
the obsolete nslookup utility.
a) Creation of a key
You have to get a key so rndc can communicate with bind :
dnssec-keygen -a hmac-md5 -b 128 -n user rndc
It will create you two files. Get the value of the key in the .key one.

b) /etc/rdnc.conf
Create the file and edit the key please.
; Begin of file
options {
default-server localhost;
default-key rndc_key;
};
server localhost {
key rndc_key;
};
key rndc_key {
algorithm hmac-md5;
secret \"Xd3zz2FgxvkML4V/BlVG8Q==\";
};
; End of file

c) Edit again /etc/named.conf and add the following lines :
key rndc_key {
algorithm hmac-md5;
secret
\"Xd3zz2FgxvkML4V/BlVG8Q==\";
};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndc_key; };
};

---------------
5) /etc/init.d/named
a) Here is the boot scripts
#!/bin/sh
# Begin /etc/init.d/
#
# Include the functions declared in the /etc/init.d/functions file
#
source /etc/init.d/functions
case \"$1\" in
start)
echo -n \"Starting dns server...\"
loadproc /usr/sbin/named
;;
stop)
echo -n \"Stopping dns server...\"
/usr/sbin/rndc stop
evaluate_retval
;;
reload)
echo -n \"Reloading dns server...\"
/usr/sbin/rndc reload
evaluate_retval
;;
restart)
$0 stop
/usr/sbin/sleep 1
$0 start
;;
status)
/usr/sbin/rndc status
evalute_retval
;;
*)
echo \"Usage: $0 {start|stop|reload|restart|status}\"
exit 1
;;
esac
# End /etc/init.d/

b) Create the links
cd /etc/rc0.d
ln -s ../init.d/named K600named
cd /etc/rc1.d
ln -s ../init.d/named K600named
cd /etc/rc6.d
ln -s ../init.d/named K600named
cd /etc/rc3.d
ln -s ../init.d/named S300named
cd /etc/rc5.d
ln -s ../init.d/named S300named

--------------------------
6) Edit /etc/resolv.conf so it use your dns server
search zerezo.org
nameserver 192.168.0.51

--------------------------
6) Test your configuration
Some tests :
dig -x 127.0.0.1
if you have a ftp server :
ftp ftp.zerezo.org
ftp zarba.zerezo.org
if you have apache, launch your browser and use as url :
http://www.zerezo.org
http://zarba.zerezo.org
If problems, look at the logs /var/log/dns* and /var/log/sys.log

检测主机安全方法
使用Yassp工具包安装安全的Solaris系统
发布日期:2001-08-16
文摘内容:
--------------------------------------------------------------------------------
本文出自: 绿盟
作者:东方
----------------------------------------------------------------------------------
1、安装系统前的准备工作  
2、系统的初始化安装  
3、安装YASSP工具包  
4、在/etc/vfsab文件中对mount文件系统加以限制  
5、在Solaris 8中安装Sunscreen EFS防火墙  
6、进一步增强系统的可靠性:路由、邮件、 解析及工具的设置  
7、补丁  
8、RPC  
9、日志、Cron、权限  
10、限制SUID类型的文件  
11、安装完整性检查工具:如Tripwire  
12、安装、检测并提高应用程序的可靠性  
13、开始工作   
1、安装系统前的准备工作  
* 简化:建议在一台主机上只运行一至两种服务。使用多台服务器,而不要只用一台超级服务器去完成所有的工作。这样便于应用的隔离,可靠性的提高,也易于排错及进行软/硬件地升级。切记,只运行必要的程序。  
* 硬件:考虑使用串囗终端安装系统。保证网络环境的可信以及封闭。  
* 保证安全地下载软件:在一个封闭的或者没有对外路由的网络环境中,通过ftp与网络内部其它主机传送文件。如果网络并不是完全封闭的,要在文件传输完成后,马上断开网络的连接,以减小遭到攻击的机会。添加一个以/tmp为HOME目录的非特权用户专门用来在主机间传送文件。
* 清楚系统的用途、硬件的配置等。有时为了提高系统的可靠性可能会导致某些程序不能正常运行,如CDE/OpenWindows,Disksuite及Legato运行都需要RPC的支持,但是在用作为防火墙的主机上,要关闭RPC。  
* 理解各种应用的工作方式非常重要(比如应用如何使用端囗、设备及文件),这样才可以判断哪些方面需要加强及存在的风险。   
2、系统的初始化安装  
连接串囗终端,加电,按下Stop-A键使主机进入到OK提示符模式,使用boot cdrom -install命令开始安装过程。  
选择以最终用户包(end user bundle)或者核心包(core)模式进行安装,设置主机名,终端类型,IP地址,所在时区等,不要开启任何的命名服务,如NIS或NFS。不要打开电源管理或者mount远程文件系统。  
注:对于Solaris 8系统,使用F4功能键可以对最终用户包内的软件进行定制。   
分区注意的事项:  
* 对于syslog、web、新闻、代理服务器或者防火墙过滤主机,要为其/var文件系统建立一个独立的,较大磁盘空间的分区。将要存储大量数据的服务器,如web或ftp服务器,也应该使用独立的分区存储其数据。  
* 将/usr及/opt分区与根区分离,使得/usr及/opt分区可以使用只读(read-only)方式mount。  
* 如果一定要使用Disksuite工具,设置RAID及磁盘镜像,需要为其保留5MB的磁盘空间。使用Veritas的文件卷管理,还需要额外的两个分区。  
* 分区实例:  
2GB硬盘,不在本地记录日志,将在/opt下安装大量程序  
200MB /(root+var),200MB swap,400MB /usr,1.2GB on /opt  
2GB硬盘,为程序保留最大空间,/var分区独立(使得日志文件不会把根区占满)  
1.6GB /(root+usr+opt),200MB swap,200MB /var  
9GB硬盘,主机提供服务  
200MB /,500MB swap,2GB /usr,5GB /opt,1GB /var   
系统重启   
为root设置一个不易破解的囗令(7到8位,包含数字、字母及标点符号)。安装过程将保留在/var/sadm/install_data/install_log文件中。  
以最终用户包模式安装时,需要手工安装帮助文件(man pages)。如果用核心包模式安装,为了使用帮助文件,还需要安装SUNWlibc包:  
cd /cdrom/cdrom0/s0/Solaris_2.6/Product;  
pkgadd -d . SUNWman SUNWdtma SUNWjvman SUNWpmowm SUNWolman SUNWxwman  
cd /cdrom/cdrom0/s0/Solaris_2.7/Product;  
pkgadd -d . SUNWman SUNWdtmaz SUNWdtma SUNWjvman SUNWpmowm SUNWxwman  
针对Solaris8系统,使用2号光盘安装标准帮助文件及java帮助  
cd /cdrom/cdrom0/Solaris_*/Product;  
pkgadd -d . SUNWman SUNWjvman SUNWj2man   
此外,还需要安装一些常用的工具,如解压缩及其它shell。  
pkgadd -d . SUNWgzip SUNWbash SUNWbzip SUNWtcsh SUNWzlib   
升级索引,以便使用“man -k keyword”命令时,搜索相关的帮助:  
/usr/lib/makewhatis /usr/man;  
/usr/lib/makewhatis /usr/openwin/man;   
使用核心包模式安装的用户,还需要安装其它常用的软件包,如:  
Terminfo:SUNWter  
Accounting:SUNWaccr SUNWaccu  
NTP:SUNWntpr SUNWntpu  
UCB tools:SUNWscpu  
Man pages tools:SUNWlibC SUNWdoc。   
下载并安装Sun的最新推荐安装补丁包到/opt/install目录:  
2.6 SPARC 2.6_Recommended.tar.Z  
7 SPARC 7_Recommended.zip  
7 Intel 7_x86_Recommended.zip  
8 SPARC 8_Recommended.zip  
8 Intel 8_x86_Recommended.zip   
* 安装补丁之前,阅读README文件并保存系统已经安装的补丁列表,解压缩补丁包文件。  
cd /opt/install;  
showrev -p >; patches.before;  
unzip -q 8_*Recommended.zip  
注:如果只安装了核心包,showrev命令将不能使用,使用patchadd -p命令代替。  
在Solaris7系统中使用patchadd命令,需要对命令做以下改动:  
cd /usr/sbin;  
mv patchadd patchadd-orig;  
sed s/\\/xpg4// patchadd-orig >; patchadd;  
chown root:bin patchadd;  
chmod 555 patchadd;   
* 进入解压缩补丁包后产生的目录,使用下面两种方法执行安装角本文件:  
a) 在新安装的系统中,使用带有nosave参数的安装命令,可以节省磁盘空间:  
cd 8_*Recommended;./install_cluster -nosave  
b) 在需要可能进行反安装补丁文件的系统中,使用如下命令进行补丁的安装,这时将在/var/sadm/pathc目录下保留备份文件。补丁只可以逐个加以删除,系统没有提供"deinstall_cluster"的命令。  
./install_cluster  
* 检查实际安装了哪些补丁  
cd ..;  
showrev -p >; patches.after;  
diff patches.after patches.before;  
* 查看安装日志文件,返回值8代表没有安装,返回值2表示补丁安装正常。  
more /var/sadm/install_data/Solaris_*Recommended_log   
重新启动系统,以root登录。   
3、安装YASSP工具包  
安装YASSP(Yet Another Solaris Security Package,目前的版本是Yassp beta#15)加强Solaris系统的安全性,它包含多个编译好的安全工具。
注:安装YASSP后,所有有改动过的文件将在/yassp.bk/Before_DATE目录中保留备份。
将YASSP安全工具的安装过程记录到文件中,提供日后查询:  
script -a /yasspinstall.log  
下载yassp.tar.gz文件,保存到/opt/install目录中,切断网络连接。  
ifconfig hme0 down  
解压缩软件包,产生yassp目录  
gunzip < yassp.tar.gz | tar xf -  
cd yassp; ls -l  
Yassp包文件详细清单  
drwxr-xr-x 2 7644 7001 512 Nov 20 06:54 RCS  
-r-------- 1 7644 100 14482 Nov 20 06:54 README  
-r--r--r-- 1 7644 100 8418 Nov 20 06:52 WhatIsNew  
-rw-r--r-- 1 7644 7001 66 May 21 2000 admin  
-rw-r--r-- 1 7644 100 61952 Nov 20 01:20 aubtocsin  
lrwxrwxrwx 1 7644 100 9 Nov 22 10:13 aubtocsin_i386 ->; aubtocsin  
lrwxrwxrwx 1 7644 100 9 Nov 22 10:13 aubtocsin_sparc ->; aubtocsin  
-rw-r--r-- 1 7644 100 136192 Nov 20 06:54 gnugzip_i386  
-rw-r--r-- 1 7644 100 147456 Nov 20 06:54 gnugzip_sparc  
-rw-r--r-- 1 7644 100 903168 Nov 20 06:54 gnurcs_i386  
-rw-r--r-- 1 7644 100 1021952 Nov 20 06:54 gnurcs_sparc  
drwxr--r-- 3 7644 100 512 Nov 20 06:53 html_doc  
-r-xr-xr-x 1 7644 100 5323 Nov 20 05:25 install.sh  
-rw-r--r-- 1 7644 100 3180544 Nov 20 06:54 openssh_i386  
-rw-r--r-- 1 7644 100 4121600 Nov 20 06:54 openssh_sparc  
-rw-r--r-- 1 7644 100 26624 Nov 20 06:54 parcdaily  
lrwxrwxrwx 1 7644 100 9 Nov 22 10:12 parcdaily_i386 ->; parcdaily  
lrwxrwxrwx 1 7644 100 9 Nov 22 10:12 parcdaily_sparc ->; parcdaily  
-rw-r--r-- 1 7644 100 231936 Nov 20 06:54 prftripw_i386  
-rw-r--r-- 1 7644 100 293888 Nov 20 06:54 prftripw_sparc  
-rw-r--r-- 1 7644 100 1290240 Nov 20 06:54 secclean  
lrwxrwxrwx 1 7644 100 8 Nov 22 10:12 secclean_i386 ->; secclean  
lrwxrwxrwx 1 7644 100 8 Nov 22 10:12 secclean_sparc ->; secclean  
-rw-r--r-- 1 7644 100 271360 Nov 20 06:54 wvtcpd_i386  
-rw-r--r-- 1 7644 100 609792 Nov 20 06:54 wvtcpd_sparc  
执行安装文件  
./install.sh  
依据提示安装下列工具:SECclean GNUrcs GNUgzip PARCdaily WVtcpd(包括rpcbind) PRFtripw OPENssh  
SECclean是一个脚本文件,它通过对文件权限的配置,tcp/ip的调整,关闭不必要的服务加强系统的可靠性。   
Yassp beta#15中的问题:  
1. SSH:  
* Yassp在Solaris7及以前版本的系统中不安装SSH,只在Solaris8中安装。  
* Scp的服务器端需要如下设置:  
chmod 755 /usr/local /opt/local  
ln -s /usr/local/bin/scp /usr/bin/scp  
2. Solaris 8 10/00版本的系统中,有一个新的守护进程'picld',是一种对客户端发布特定平台信息的机制,picld进程负责维护及控制客户及内插模块对PICL(Platform Information and Control Library)信息的访问。  
关闭此进程  
mv /etc/rcS.d/S95picld /etc/rcS.d/.S95picld  
mv /etc/init.d/picld /etc/init.d/.picld  
3. Tocsin是Yassp内含的入侵检测工具,用来侦听网络数据包,缺省情况下不安装。
pkgadd -d aubtocsin   
配置YASSP  
安装完YASSP后,首先浏览一下/etc/yassp.conf配置文件,带有注释,很容易理解。查看yassp.conf及yassp的man pages帮助。一般情况下,除了SSH,不需要改动什么。
1. 帐号  
* 守护进程及用户(DEF_UMASK)的缺省umask值都被设置成为077,禁止组及全局访问。在某些情况下,可能需要将umask值改为027,使组可读。  
* cleanup_passwd脚本会关闭/usr/passwd文件中的用户帐号,但是不会删除他们。Yassp.conf文件中的USERDENIED变量包含缺省的列表。加入非标准的应用帐号。  
* 如果确定删除某些帐号,将其加入yassp.conf文件中的USEDELETED变量项中,并从新执行cleanup_passwd。  
注:此操作可能会产生无主文件或导致错误,如删除uucp将使tip命令不能使用。
* ROOTALLOWED变量包含所有UID为0的帐号列表,cleanup_passwd会关闭所有列表之外的UID为0的帐号。  
2. Cron:  
* 非root用户需要使用at/cron命令时,需要编辑/etc/cron.d目录下的allow/deny文件。
* root的cron列表将会被替换。如果在安装yassp之前,你已经在cron中添加了条目,这些条目需要重新加入,旧的cron列表备份于/yassp.bk目录中。  
* yassp的daily脚本用来整理日志记录,在cron中将其注释掉。  
3. SSH:Yassp将同时安装SSH的客户及服务器端  
* 最新版本的SSH可以被“tcp wrapper"保护,因此使用前,要在/etc/hosts.allow文件中放开,缺省是全部关闭。  
* SSH服务对所有主机开放,编辑/etc/hosts.allow加入  
sshd : ALL  
* 允许X11转发使用SSH,编辑/etc/hosts.allow加入  
sshdfwd-X11 : LOCAL  
* 提示:在hosts.allow/deny,SSH的规则中不要使用反向finger查询。  
* 在SSH中,通常使用'scp'传送文件。' sftp'使用于新的SSH2中,如果需要,在/etc/sshd_config中打开它,当然,由于这是一项新的功能,因此有可能会存在问题。Subsystem sftp /opt/local/libexec/sftp-server  
* 不接受RSA用户认识,而只允许使用囗令。  
RSAAuthentication no  
* 检查服务器(/etc/sshd_config)及客户端(/etc/ssh_config)其它的设置,如设置只允许特定的用户使用SSH,禁止用守护进程的帐号使用SSH。
4. Syslog:在Solaris8系统中,Yassp会以‘-t'参数启动syslog,因此它将不接受其它主机syslog连接。因此,如果你想使用一台中心log服务器,需要设置SYSLOGFLAGS=""  
5. 如果需要启动INETD服务,设置RUNINETD值为YES,并在/etc/inetd.conf中开放相应的服务。   
缺省情况下,yassp会关闭所有的服务。如果确实需要,使用tcp wrapper,编辑/etc/hosts.allow和/etc/hosts.deny文件中对访问服务进行限制。  
6. nscd守护进程  
* 不启动nscd进程,有些应用,如Netscape的http代理服务将不能工作,设置NETSCAPE或者NSCD变量可以设置激活nscd进程。  
* 关闭nscd进程将加重nameserver的负载,因此,通过调整resolv.conf文件中nameserver的顺序,可以达到平衡负载的目的。  
7. 编辑登录的标语文件,对非法的用户访问提出警告。对于telnet和SSH,登录前的文件为/etc/issue,登录后的文件是/etc/motd  
8. Yassp更改/etc/system文件内的参数对Solaris系统进行调整。
* Yassp增加对文件描述的字节限制,rlim_fd_max=1024、rlim_fd_cur=256。有些应用也许会需要更大的值,根据需要改动。  
* 将小于8的soft-limit增加到256对一些应用会有帮助。Hard-limit不需要改变,仍为1024。系统管理员需要知道哪些应用需要更多的hard-limit值,并对/etc/system做相应的改动。
* 设置sys:coredumpsize=0从而不产生corefiles。当然有时候,管理员需要corefiles进行分析,但是也要注意corefiles可能会泄露敏感的信息。
* 其它的设置:  
*Increase SVR4 style ptys  
set pt_cnt=128  
*Attempt to prevent and log stack-smashing attacks
set noexec_user_stack=1  
set noexec_user_stack_log=1  
*enable advanced memory paging technique  
*NOT NEEDED ON Solaris 8:set priority_paging=1   
set tcp:tcp_conn_hash_size=16348  
*If the NFS_PORTMON variable is set,then clients are required to use  
*privileged ports(portsSet nfssrv:nfs_portmon=1  
*max users processes in here too  
set maxuprc=150   
关闭记录动作,删除yassp安装目录  
#exit  
Script done,file is /yasspinstall.log  
#cd; rm -rf /opt/install/yassp

论坛徽章:
0
6 [报告]
发表于 2003-01-24 15:49 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

重新启动,使改动生效  
#reboot   
重新启动后,检查控制台上的错误信息,如果有,更正之。以root登录,检查网络联接情况,应该只有ssh和syslog(Solaris7及以前版本)在监听:  
netstat -a   
UDP: IPv4  
Local Address Remote Address State  
-------------------- -------------------- -------  
*.* Unbound  
TCP: IPv4  
Local Address Remote Address Swind Send-Q Rwind Recv-Q State  
-------------------- -------------------- ----- ------ ----- ------ -------  
*.* *.* 0 0 24576 0 IDLE  
*.ssh *.* 0 0 32768 0 LISTEN  
*.* *.* 0 0 32768 0 IDLE   
--------------------------------------------------------------------------------  
4、在/etc/vfsab文件中对安装文件系统做限制  
在安装文件系统时,使用一些参数可以提高文件系统的安全性和鲁棒性。使用mount命令检查哪些参数生效,这些参数包括:nosuid、logging、noatime、size=xxxm、ro。   
Mount参数  
OS版本  
描 述  
用 途  
nosuid   
2.x  
关闭SUID程序及SUID设备  
不允许存在SUID的/var、 /home或者数据磁盘分区及设备(建议使用chroot environments).。如果/tmp分区不在磁盘上,此参数无效。   
logging  
2.7或者更高版本
为分区记录transaction日志。可以大提高文件系统检查的速度,特别是针对大容量的磁盘。缺点是需要耗费时间进行写log的操作。   
/usr /opt /home分区
建议除根区(如果使用了Veritas的VxVM)和对磁盘写性能要求非常高的分区外,都使用此参数。   
noatime  
2.7或者更高版本  
允许mount的文件系统,在每次访问文件时对文件节点号不做更新,这样可以显著提高某些服务,   
如对大量小文件进行频繁IO操作的web cache或者新闻服务。  
/var或者文件频繁存取的分区 (web缓存或news分区)。   
size=100m  
2.5.1 or later  
允许/tmp分区只使用100MB的交换空间。这个值通常取交换的30%。  
在mount /tmp时使用  
ro  
2.x  
只读。将文件系统mount成为只读只能对文件系统做有限制的保护(因为攻击者一旦取得root权限,他可以将文件系统重新mount成读写)。  
可以缩短系统启动时,执行fsck的时间,提高性能的同时,可以避免管理员无意中的错误(如误删除文件等)。  
/usr及/opt分区最好mount成为只读方式,但是将/usr分区mount成为只读方式的情况下,通常需要将/usr/local建立的另外的分区上。   
在编辑vfstab文件时要特别小心,对/ 及/usr分区的错误改动可能会导致系统不能引导。如果出现这种情况,使用安装光盘将以单用户模式引导后,mount上有错误的磁盘,更正vfstab文件后,reboot使改动生效。  
下面是vfstab文件的两个例子:  
一个只有/及/var的服务器,操作系统是Solaris2.8  
fd - /dev/fd fd - no -  
/proc - /proc proc - no -  
/dev/dsk/c0t3d0s1 - - swap - no logging  
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no logging  
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /var ufs 1 no logging,nosuid,noatime  
swap - /tmp tmpfs - yes size=100m  
有较多分区的服务器  
fd - /dev/fd fd - no -  
/proc - /proc proc - no -  
swap - /tmp tmpfs - yes size=200m  
/dev/dsk/c0t8d0s0 /dev/rdsk/c0t8d0s0 / ufs 1 no logging  
/dev/dsk/c0t8d0s1 - - swap - no -  
/dev/dsk/c0t8d0s4 /dev/rdsk/c0t8d0s4 /usr ufs 1 no logging  
/dev/dsk/c0t8d0s6 /dev/rdsk/c0t8d0s6 /var ufs 1 no nosuid,noatime,logging  
/dev/dsk/c0t8d0s5 /dev/rdsk/c0t8d0s5 /opt ufs 2 yes logging   
5、在Solaris 8中安装Sunscreen EFS防火墙  
安装本地防火墙对系统进行保护。   
1. 在Solaris 8系统的iPlanet CD#2光盘上,带有Sunscreen EFS的限制版。也可以从Sun的主页下载此版本。  
2. 对于老版本的Solaris系统,可以使用Ipfilter作为本机防火墙。   
Sunscreen EFS可以保护网络通信,下面使用命令行对防火墙规则的设置作简单介绍。  
* 防火墙的安装:在最终用户模式安装Solaris8系统,安装防火墙时,如果提示没有安装SUNWsprot,需要用Solaris2号光盘先行安装:   
pkgadd -d /cdrom/sol_8_sparc_2/Solaris_8/Product SUNWsprot   
再使用iPlanet CD#2光盘,启动Sunscreen安装工具:   
/cdrom/cdrom0/SunScreen/screenInstaller   
除了Naming services=DNS(不使用NIS)外,其它选项都使用缺省设置。  
配置:设置简单的防火墙规则,找到正在运行的防火墙规则,显示缺省规则并对其进行编辑。   
#cd /opt/SUNWicg/SunScreen/bin;  
#./ssadm active  
Active configuration:www default Initial.2  
#./ssadm edit Initial  
edit>;list rule  
1 "common""*""*"ALLOW  
edit>;list address  
"*"RANGE 0.0.0.0 255.255.255.255  
"le0.net"RANGE 176.17.17.0 176.17.17.255  
"localhost"HOST  
"smtp-server"HOST 1.1.1.1  
"www_le0"GROUP{}{}  
edit>;list service common  
"commom"GROUP"tcp all""udp all""syslog""dns""rpc all""nfs prog""icmp   
all""rip""ftp""real audio""pmap udp all""pmap tcp all""rpc tcp   
all""nis""archie""traceroute""ping"   
可以看出,缺省的规则让很少的服务通过。   
我们假设在设置一台HTTPD服务器(在80端囗),并使用SSH进行管理。允许使用ping和   
traceroute命令进行初步的错误检查。我们需要如下设置防火墙的规则:   
#./ssadm edit Initial  
edit>;add service ssh SINGLE FORWARD "tcp" PORT 22  
edit>;add service myhttp GROUP ping traceroute ssh www  
edit>;replace rule 1 ALLOW myhttp"*""*"  
edit>;list rule  
1 "myhttp""*""*"ALLOW  
edit>;save  
edit>;verify  
Configuration verified successfully(not activated)  
edit>;quit  
www#./ssadm activate Initial  
Configuration activated successfully on www  
* 在一台管理机上,允许使用ssh和smtp(用来email报警),可以对外使用ping/traceroute,进行检查,为降低风险,只响应其它管理主机的ping/traceroute请求。允许通过HTTPS及使用dns查询。  
# cd /opt/SUNWicg/SunScreen/bin;  
# ./ssadm edit Initial  
edit>; add address mgt_net RANGE 176.17.17.0 176.17.17.255  
edit>; add service mgt GROUP ping traceroute ssh  
edit>; add service https SINGLE FORWARD"tcp" PORT 443  
edit>; add service outgoing GROUP ping traceroute dns  
edit>;  
edit>; replace rule 1 ALLOW www "*" localhost  
edit>; replace rule 2 ALLOW https "*" localhost  
edit>; replace rule 3 ALLOW mgt mgt_net localhost  
edit>; replace rule 4 ALLOW outgoing localhost "*"  
edit>; replace rule 5 ALLOW smtp localhost mgt_net  
edit>;  
edit>; save  
edit>; verify  
Configuration verified successfully (not activated).  
# ./ssadm activate Initial  
Configuration activated successfully on www.  
检查网络连接,确定改动的规则已经生效。如果要恢复初始设置,将所有的规则删除后,加入下面一行:  
replace rule 1 ALLOW "common""*""*"   
最后,关闭防火墙的远程图形管理功能,只使用"ssadm"命令行工具进行管理。  
注释掉/etc/rc2.d/S63sunscreen文件中的下面一行:  
$SS_LIBDIR/run_httpd start efshttpd  
在/opt/SUNWicg/SunScreen/lib/ss_boot中,注释掉:  
$SS_LIBDIR/ssadmserver star>;/dev/console 2>;&amp;1   
6、进一步增强系统的可靠性:路由、邮件、 解析及工具的设置到此,系统已经进行了初步的加固,以root方式登录。  
* 设置路由  
* 对于缺省路由,将网关的IP地址添加到/etc/defaultrouter文件中。  
* 对于静态路由,使用route命令创建/etc/init.d/static_routes文件及   
/etc/rc2.d/S99static_routes符号连接  
* 清空路由表,为特定网络指定路由,如:  
route -f add net 129.97 `cat /etc/defaultrouter`  
* 如果需要运行路由守护进程(不建议使用),要清楚其工作原理,否则它可能会导致你网络通信的不正常。使用'-q'参数的“安静”模式(quiet mode),或者在使用ifconfig命令配置网络接囗设备时,使用'private'参数,告诉网络接囗设备不要对外广播路由信息。运行“安静”模式,要在/etc/yassp.conf文件中设置SUNSTARTUP=YES并确定没有设置缺省路由。  
* 配置/etc/hosts文件,添加不想通过DNS解晰的服务器名。  
* DNS客户端:(对于关键任务的主机不要设置)在/etc/resolv.conf文件中添加域名及DNS服务器名,在/etc/nsswitch.conf文件中hosts行添加DNS条目。  
* 环境的设置:在/.cshrc /.profile:设置aliases和变量(如VISUAL,EDITOR和PATH,路径的环境变量中不要包括当前路径"."。  
* 使用useradd工具在系统中添加新的用户。首次运行后,会产生/etc/sadm/defadduser缺省新加用户设置。可以编辑此文件,对新增用户做缺省的设置。  
* 邮件客户端的设置:如果不对外网外送邮件,则不需要配置mailhost alias(在/etc/hosts文件中),如果不需要任何形式的邮件服务,删除/etc/lib/sendmail程序。否则:  
* 编辑/etc/mail/aliases文件,至少将mailer-daemon、根及其它系统帐户指向其真实地址。  
* 在/etc/hosts文件中加入带有IP地址的邮件服务器条目,alias用mailhost。  
* 将完整的域名添加到/etc/hosts中,设置hostname.YOURDOMAIN.COM的alias。  
* 在/etc/mail/sendmail.cf文件中作如下设置,确保所有的外发邮件通过邮件主机发送(前面两行在Solaris8中无需设置):  
Dj$w.YOURDOMAIN.COM.  
DSmailhost  
DRmailhost  
Dhmailhost  
O FallbackMXhost=mailhost  
* 在root的cron中加入如下条目,将缓存的邮件在工作时间内每小时发送一次  
0 6-22 * * 1-5 /usr/lib/sendmail -q  
* 发送一封测试邮件,对配置进行检查  
mailx -v -s test_email root * Email服务器:设置Email服务器(运行SMTP服务),在这里不做详细介绍。   
Reboot,查错  
安装相应的工具及脚本,确保程序已经在其它主机上编辑测试通过。  
* 将安全工具安装在/secure目录中,如下面会用到的:rotate_cron,rotate_log,wtrim.pl,   
rdistd,Saveit,Weekly。然后将/secure目录模式设置为:  
chmod 700 /secure;chown -R root /resure  
* 在Solaris8系统的附件光盘上,如Software Companion光盘带有许多常用的工具,如PPP、samba、wu-ftp(出于安全性考虑,避免使用)、Development/Libraries、Development/Tools、   
X11应用、vim/emacs、Windows管理器等。使用图形化的安装工具或者通过SSH和X11隧道登录到服务器上,进入相应的目录,使用pkgadd命令进行安装。  
* 安装其它的常用工具,如traceroute、top或者lsof(不要设置SUID位)。  
* 安装perl,并建立/bin/perl符号链接(ln -s /usr/local/bin/perl /bin/perl)。  
Solaris8系统已经内置了一个版本的perl,但最好删除它(pkgrm SUNWpl5u SUNWpl5p SUNWpl5m),从Sunfreeware.com下载最新的版本进行安装(pkgadd -d perl-5.6.0-sol8.sparc-local)。   
7、补丁  
系统在安装时会自动安装推荐补丁包,但是它并不包含所有的安全补丁。定期检查最新的补丁,安装了最新安全补丁的系统要比没有安装的系统可靠的多。  
补丁通常有标准补丁(Standard patches)、推荐补丁(Recommended patches)、安全补丁(Security patches)、2000年补丁(Y2K patches),patch clusters是以上补丁的集成包。单点补丁(Point patches)是针对特定问题的补丁。   
通过下列方法,了解已知的漏洞及相应的补丁程序:  
1. 订阅相关组织及公司(如CERT/First、SUN、Bugtraq)的邮件列表。  
2. 订阅有关漏洞及补丁的邮件列表,如Security Portal(Solaris Digest)、   
SecurityFocus(Sunr的部分)或者SANS。  
3. 定期使用工具,检查服务器上安装的补丁是否与Sun发布的最新补丁列表相一致。  
4. 一至两月检查一次Sun推荐的补丁包,需要注意的是安装推荐补丁包时,如果对内核打补丁可能会导致一些应用的不正常。  
5. 某些第三方的应用的补丁也需要加以关注。   
注:安装补丁可能会改动Yassp的配置,因此在安装完补丁重启系统后,要仔细检查是否启动了不需要的进程。   
针对补丁的工具  
* GetApplyPatch和CheckPatches是两个管理Solaris补丁的Bshell的脚本工具。  
1.CheckPatches使用showrev命令查看已经安装的补丁,并与Solaris的补丁报告相比较,列出需要安装的推荐及安全补丁。补丁报告SolarisX.PatchReport通常在当前目录下,也可以使用-f参数通过FTP下载最新的补丁报告  
>;./CheckPatches -f  
2.GetApplyPatch:用来获得并安装最新的补丁,使用补丁号码作为执行脚本时的参数。运行时,会提示是否下载,显示补丁的README文件,安装补丁后,删除安装目录。使用'-b'参数以"batch mode"运行,则不做提示。  
>;./GetApplyPatch 108875-07  
CheckPatches.cron是一个自动运行的脚本,并将结果mail给管理员。  
3.同时使用这两个脚本文件,获得需要的补丁并进行安装。  
>;./CheckPatches | ./GetApplyPatch  
GetApplyPatch.cron可以用来自动执行,取得补丁并进行安装,但是关键任务的服务器上不推荐使用它。  
4.其它的特点:  
* 带有man帮助文件  
* 支持Solaris Intel及Sparc,通过测试  
* 可以设置ftp代理  
* CheckPatches可以忽略无需安装的补丁。比如,在Solaris8 x86系统中,运行CheckPatches后,提示需要下面的补丁:  
109897-03 SunOS 5.8_x86: USB patch  
109952-01 SunOS 5.8_x86: jserver buffer overflow  
110417-02 SunOS 5.8_x86: ATOK12 patch  
对于这些补丁,我们并不想安装。创建Solaris8_x86.PatchReport.Except,在文件中加入上面三行,在次运行CheckPatches脚本时会将它们忽略。  
* 也可以对CheckPatches的命令输出做过滤,如:  
./CheckPatches | egrep -v "109897|109952|110417"  
* Sunsolve提供的Patchdiag工具,与最新的Patchdiag.xref一起,可以检查系统缺少哪些补丁,然后下载并安装这些补丁。  
* 使用SecurityFocus的vulnerability calculator工具,运行下面的命令  
(http://securityfocus.com/focus/sun/form.html)  
>;showrev -p |cut -f2 -d' ' | xargs  
将结果粘贴到窗囗中,然后选择操作系统。在得出结果的中选择与自己主机上的应用相关的内容进行修补。  
* FastPatch可以用来替代patchadd命令,它的执行速度更快。  
* Patchreport是另外一个用perl语言编写的非常全面的补丁检查工具。   
8、RPC  
在关键任务主机,避免使用RPC服务。RPC使用动态分配的端囗及非标准的存取控制方法。但是,确有一些应用需要使用RPC,如CDE、Open Windows、Disksuite及Legato Networker。   
如何提高Disksuite的安全性  
Disksuite是系统内置的工具,用来做磁盘镜象及设置RAID。它需要RPC的支持(在inetd中运行的rpc.metamhd和rpc.metad)。  
1. 尽量不运行Disksuite  
* 硬件RAID的好处在于不需要特殊的软件支持。这对于对安全性要求较高的系统十分有利。而且当出现问题时,你会发现Disksuite并不是太容易使用的。  
* 对于象是系统盘等,数据并不会频繁变动的系统盘,作镜像(cold mirroring)就足够了,使用脚本mirror_boot.sh可以完成此项工作。  
2. 运行Disksuite,但是停止RPC服务。停止inetd.conf中的'metad'服务会引起以下结果:  
* 'metatool'将不会工作,但是命令行工具还可以运行。为了应付系统盘的灾难性错误,最好了解这些命令行工具。  
* Disksets-系统间共享的metadevices将不能使用。  
3. 如果使用Disksuite和RPC,使用Wietse Venema的RPCBIND。   
* Solaris8系统自带的Sunscreen EFS Lite Firewall可以用来对rpc服务的存取进行限制。  
* IPfilter也可以用来做限制RPC服务访问的本地防火墙。  
* IPfilter可以在8以前的老版本的Solaris上运行,并且是免费的。  
* It's doesn't have an RPC state based engine though(so it can't filter on RPC program names or allow RPC to specific destinations)。  
* But it can be used to allow all localhost RPC traffic(enough for some RPC applications such as Disksuite or CDE)and deny all remote traffice except,say,HTTP or whatever service is provided to remote hosts。  
* 使用Wietse Venema的rpcbind(包含在Yassp的tarball里),可以提供类似tcp wrapper的访问控制和日志记录。Rpcbind是一种“目录”服务用来定位某一种服务(通过RPC名或者RPC号)。因为它并不是连接服务的中介,因此它并不能真正为RPC程序提供访问控制。用端囗扫描器可以检测激活的RPC服务,除非内核被定制成过滤这些连接,否则并不能防止对服务的访问。   
9、日志、Cron、许可  
配置日志及pruning:  
* Syslog日志:Yassp使用修改过的/etc/syslog.conf配置,开启了更多的日志记录保存在/var/adm/messages中。同时也安装了一个可选的/etc/syslog.conf.server,是为loghosts设计的并将不同的服务存在分开的log文件中。  
* Yassp关闭了root帐号cron中有关log的条目。添加了运行'daily'脚本。   

配置Syslog  
Syslog客户端:在/etc/hosts文件中指定log服务器。  
* 测试log服务器是否正常  
logger -p auth.warn "test of syslog",检查是否记录在log服务器里。  
* 在log服务器及本地同时记录日志,取消/etc/syslog.conf中的下一行注释:  
*.err;auth.info;kern.debug /var/adm/messages  
* 如果日志记录不能正常工作,可以参照syslog.conf中的例子及提示。  
Syslog服务器(loghost):  
* log服务器需要一块大的磁盘用来保存日志文件。  
* 在Solaris8系统中,Yassp将以"-t"参数启动syslog,因此它将不接受其它主机的记录日志的请求。如果想要设置集中的log服务器,需要在/etc/yassp.conf中设置SYSLOGFLAGS=""。  
* Yassp还安装了一个/etc/syslog.conf.server配置文件,是针对log服务器并将不同的服务产生的日志存于/var/log目录下不同的文件中。用它覆盖配置文件并重新启动syslog:  
mv /etc/syslog.conf /etc/syslog.conf.client  
cp /etc/syslog.conf.server /etc/syslog.conf  
kill -l `cat /etc/syslog.pid`  
* 使用rotate_log工具对日志进行管理和压缩,在root的cron中加入:  
##Prune syslog logs weekly,keeping the last 6 months or so:  
55 23 * * 6 /secure/rotate_log -n 40 alertlog  
55 23 * * 6 /secure/rotate_log -n 40 authlog  
55 23 * * 6 /secure/rotate_log -n 40 cronlog  
55 23 * * 6 /secure/rotate_log -n 40 daemonlog  
55 23 * * 6 /secure/rotate_log -n 40 kernlog  
55 23 * * 6 /secure/rotate_log -n 40 local0log  
55 23 * * 6 /secure/rotate_log -n 40 local2log  
55 23 * * 6 /secure/rotate_log -n 40 local5log  
55 23 * * 6 /secure/rotate_log -n 40 newslog  
55 23 * * 6 /secure/rotate_log -n 40 userlog  
55 23 * * 6 /secure/rotate_log -n 40 lprlog  
55 23 * * 6 /secure/rotate_log -n 40 maillogd  
在root的cron中加入每年清理日志文件的条目  
##Empty login/logout records at year end  
0 0 31 12 * /secure/wtrim.pl wtmp 20  
0 0 31 12 * /secure/wtrim.pl wtmpx 20  
#  
#Solaris 2.x logs  
0 4 * * 6 /secure/totate_log -L /var/adm -n 30 loginlog  
0 4 * * 6 /secure/rotate_log -L /var/adm -n 30 sulog  
0 4 * * 6 /secure/rotate_log -L /var/adm -n 2 vold.log  
0 4 * * 6 /secure/rotate_cron   
其它的需要在root的cron设置条目:  
每天与可靠的时间源进行时间同步,使用rdate(NTP会更加精确,但会带来相应的风险)  
##Synchronise the time:  
0 * * * * /usr/bin/rdate YOURTIMEHOST >;/dev/null 2>;&amp;1  
安装检查重要进程是否运行的脚本,monitor_processes.pl并在root的cron中加入:  
##Check that important processes are running during office hours:  
##[If you run 7x24,modify accordingly]  
0,30 8-19 * *1-5 /secure/monitor_processes.pl sshd httpd   
每次安装新的程序后,最好在文件中记录下来,如:  
cat >;/etc/mods<15.10.00 james New install of Solaris8 and tools  
EOF   
10、限制SUID文件  
设置SUID位的文件,允许用户以文件所有者的权限执行此程序。常用来让普通用户执行只有root能运行的程序,但是存在缓存溢出的风险。  
* Solaris有很多“SUID root”的执行程序,每一个都会带来风险,因此尽可能多的停止SUID程序。  
* 阅读SUID的参考文件   
发现系统中的SUID文件  
使用find命令:  
find / -perm -u+s -ls  
find / -perm -g+s -ls 查找GUID程序   
如何处理SUID文件:  
* 直接删除  
* 关闭程序(chmod 000 FILENAME)  
* 移去SUID位(chmod ug-s FILENAME)  
* 对文件回以组限制(首先移去所有人的权限 chmod o-rwx),允许组访问(chgrp MYGROUP MYFILE)。   
哪些SUID文件需要回以限制  
* 在一些具有用户帐号的敏感服务器上或者关键的进程由非root用户运行,应尽可能地减少SUID文件。  
* 对于可靠性要求非常高的系统,建议除"pt_chmod","utmp_update"和"su"以外,其余全停。  
* Reg Quinton解释了每一个SolarisSUID程序,并给出配置建议。  
* 例子:  
* 象uucp这样的工具,基本无用,可以删除  
pkgrm SUNWbnuu  
chmod ug-s /usr/bin/cu /usr/bin/uu* /usr/lib/uucp/*  
* 另一个没有用处的工具包是kcms(Kodak Color Management System)  
pkgrm SUNWkcspf SUNWcspx SUNWkcspg SUNWkcsrt  
chmod ug-s /usr/openwin/bin/kcms*  
* 如果不使用打印机  
chmod ug-s /usr/lib/lp/bin/netpr /usr/sbin/lpmove /usr/bin/lp /usr/bin/lpset   
/usr/bin/lpstat /usr/bin/cancel /etc/lp/alerts/printer  
* 只允许root使用r命令  
chmod ug-s /usr/bin/rcp /usr/bin/rlogin /usr/bin/rsh  
* 只允许root对网络进行侦听及列出进程列表  
chmod ug-s /usr/sbin/snoop /usr/sbin/devinfo /bin/rdist /usr/bin/netstat   
/usr/local/bin/top /usr/sbin/traceroute /usr/local/bin/lsof /usr/bin/*/ps   
/usr/ucb/*/ps /usr/sbin/*/whodo /usr/bin/*/uptime /usr/bin/*/w  
* 只允许root做备份和恢复  
chmod ug-s /usr/lib/fs/ufs/ufsdump /ufs/ib/fs/ufs/ufsrestore  
* 假设不使用YP、NIS+  
chmod ug-s /usr/bin/chkey  
* 只允许root使用cron和at  
chmod ug-s /usr/bin/at /usr/bin/atq /usr/bin/atrm /usr/bin/crontab  
* 只允许root管理系统  
chmod ug-s /usr/bin/admintool /usr/lib/fs/ufs/quota /usr/bin/tip /usr/bin/fdformat   
/usr/bin/eject /usr/bin/volcheck /usr/bin/volrmmount /usr/bin/rmformat  
* 不使用Openwindows和CDE  
chmod ug-s /usr/dt/bin/* /usr/openwin/*/*  
* Sendmail:不做email服务器的主机不需要sendmail设置SUID位  
chmod u-s /usr/lib/sendmail  
* 进行以上的操作后,以“最终用户”模式安装的Solaris8系统中,SUID文件列表如下:  
usr/lib/pt_chmod /usr/lib/utmp_update /usr/bin/login /usr/bin/newgrp /usr/bin/newtask   
/usr/bin/pfexec /usr/bin/su /usr/bin/passwd /usr/sbin/allocate /usr/sbin/mkdevalloc   
/usr/sbin/mkdevmaps /usr/sbin/ping /usr/sbin/sacadm /usr/sbin/deallocate   
/usr/sbin/list_devices /usr/sbin/pmconfig /opt/local/bin/ssh /usr/bin/yppasswd   
/usr/bin/nispasswd are also SUID, but they are links to /usr/bin/passwd.  
* 在package数据库中仍然保留有末被改变的SUID文件  
find / -perm -u+s -exec pkgchk -l -p {} \; |more  
* 列出所有的SUID文件及属于哪一个包  
find / -perm -u+s -exec pkgchk -l -p {} \; | more  
11、安装完整性检测工具:如Tripwire  
应该经常对系统中文件的完整性进行检查,以确保他们没有被恶意的改变。Solaris提供了"pkgchk -n"命令将安装的文件大小、权限及校验与package数据库进行比较。但是检验是可以会欺骗的,数据库也可能会被更改。因此,真正需要的是采用安全的hashing算法的文件完整性检查工具。  
Yassp将在/secure/tripwire中安装tripwire。它采用多种hashing算法。系统安装到这个阶段,我们建议对新配置的系统及文件创建快照(snapshot),初始化tripwire的数据库,定期进行检查变动情况。如果有可能的话,将主数据库单独保存。   
文件完整性检查的可选功能
* Tripwire:有免费和商业两种版本  
* 建议在中心服务器上使用商业版本,更加稳定,在其它主机上使用免费的版本。  
* PGP可用,PGP can also be used,by signing files to be protected(creating lots of signature files),then writing a script to check the validity of signatures.This will not catch permission,link,inode or modify date changes though.  
* MD5 signatures(单向hash算法)可能同样使用,但是MD5签名列表不要保存在被监视的主机上,除非已经加密或者PGP signed。   
使用免费Tripwirer例子:  
* Yassp安装/secure/tripwire/tripwire及缺少的配置tw.config,也可以获得源代码后自行编译。  
* 如果需要,编辑/secure/tripwire/tw.config,符合自己要求。  
* 接下来,做系统的初始状态。  
cd /secure/tripwire; ./tripwire -i 2 -initialise -c tw.config建立一个新的文件数据库。可能会有一些文件无法找到的报错信息,忽略它们。把新产生的数据库(在/secure/tripwire/database)复制到软盘上。在将来如果怀疑系统遭受攻击或者改动时,可以使用此文件。  
* 可以在cron中设置每天进行检查,也可以手工进行
./tripwire -i 2 -c tw.config  
* 告诉tripwire,文件及目录的改变正常  
tripwire -update [/file1 /file2 /patch3.....]  
* improvements:  
* tripwire数据库如果保存在同一主机上,应压缩并加密,或者用强加密工具(如PGP)对其进行sign。  
* 从一台信任主机上检查其它系统,复制tripwire及其数据库,通过SSH远程运行它,检查完后,删除数据库文件。  
* 这样使得攻击者难于觉察系统采用了tripwire进行监控。  
* 阅读脚本trip_host.sh,过滤掉“无文件及目录”报错。它必须从‘master'主机上运行,对目标机有SSH信任关系。   
第一次运行  
/secure/tripwire/trip_host.sh -init HOST  
以后每次运行  
/sevure/tripwire/trip_host.sh -check HOST   
将database文件妥善保存。   
12、安装、测试、加固应用程序  
特定的应用,如FTP、DNS、Email等将在其它文章中论述。   
13、开始使用  
准备使用  
1.如果不再需要使用CD-ROM,在/etc/yassp.conf中关闭volume manager。如果在今后需要安装CD,手工启动vold进行新设备的检测:  
drvconfig;disks;vold &amp;; df -k  
2.如果在安装调试的过程当中,必须将/opt及/usr分区安装成为read-write,那么此时,将它们mount成为read-only。  
3.重新做tripwire的初始化。  
4.将系统备份到两盘磁带上,one offsite。  
5.使用扫描器扫描系统,确保只有需要的服务开启。  
6. 请其他人做测试,避免遗漏。  
7. 详细检查-什么在工作?什么被禁止?检查控制台/log的内容,系统是否如希望那样工作?经常检查日志记录。   
日常维护  
* 使用Sun的Patchdiag进行补丁的检查,需要就进行升级。对于内核的补丁,要在别的机器上先进行测试。  
* 检查所有的错误日志及异常行为:syslog(/var/adm/messages或   
/var/log/*log),/var/cron/log,last,/var/adm/sulog,/var/adm/loginlog,application/server   
日志记录。  
* 编写脚本,报告关键进程是否正常,关键的系统是否可以ping通。  
* 运行tripwire。  
* 定期查看最新的漏洞及风险报告。   

===================================================================================  
此文的原文在这里  
http://www.boran.com/security/sp/Solaris_hardening3.html  

安装配置SSH(Secure Shell)
SSH是一个用来替代TELNET、FTP以及R命令的工具包,主要是想解决口令在网上明文传输的问题。为了系统安全和用户自身的权益,推广SSH是必要的。SSH有两个版本,我们现在介绍的是版本2。
安装SSH
具体步骤如下:
获得SSH软件包。 (ftp://ftp.pku.edu.cn:/pub/unix/ssh-2.3.0.tar.gz)
成为超级用户(root).
# gzip –cd ssh-2.3.0.tar.gz |tar xvf –
# cd ssh-2.3.0
# ./configure
注意,如果你希望用tcp_wrappers来控制SSH,那么在configure时需要加上选项“--with-libwrap=/path/to/libwrap/”, 用来告诉SSH关于libwrap.a 和tcpd.h的位置。
# make
# make install
和SSH有关的程序都放置在/usr/local/bin下,包括ssh,sftp,sshd2, ssh-keygen等。
二、配置
SSH的配置文件在/etc/ssh2下,其中包括sshd2的主机公钥和私钥:hostkey和hostkey.pub。这两个文件通常是在安装SSH时自动生成的。你可以通过下面的命令重新来生成它们:
# rm /etc/ssh2/hostkey*
# ssh-keygen2 –P /etc/ssh2/hostkey
而ssh2_config 文件一般情形下无需修改。
三、启动sshd2
每个要使用SSH的系统都必须在后台运行sshd2。用手工启动:
# /usr/local/bin/sshd2&amp;
可以在“/etc/rc2.d/S99local”中加入该命令,这样系统每次启动时会自动启动sshd2。
四、用tcp_wrappers控制SSH
安装SSH的站点可以用tcp_wrappers来限制哪些IP地址可以通过ssh来访问自己。比如,在/etc/hosts.allow中加入
sshd,sshd2: 10.0.0.1
那么只有10.0.0.1可以通过ssh来访问该主机。
以上都是系统管理员完成的工作。下面我们说说普通用户如何使用SSH。
五、基本应用
每个用户在使用SSH之前,都要完成以下步骤:
在本地主机(比如,local.pku.edu.cn)上生成自己的ssh公钥和私钥。命令如下:
local# ssh-keygen
Generating 1024-bit dsa key pair
1 oOo.oOo.o
Key generated.
1024-bit dsa, teng@ns, Fri Oct 20 2000 17:27:05
Passphrase :************ /*在此输入你的口令,以后访问这台主机时要用。
Again :************ /*
Private key saved to /home1/teng/.ssh2/id_dsa_1024_a
Public key saved to /home1/teng/.ssh2/id_dsa_1024_a.pub
生成的私钥和公钥(id_dsa_1024_a和id_dsa_1024_a.pub)存放在你家目录的~/.ssh2目录下。和用户相关的SSH配置文件都在~/.ssh2下。私钥由用户保存在本地主机上,而公钥需传送到远地主机的你自己的帐号的~/.ssh2下,如果你要用ssh2访问本地主机的话。
在~/.ssh2下创建“identification”文件用来说明进行身份认证的私钥。命令如下:
local:~/.ssh2# echo "IdKey id_dsa_1024_a" >; identification
3.同样地,在远地主机(比如,remote.pku.edu.cn)上完成上面步骤。
4.将本地(local.pku.edu.cn)下你自己(这里是“teng”)的公钥(id_dsa_1024_a.pub)拷贝到远地主机(remote.pku.edu.cn)上你自己家目录下的.ssh2目录下,可命名为“local.pub”,一般用ftp上传即可。
在远地主机上,你自己家目录的.ssh2目录下,创建“authorization”文件,其中指定用来进行身份认证的公钥文件。命令如下:
remote:~/.ssh2# echo “Key local.pub” >; authorization
现在你可以从本地用ssh2登录到远地系统了。命令如下:
local# ssh remote.pku.edu.cn
Passphrase for key "/home1/teng/.ssh2/id_dsa_1024_a" with comment "1024-bit dsa,
teng@ns, Fri Oct 20 2000 17:27:05":***********
这时会要你输入你的ssh口令(Passphrase)。验证通过后,即登录到remote主机上

论坛徽章:
0
7 [报告]
发表于 2003-01-24 15:50 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

Solaris IP Multipathing made easy
I've recently setup a bunch of machines for IP multipathing (i.e. recent to this article - Nov 28, 2001) by following the Sun blueprint paper. I thought I would share a simpler step by step approach.
get 2 network interface cards in your machine (some machines, like Netra T1 series have 2 builtin). It is not required that they be the same type (e.g. Sun SF280 would have an eri0 internal and an hme in a PCI slot), but it is important that they have the same speed capability.
Obtain 4 IP addresses in the same local lan (or vlan) segment. In Multipathing there are 2 fixed (or private) address and 2 floating (or public) addresses. The 2 fixed addresses I refer to as internal. One is assigned directly to each hardware interface. The 2 floating addresses are the external ones. If one of the NICs detects link failure, the address tied to that NIC fails over to the working NIC. When the NIC comes back up, the address fails back to its original home. Determine right now which will be your internal IPs and which will be your external. I recommend keeping the same convention for all Multipathed machines, no matter what convention you choose. Here are two typical conventions:
The first 2 IPs in the series are fixed and the second 2 are floating.
The odd IPs are fixed and the even IPs are floating (or vice versa)
edit /etc/hosts with your 4 IPS. example:
298.178.99.137    host-int0
298.178.99.138    host-int1
298.178.99.139    host-ext0 host-dummy
298.178.99.140    host-ext1 host.eng.auburn.edu

In this example, the first two ips are fixed (internal) to the NICs, and the second 2 are floating. The last one is the one we use to tie to the machine name for programs that might have licensing restrictions tied to particular hostnames. (Always make the hostname tied to one of the public/external/failover NICs)
Configure network interfaces.
At the beginning you'll have one network interface (the secondary) that is unconfigured, and another that would initially look something like this:
hme0: flags=1000843 mtu 1500 index 2
inet 298.178.99.141 netmask fffffff0 broadcast 298.178.99.143
ether 8:0:20:ff:5b:e2

You need to configure the secondary interface and make it have a unique ether address that is persistent across reboots. I like to take the address of the hme0 (or eri0 or whatever) card and add 1 to the last octet.
# eeprom 'local-mac-address?=true'
# /sbin/ifconfig hme1 plumb
# /sbin/ifconfig hme1 ether 8:0:20:ff:5b:e3
Setup hostname.* files.
You can pretty much copy these two files as is and just modify them slightly to fit your naming conventions in the same way that you setup the /etc/hosts file
above.
/etc/hostname.hme0
host-int0 netmask + broadcast + group production deprecated -failover up \
addif host-ext0 netmask + broadcast + failover up

/etc/hostname.hme1
host-int1 netmask + broadcast + group production deprecated -failover up \
addif host-ext1 netmask + broadcast + failover up

adjust failover detection timeouts
/etc/default/mpathd has a default failover timeout of 10000. This means that it should take 10 at most seconds to detect and successfully fail over an interface. I like to configure this to 2500. In my working with IP multipathing, numbers below that seem to result in excessive messages about that number being too low and lots of messages in syslog. If you change this file, you will have to restart mpathd. Now is as good a time as any to either restart mpathd or start it for the first time if it is not already running.
If you use a default router, it must be pingable at all times from both interfaces. mpathd will ping your default router every at <FAILURE_DETECTION_TIME>; second intervals. If you do not use a default router, then you need to run the router discovery daemon /usr/sbin/ in.rdisc. This daemon should start automatically at boot time under the appropriate circumstances, but doesn't always (See Sun blueprint article for more thorough discussion). It is helpful to have a helper file to automatically start it if it is not already running. You can use this one if you like. Save it as /etc/rc2.d/ S70rdisc and make a link in /etc/init.d
When do you want to use which? It boils down to the same choices on a non multipathed host. Do you have one router on your lan or do you have multiple? If you have only one (or a pair using HSRP or other failover protocol), then you can use a default route. If you have more than one router, then you want to use in.rdisc much as you would use routed in a non multipathed host setup. Make sure you have router discovery announcements enabled on your routers in this situation.
TIP
Plug each physical interface into a separate switch to make effective use of multipathing. After that there are several ways you can configure your high availability. You can plug each switch into 2 routers and use HSRP to do router failover. In this case, having the Sun use a default route would be fine. Or, you could have each switch singly connected to a specific router on the same lan, and run in.rdisc on the sun to detect these interfaces and perform failover. A typical configuration is illustrated at right.
make it active
This is the easy part. Copy and paste your /etc/hostname.hme* files to ifconfig commands as below:
# /sbin/ifconfig hme0 host-int0 netmask + broadcast + group production deprecated -failover up \
addif host-ext0 netmask + broadcast + failover up
# /sbin/ifconfig hme1 host-int1 netmask + broadcast + group production deprecated -failover up \
addif host-ext1 netmask + broadcast + failover up
Troubleshooting
Occassionally you will see messages like this in your syslog files:
Nov 29 16:02:10 host.eng.auburn.edu in.mpathd[32]: [ID 398532 daemon.error]
Cannot meet requested failure detection time of 2500 ms on (inet  eri0) new
failure detection time is 5922 ms
Nov 29 16:12:29 host.eng.auburn.edu in.mpathd[32]: [ID 122137 daemon.error]
Improved failure detection time 3644 ms
Nov 29 16:12:29 host.eng.auburn.edu in.mpathd[32]: [ID 122137 daemon.error]
Improved failure detection time 2500 ms

I find that they are largely ignoreable. Failover still works.
There is a known issue with Solaris8 IMP where both interfaces can fail under high load if a particular patch is not installed. Reboot will not fix the situation, you must have the patch: 108528-15
When you have a failure event of some kind, you'll see a message like this:
Nov 21 23:03:58 host.eng.auburn.edu in.mpathd[266]: [ID 832587 daemon.error]
Successfully failed over from NIC eri1 to NIC eri0

When it comes back, you'll see one like this:
Nov 23 15:25:00 host.eng.auburn.edu in.mpathd[266]: [ID 620804 daemon.error]
Successfully failed back to NIC eri0

If you see one like this, it's time to run to the switch closet:
Nov 23 15:23:56 host.eng.auburn.edu in.mpathd[266]: [ID 168056 daemon.error]
All Interfaces in group production have failed

Take the opportunity to test it out. Unplug one of your Cat5+ cables and watch failover work. Run a continuous ping to the machine. It's rather nice.
Failover with 1 public IP
Now that you know how to setup resilient balancing links, you might be interested in how to setup a group with only 1 public, failover interface.
The advantages of this are
easier debugging - With the previous situation, you would have to snoop on both interfaces and correlate the traffic. With only 1 interface, you snoop in one place and see all traffic
easier firewalling - With 2 public interfaces, the traffic could initiate from either, possibly making firewalling a bit difficult since the source traffic could change from one IP to the other mid session.
1 fewer IP consumed.
The following configuration has been tested and submitted by Eric Krohn
Primary Interface
# cat /etc/hostname.hme0
DUMMY1  netmask + broadcast + \
group production deprecated -failover up \
addif REALNAME netmask + broadcast + failover up

Standby Interface
# cat /etc/hostname.hme1
DUMMY2 netmask + broadcast + \
group production deprecated -failover standby up

/etc/hosts file
# cat /etc/hosts
#
# Internet host table
#
127.0.0.1       localhost      
192.168.10.10   REALNAME  loghost
192.168.10.11   DUMMY1
192.168.10.12   DUMMY2
#

What does this do? It sets up two dummy (private) IP addresses that are fixed to the interfaces. It sets up a failover group named production. It adds an IP REALNAME to the group and marks it as the failover IP that will be migrated, and hme1 is set as the standby interface. In most situations, hme0 will be used to transmit and receive packets. In the case of failure (interface, switch, cable, router, etc), the IP for REALNAME will migrate to hme1 interface. When hme0 recovers, the IP will migrate back.
Contact the author
Go to my homepage
请问在CDE登陆的时候,输入PASSWD错误,会过一会才能显示密码错误,而不能立即显示。
如何更改使其可以立即显示?
这是Solaris的安全机制,如果密码出错的话,默认会等待4秒,可以在/etc/default/login中修改:
SLEEPTIME=4
将其改为
SLEEPTIME=0

Storing iptables Information
Rules created with the iptables command are only stored in RAM. If you were to restart your system after setting up various iptables rules, they would be lost and you would need to retype them. If you want particular rules to take effect whenever your system boots, you need to save them to the /etc/sysconfig/iptables file.
To do this, arrange your tables, chains, and rules the way they should be the next time the system boots or iptables is restarted, and type the /sbin/service iptables save command as the root user. This causes the iptables init script to run the /sbin/iptables-save program and write the current iptables configuration to the /etc/sysconfig/iptables file. This file should only be readable by root, so your precise packet filtering rules are not viewable by average users.
The next time the system boots, the iptables init script will reapply the rules saved in /etc/sysconfig/iptables by using the /sbin/iptables-restore command.
While it is always a good idea to test a new iptables rule before committing it to the /etc/sysconfig/iptables file, it is possible to copy iptables rules into this file from another system's version of this file. This allows you to quickly distribute sets of iptables rules to many different machines at once. Simply restart iptables to make the new rules take effect.
今天在SUN的网站找到1篇文章,推荐大家参考,大虾小虾都有参考价值,关键是集中了,各个方面的命令,不全(全了就没法看了),但还实用。
Debugging  
truss executable
/* Trace doing of given command ( useful debugging ) */  
truss -f -p <pid of a shell>;
/* Using multiple windows, this can be used to trace setuid/setgid programs */  
[ Back to Top ]
Arp, ethernet trouble shooting  
arp -a .
/* Shows the ethernet address arp table */  
arp -d myhost
/* Delete a stale ethernet entry for host myhost */   

Disk Commands  
du -k .
/* Reports disk space used in Kilobytes */  
du -sk .
/* Reports only total disk space used in Kilobytes */  
du -ad /var | sort -nr
/* Tells you how big the /var files are in reverse order */  
fdformat -d -U
/* format diskette */  
/usr/bin/iostat -E
/* Command to display drives statistics */  
/bin/mount -F hsfs -o ro /dev/sr0 /cdrom
/* Mount an ISO 9660 CDROM */  
prtvtoc /dev/rdsk/c0t0d0s2
/* Disk geometry and partitioning info */  
quot -af
/* How much space is used by users in kilobytes */   

Driver Parameters  
ndd /dev/ip \?
/* Shows IP variables in the kernel */  
ndd /dev/ip ip_forwarding
/* Tells you if forwarding is on (=1) */  
ndd -set /dev/ip ip_forwarding 1
/* Enables IP forwarding between interfaces */   

File Manipulation  
dos2unix | -ascii <filename>;
/* Converts DOS file formats to Unix */  
split
/* Split files into pieces */  
[vi] : %s/existing/new/g
/* Search and Replace text in vi */  
[vi] :set nu
/* Set line numbers in vi */  
[vi] :set ts=[num]
/* Set tab stops in vi */   

File System  
cat /dev/null >; filename
/* Zero's out the file without breaking pipe */  
dd if=/dev/rdsk/... of=/dev/rdsk/... bs=4096
/* Make a mirror image of your boot disk */  
df -k | grep dg| awk '{print $6}' |xargs -n 1 umount
/* Unmount all file systems in disk group dg */  
fsck -F ufs /dev/rdsk/c0t0d0s0
/* Check a UFS filesystem on c0t0d0s0 */  
fsck -F ufs -y /dev/rdsk/c0t0d0s0
/* Check answering yes to all questions */  
fsck -F ufs -o b=97472 /dev/rdsk/c0t0d0s0
/* Check using an alternate super block */  
gzip -dc file1.tar.gz | tar xf -
/* Unpack .tar.gz files in place */  
ls -la | awk '{ print $5,"    ",$9 }' | sort -rn
/* File sizes of current directory */  
mount -f pcfs /dev/dsk/c0d0p1 /export/dos
/* Mount DOS fdisk partition from Solaris */  
mount -F ufs -o rw,remount /
/* Used to remount root to make it writeable */  
mount -o remount,logging /spare
/* Re-mount the ro file system rw and turn on ufs logging */  
tar cvf filename.tar
/* Create a tape (tar) archive */  
tar xvf filename.tar
/* Extract a tape (tar) archive */  
tar cf - . | (cd /newdir ; tar xf -)
/* Recursively copy files and their permissions */  
/sbin/uadmin x x
/* Syncs File Systems and Reboots systems fast */  
zcat <patch_file.tar.Z | tar xvf -
/* Extract the patch_file that is a compressed tar file */   

File Transfer  
put "| tar cf - ." filename.tar
/* Undocumented Feature of FTP */  
find . -depth | cpio -pdmv /path/tobe/copied/to
/* Fast alternative to cp -pr */  
sendport
/* Transferring large numbers of files within the same ftp control session */   

General  
/usr/bin/catman -w
/* Create windex databases for man page directories */  
mailx -H -u <username>;
/* List out mail headers for specified user */  
set filec
/* Set file-completion for csh */   

Hardware  
cfgadm
/* Verify reconfigurable hardware resources */  
m64config -prconf
/* Print M64 hardware configuration */  
m64config -depth 8|24
/* Sets the screen depth of your M64 graphics accelerator */  
m64config -res 'video_mode'
/* Change the resolution of your M64 graphics accelerator */   

Kernel  
/usr/sbin/modinfo
/* Display kernel module information */  
/usr/sbin/modload <module>;
/* Load a kernel module */  
/usr/sbin/modunload -i <module id>;
/* Unload a kernel module */  
nm -x /dev/ksyms | grep OBJ | more
/* Tuneable kernel parameters */  
/usr/sbin/sysdef
/* Show system kernal tunable details */   

Memory  
prtconf | grep "Memory size"
/* Display Memory Size */   

Network Information  
ndd /dev/arp arp_cache_report
/* Prints ARP table in cache with IP and MAC address */  
netstat -a | grep EST | wc -l
/* Displays number active established connections to the localhost */  
netstat -k hme0
/* Undocumented netstat command */  
netstat -i
/* Show the TCP/IP network interfaces */  
netstat -np
/* Similar to arp -a without name resolution */  
netstat -r
/* Show network route table */  
netstat -rn
/* Displays routing information but bypasses hostname lookup. */  
netstat -a | more
/* Show the state of all sockets */  
traceroute <ipaddress>;
/* Follow the route to the ipaddress */   

Network/Tuning  
ifconfig eth0 mtu 1500
/* Change MTU of interface */  
ifconfig eth0 10.1.1.1 netmask 255.255.255.255
/* Add an Interface */  
/sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 255.255.0.0 broadcast 10.210.xxx.xxx
/* Virtual Interfaces */  
/sbin/ifconfig hme0:1 up
/* Bring virtual interface up */  
/usr/sbin/ndd -set /dev/hme adv_100fdx_cap 1
/* Nailling to 100Mbps */  
ndd -set /dev/ip ip_addrs_per_if 1-8192
/* To set more than 256 virtual ip addresses. */  
ndd -set /dev/tcp tcp_xmit_hiwat 65535
/* Increase TCP-transmitbuffers */  
ndd -set /dev/tcp tcp_recv_hiwat 65535
/* Increase TCP-receivebuffers */   

Processes  
fuser -uc /var
/* Processes that are running from /var */  
kill -HUP `ps -ef | grep [p]roccess | awk '{print $2}'`
/* HUP any related process in one step */  
pfiles <pid>;
/* Shows processes' current open files */  
pkill -n <name>;
/* Kill a process by name */  
kill `ps -ef | grep program_name | grep -v grep | cut -f8 -d ' '`
/* pkill for solaris 2.6 */  
prstat -a
/* An alternative for top command */  
/usr/ucb/ps -aux | more
/* Displays CPU % usage for each process in ascending order */  
/usr/ucb/ps -auxww | grep <process name>;
/* Gives the full listing of the process (long listing) */  
ps -ef | grep -i <string>; | awk '{ print $2 }'
/* Creates list of running PID by */  
ps -ef | grep -v "0:00" | more
/* Gives you a list of any process with CPU time more than 0:00 */  
ps -ef | more
/* Show all processes running */  
ps -fu oracle|grep pmon
/* See which instances of Oracle are running */  
/usr/proc/bin/ptree <pid>;
/* Print the parent/child process 'tree' of a process */  
/usr/proc/bin/pwdx <pid>;
/* Print the working directory of a process */  
top -b 1
/* Returns the process utilizing the most cpu and quits */   

Resource Management  
/usr/bin/ldd [filename]
/* List the dynamic dependencies of executable files */  
/usr/proc/bin/pmap pid
/* Report address space map a process occupies */   

Route Configuration  
route add net 128.50.0.0 128.50.1.6 1
/* Adds route to 128.50 network via 128.50.1.6 */  
route delete net 128.50.0.0 128.50.1.6
/* Deletes route to 128.50 network */  
route get [hostname]
/* Which interface will be used to contact hostname */  
route monitor
/* Monitors traffic to the routes */  
route flush
/* Removes all entries in the route table */   

Searching Items  
egrep "patterna|patternb" <filename>;
/* Search for multiple patterns within the same file */  
find . -exec egrep -li "str" {} \;
/* Find a string in files starting cwd */  
find / -fstype nfs -prune -o fstype autofs -prune -o -name filename -print
/* Find without traversing NFS mounted file systems */  
find . -mtime -1 -type f
/* Find recently modified files */  
find / -mtime <# of days>;
/* Find files modified during the past # of days */  
find . ! -mtime -<days>; | /usr/bin/xargs rm -rf
/* Finds and removes files older than <days>; specified */  
find . -type f -exec grep "<sub-string>;" {} \; -print
/* Find files containing <sub-string>; within directory tree */  
find . -type f -print | xargs grep -i [PATTERN]
/* Recursive grep on files */  
find / -user <username>;
/* Find all files owned by <username>; */  
find / | grep [file mask]
/* Fast way to search for files */  
find <start_path>; -name "<file_name>;" -exec rm -rf {} \;
/* Recursively finds files by name and automatically removes them */  
find /proc/*/fd -links 0 -type f -size +2000 -ls
/* Find large files held open by a process */  
ls -lR | grep <sub_string>;
/* Fast alternative to find */   

Security  
echo 'Please go away' >; /etc/nologin
/* Stops users logging in */  
find / -perm -0777 -type d -ls
/* Find all your writable directories */  
find / -type f -perm -2000 -print
/* Find all SGID files */  
find / -type f -perm -4000 -print
/* find all SUID files */   

Set Terminal Options  
stty erase ^H
/* Sets the Backspace Key to erase */  
stty erase ^?
/* Sets the Delete Key to erase */  
stty sane
/* Rreset terminal after viewing a binary file. */  
tput rmacs
/* Reset to standard char set */   

Snoop Your Network  
snoop -d pcelx0
/* Watch all network packets on device pcelx0 */  
snoop -o /tmp/mylog pcelx0
/* Saves packets from device pcelx0 to a file */  
snoop -i /tmp/mylog host1 host2
/* View packets from logfile between host1 &amp; host2 */  
snoop -i /tmp/mylog -v -p101
/* Show all info on packet number 101 from a logfile */  
snoop -i /tmp/mylog -o /tmp/newlog host1
/* Write a new logfile with all host1 packets */  
snoop -s 120
/* Return the first 120 bytes in the packet header */  
snoop -v arp
/* Capture arp broadcasts on your network */   

Swap File  
mkfile -v 10m /export/disk1/myswap
/* Makes a 10 Megabyte swapfile in /export/disk */  
mkfile -nv 10m /export/disk1/myswap
/* Makes an empty 10 Megabyte swapfile */   

Swap Space  
swap -s
/* List the amount of swap space available, also see mkfile */  
swap -a /export/disk1/swapfile
/* Add a swapfile */  
swap -d /dev/dsk/c0t0d0s4
/* Deletes a swap device */  
swap -l
/* List the current swap devices */   

System Configuration  
/usr/sbin/eeprom auto-boot? false
/* Changes eeprom autoboot? setting without going to Ok prompt */  
/usr/sbin/eeprom diagswitch? true
/* Set the system to perform diagnostics on the next reboot. */  
/usr/sbin/grpck
/* Check /etc/group file syntax */  
/usr/sbin/pwck
/* Check /etc/passwd file syntax */  
/usr/sbin/sys-unconfig
/* Clear host specific network configuration information */   

System Information and Monitoring  
coreadm -e log
/* Report global core */  
/usr/sbin/eeprom
/* Show eeprom parameters */  
grep "\-root" /var/adm/sulog | grep -v \+ | tail -25
/* List most recent attempts to switch to superuser account. */  
isainfo -bv
/* Quickly checkout if machine is in 32 or 64 bit mode */  
last
/* Tells who was or still is on the system */  
logger -i
/* Log the process ID */  
/usr/sbin/prtconf -vp
/* Show system configuration details */  
/usr/platform/`/bin/uname -i`/sbin/prtdiag -v
/* System Diagnostics */  
psrinfo | wc -l
/* Display number of processors */  
sar -A <time in sec>;
/* Provides cumulative system report. */  
sar -a <time in sec>;
/* Report use of file access system routines. */  
sar -u
/* Report CPU Utilization */  
uname -a
/* Displays system information */  
vmstat 10
/* Displays summary of what the system is doing every 10 seconds */  
ypcat hosts | sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4
/* Take the input of "ypcat hosts" or "cat /etc/inet/hosts" and sort by IP. */   

How to Mount or Unmount a USB Mass Storage Device Without vold Running  〈------
# mount -F fs-type /dev/rdsk/cntndnsn /mount-point
所以你现在的状态应该是自动mount上去的

#mount看看mount到哪去了,就可以直接用了,
或者停下来,手动mount
# /etc/init.d/volmgt stop
# umount /mount-point
# mount -F fs-type /dev/rdsk/cntndnsn /mount-point
你就可以到/mount-point操作了
我解决问题了!
方法是:
1.把usb盘插入usb口
2.stop +a
3.boot -r
4.启动后执行/etc/init.d/volmgt stop
5.umount /dev/dsk/c*t*d*s*
6 mount /dev/dsk/c*t*d*s* /mnt
结束。
谢谢大家。
系统启动是暂停屏幕是按什么键
系统启动是暂停屏幕是按什么键用cntl+s可以停住;
用cntl+q继续显示。

给你点资料要吗?
What are IP Network Multipathing Outbound Load Spreading?
How can we configure and how can we confirm if it is working or not?
NOTE: IP Network Multipathing has been available since Solaris 8 10/00.
Solution Summary Top
- What is IP Networking Multipathing Outbound Load Spreading?
  Outbound network packets are spread across multiple network
  adaptors without affecting the ordering of packets in order
  to achieve higher throughput. Load spreading occurs only
  when the network traffic is flowing to multiple destinations
  using multiple connections.
- How can we configure?
  There are two ways. One is command line configuration and the other
  is using hostname file.

  (a) command line
  ifconfig <interface1>; group <group-name>;
  ifconfig <interface2>; group <group-name>;
  ifconfig <interface1>; addif <test-ip-addr-1>; -failover deprecated up
  ifconfig <interface2>; addif <test-ip-addr-2>; -failover deprecated up
  (b) hostname file
  [/etc/hostname.<interface1>;]
  <ip-address1>; group <group-name>; up \
  addif <ip-address1-1>; -failover deprecated up
  [/etc/hostname.<interface2>;]
  <ip-address2>; group <group-name>; up \
  addif <ip-address2-1>; -failover deprecated up
- How can we confirm it it is working or not?
  Here is an example flow.
  (1) decide IP address and the interface name
  
  Suppose the following IP address and the interface name.
  
    Host-A: 129.158.70.34(le0), 129.158.70.81(le1)
    Host-B: 129.158.118.65
    Host-C: 129.158.118.183
  
  Supoose the group name is "multipath-test".
  (2) create a session
  
  Create telnet session from Host-B to Host-A by explicitly specifying
  129.158.70.34.
  
  (3) identify which interface is used on Host-A
  # netstat -ran | grep UHA
    Destination           Gateway           Flags  Ref   Use   Interface
  -------------------- -------------------- ----- ----- ------ ---------
  129.158.118.65       129.158.70.246        UHA      2    100  le0 <--(*)
    :
    :
  
  From the output above, we can see only le0 is used.
  (4) configure IP multipathing on Host-A
  # ifconfig le0 group multipath-test
  # ifconfig le1 group multipath-test
  # ifconfig le0 addif le0:1 -failover deprecated up
  # ifconfig le1 addif le1:1 -failover deprecated up     
  (5) confirm the configuration validity
  # ifconfig -a
  lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4>; mtu 8232 index 1
       inet 127.0.0.1 netmask ff000000
  le0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>; mtu 1500 index 2
       inet 129.158.70.34 netmask ffffff00 broadcast 129.158.70.255
       groupname multipath-test
       ether 8:0:20:1c:0:4f
  le0:1: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,
         NOFAILOVER>; mtu 1500 index 2
      inet 129.158.70.82 netmask ffff0000 broadcast 129.158.255.255
  le1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>; mtu 1500 index 3
       inet 129.158.70.81 netmask ffffff00 broadcast 129.158.70.255
      groupname multipath-test
      ether 8:0:20:1c:0:4f
  le1:1: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,
         NOFAILOVER>; mtu 1500 index 3
      inet 129.158.70.83 netmask ffff0000 broadcast 129.158.255.255
  (6) create another session
  
  Create telnet session from Host-C to Host-A by explicitly specifying
  129.158.70.34.
  
  (7) see the physical interface utilization
  #  netstat -ran | grep UHA
    Destination           Gateway           Flags  Ref   Use   Interface
  -------------------- -------------------- ----- ----- ------ ---------
  129.158.118.65       129.158.70.246        UHA      3    286  le1 <--(*)
    :
    :
  129.158.118.183      129.158.70.246        UHA      2    140  le0 <--(*)
    :
    :
   
  We can confirm both le0 and le1 are automatically used at a time.
  This is the outbound load spreading.

  If you skip IP multipathing configuration at (4), you will see just
  le0 interface is used as follows.

  # netstat -ran | grep UHA
  129.158.118.65       129.158.70.246        UHA      3    140  le0 <--(*)
    :
    :
  129.158.118.183      129.158.70.246        UHA      2     53  le0 <--(*)
    :
    :
有块网卡,可以PING到自己的IP地址,但是PING不出去,怎么判断坏没坏
建议你把tpe-link-test?的值设置成true再去考虑其他的问题8。。
网络安装配置过程:
Jumpstart安装实例
一、正常用CD-ROM手工安装一台机器(以下称Install_sever),准备将其配置成Install Server
  <过程省略>;
二、按照用户分配的IP地址、规划的hostname,和需要利用网络安装的主机的Ethernet Address
  修改Server的/etc/hosts和/etc/ethers
  例如:/etc/hosts中加入以下行
        129.148.94.6     Client1
129.148.94.7     Client2
.
.
        /etc/ethers中加入以下行
8:0:20:30:6:9a   Client1
8:0:20:30:6:83   Client2
.
.
三、制作Solaris OS Image
  1、在Install_sever的CD-ROM中放入Solaris 8 Software 1 of 2光盘
  2、运行以下命令:
     # cd /cdrom/cdrom0/s0/Solaris_8/Tools
     # ./setup_install_server /export/install
     (其中/export/install所在的分区必须有足够的空间,至少800M以上,建议1G
      如果/分区空间不够,可选用其他目录,只要于以后使用该目录时保持一致即可
      如可以使用/export/home/install)
  3、等待程序运行完成以后,运行以下命令取出Solaris 8 Software 1 of 2光盘
     并放入Solaris 8 Software 2 of 2光盘
     # cd /
     # eject
  4、运行以下命令:
     # cd /cdrom/cdrom0/Solaris_8/Tools
     # ./add_to_install_server /export/install
  5、等待程序运行完成以后,运行以下命令取出Solaris 8 Software 2 of 2光盘
     并放入Solaris 8 Language 光盘
     # cd /
     # eject
  6、运行以下命令:
     # cd /cdrom/cdrom0/Tools
     # ./add_to_install_server -s /export/install
     按照系统提示选择"Simplified Chinese"(简体中文)选项,安装相应软件包
  7、等待程序运行完成以后,运行以下命令取出Solaris 8 Language 光盘
     # cd /
     # eject
  至此制作Solaris OS Image的工作完成
四、配置jumpstart相关信息
  1、运行以下命令
     # mkdir /jumpstart
     # cp -r /export/install/Solaris_8/Misc/jumpstart_sample/* /jumpstart
  2、用ftp将事先制作好的以下几个文件上传至/jumpstart中(ftp上传时请用ascii码格式)
     (用vi看一下文件的内容,如果文本行结尾有多余的^M,请将文件中的^M全部删除,或用
      命令dos2unix转换)
     sysidcfg
     rules
     test_prof_18G
     test_prof_36G
  3、按照用户设置的netmask(网络掩码)修改sysidcfg文件中network_interface的相关参数
     例如:
     原条目:network_interface=primary {netmask=255.255.255.0 protocol_ipv6=no}
     修改成:network_interface=primary {netmask=255.255.252.0 protocol_ipv6=no}
     保存文件
  4、运行以下命令:
     # cd /jumpstart
     # ./check<---检查rules文件语法,并生成rules.ok文件
     此时可以查看一下rules.ok文件是否生成
五、共享必要的目录
  1、编辑/etc/dfs/dfstab文件加入以下行
     share -F nfs -o ro,anon=0 /jumpstart
  2、运行以下命令:
     # /usr/lib/nfs/nfsd -a 16
     # /usr/lib/nfs/mountd
     # share /jumpstart
     # shareall
     (用以下命令查看/jumpstart是否share出来了,如果有以下输出表示share正常)
     # dfshares Install_sever
      RESOURCE       SERVERACCESSTRSPOT
        Install_sever:/jumpstart Install_sever--
六、授权Clients安装
  运行以下命令:
  # cd /export/install/Solaris_8/Tools
  # ./add_install_client -c Install_sever:/jumpstart -p Install_sever:/jumpstart Client1 sun4u
  # ./add_install_client -c Install_sever:/jumpstart -p Install_sever:/jumpstart Client2 sun4u
.
.
.
  以上命令要逐个授权在/etc/hosts中加入的每一个需要利用网络安装的主机
七、引导Client机器,利用网络安装操作系统
  1、检查网络连接是否正确
  2、Client开机后用Stop+A将机器控制在OK提示符下
  3、键入以下命令利用网络安装操作系统:
     ok boot net - install

怎样去掉CORE
在/etc/system中加入如下一行:
set sys:coredumpsize = 0
将每次重启产生的coredump大小设置为0,不需要无用的信息。
把S72savecore去掉。

禁止别人PING自己
可以放在/etc/system文件中。
set ip:ip_ip_respond_to_timestamp=0
好像是这样的
Exit code Meaning
0 No error
1 Usage error
2 Attempt to apply a patch that's already been applied
3 Effective UID is not root
4 Attempt to save original files failed
5 pkgadd failed
6 Patch is obsoleted
7 Invalid package directory
8 Attempting to patch a package that is not installed
9 Cannot access /usr/sbin/pkgadd (client problem)
10 Package validation errors
11 Error adding patch to root template
12 Patch script terminated due to signal
13 Symbolic link included in patch
14 NOT USED
15 The prepatch script had a return code other than 0.
16 The postpatch script had a return code other than 0.
17 Mismatch of the -d option between a previous patch install and the current one.
18 Not enough space in the file systems that are targets of the patch.
19 $SOFTINFO/INST_RELEASE file not found
20 A direct instance patch was required but not found
21 The required patches have not been installed on the manager
22 A progressive instance patch was required but not found < tr>;
23 A restricted patch is already applied to the package
24 An incompatible patch is applied
25 A required patch is not applied
26 The user specified backout data can't be found
27 The relative directory supplied can't be found
28 A pkginfo file is corrupt or missing
29 Bad patch ID format
30 Dryrun failure(s)
31 Path given for -C option is invalid
32 Must be running Solaris 2.6 or greater
33 Bad formatted patch file or patch file not found
34 The appropriate kernel jumbo patch needs to be installed
MAN文件转换文本
man make |col -b >; 1.txt

用DIskSuite扩展你的分区
1、准备硬盘,或者硬盘本身有剩余的Slices可供使用,或者可以减少原有的、别的Slices的大小(如:/export/home),然后新增一个Slice;
2、如果是第三种方式,备份数据;
3、使用format工具创建一个至少5M的空闲分区,供建立MetaDB用;创建新的Slices;
4、newfs这个5M的分区和新分区;
5、启动metatool,建立metaDB->;5M分区--如果没有metaDB的话,系统会提示建立;
6、点击菜单下面的“Slices...”按钮,显示当前分区状态,并且不要关闭;
7、点击左侧Templates中的第四个按钮(Stripe),生成一个逻辑设备-d0;
8、拖动Silces窗口中,需要扩大容量的分区的图标到d0上,然后“commit”该操作,此时d0上应该出现OK字样;
9、退出metatool工具,编辑/etc/vfstab文件,修改原有的设备加载名称,如:
旧->;/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6      /usr    ufs     1       no      -
新->;/dev/md/dsk/d0 /dev/md/rdsk/d0      /usr    ufs     1       no      -
10、重起系统,使新的mount点生效;
11、再次运行metatool工具,并打开Slices窗口;
12、双击右侧的d0图标,显示在中间的编辑区;
13、将Slices窗口中标示为“unassigned”的一个slice(待增加空闲分区)拖到d0的区域内,在d0上应该可以显示两个分区,第一个是原有的分区,第二个是新增的分区,再次“commit”该操作,出现OK字样后,就可以退出metatool工具
14、用df -k检查磁盘空间和分区挂接情况。

find libdl.so.1
然后手工做个链接到/usr/lib/下(既ld.so.1所在的地方)
try,我已经做过两次类似的问题了

Solstice Disksuite is a free RAID volume manager from Sun Microsystems. This article describes the method of mirroring a boot drive using Solstice Disksuite via the command line. It is best used as an example or reference rather than a complete learning tool. This article assumes that you already have a little understanding of the basic concepts of SDS. You should read the documentation from Sun SDS 4.2.1 for more information.
Typically, environments will use SDS to mirror the boot drive of a system and use VxVM(Veritas Volume Manager) to control RAID for the application data usually residing in an external disk array(s). The idea is that SDS is easier to recover from a disaster such as boot disk failure than VxVM. However, VxVM's latest versions have made improvements in its design and have alleviated a good deal of the issues involved with disaster recovery. Proper planning and management will decrease the amount of time and complexity of recovering from a disaster if the boot drives have been encapsulated by VxVM.
Solstice Disksuite comes bundled with the Solaris 8 operating system. In previous versions, you had to purchase the server media(as opposed to workstation media) that shipped with either "Internet extensions CD(Solaris 2.6)" or the "Easy Access Server 3.0 CD(Solaris 7)".
Install Solstice Disksuite 4.2.1 on Solaris 8
Insert 2 of 2 software for Solaris 8
Change directory to the source directory
# CD /cdrom/sol_8_1000_sparc_2/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages
Install SDS. I usually install all the packages even though I do not use the GUI.
# pkgadd -d . ; type "all"; answer "y" to continue with the installation for all questions.
Reboot the server after the successful installation.
# init 6
Prepare the drives for SDS
SDS uses metadevice state databases to store information on disk about the state of your DiskSuite configuration. The metadevice state database records and tracks changes made to your configuration. These databases must reside on a dedicated slice(in the case of a boot drive). I typically leave a small amount of unused space on the boot drive when installing Solaris for these databases. That is, I leave at least one unused slice with approximately 6 MB of free space available for SDS when installing Solaris. If you do not have any unused space and you have an unused slice, then you may borrow space from swap. See documentation from Sun to perform this step.
Use format command to select the boot disk and create the slice that will hold the state database.
The output from format of my boot disk looks like the following. I have the following filesystems carved: /, swap, /var, /opt, and /export/home
Part      Tag    Flag     Cylinders        Size            Blocks
0       root    wm       0 - 1392        3.13GB    (1393/0/0)  6563816
1       swap    wu    1393 - 3131        3.91GB    (1739/0/0)  8194168
2     backup    wm       0 - 7505       16.86GB    (7506/0/0) 35368272
3        var    wm    3132 - 4870        3.91GB    (1739/0/0)  8194168
4 unassigned    wm    4871 - 5740        1.95GB    (870/0/0)   4099440
5       home    wm    5741 - 7479        3.91GB    (1739/0/0)  8194168
6 unassigned    wm       0               0         (0/0/0)           0
7 unassigned    wm       0               0         (0/0/0)           0
Notice that slice 6 and 7 are unassigned and also there are 26 unused cylinders (7480 to 7505).
Create the dedicated slice for the state databases:
partition>; 6
Part      Tag    Flag     Cylinders        Size            Blocks
6 unassigned    wm    7480 - 7504       57.52MB    (25/0/0)     117800
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 7480
Enter partition size[117800b, 25c, 57.52mb, 0.06gb]: 26c
partition>; p
Current partition table (unnamed):
Total disk cylinders available: 7506 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
0       root    wm       0 - 1392        3.13GB    (1393/0/0)  6563816
1       swap    wu    1393 - 3131        3.91GB    (1739/0/0)  8194168
2     backup    wm       0 - 7505       16.86GB    (7506/0/0) 35368272
3        var    wm    3132 - 4870        3.91GB    (1739/0/0)  8194168
4 unassigned    wm    4871 - 5740        1.95GB    (870/0/0)   4099440
5       home    wm    5741 - 7479        3.91GB    (1739/0/0)  8194168
6 unassigned    wm    7480 - 7505       59.82MB    (26/0/0)     122512
7 unassigned    wm       0               0         (0/0/0)           0
partition>; label
Ready to label disk, continue? y
Note: in this example the slice is 60 MB. I made this slice bigger than what is needed. This is because I intend on adding other features to this configuration at a later time and need more space. However, you should be fine with approx. 6 Mb.
The partition table of the mirrored drive should be identical to the boot drive. Simply copy the partition table of the boot drive to its mirror
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t8d0s2
fmthard: New volume table of contents now in place
In this case c0t0d0s2 is the boot drive and c0t8d0s2 is the mirror. Notice that it is on the same controller. You should try to mirror drives across different controllers if at all possible. Basically, the fmthard command takes the partition table of the boot disk and replicates it to the mirror drive. Use the format command to verify that the partitions are exactly identical.
Configure Solstice Disksuite
Create at least 2 state database replicas on each disk. A state database replica stores DiskSuite configuration and state information. Before you can use DiskSuite, you must create state database replicas.
# metadb -a -f -c2 /dev/dsk/c0t0d0s6 /dev/dsk/c0t8d0s6
Where -a means adding; -f means force because this is the first time creating databases; and -c 2 means create 2 databases in each slice.
Create the mirror for / filesystem
Here we are creating a one-way mirror which for the time being is composed of 1 drive. Later we will attach the second drive to the mirror. The metainit command defines the metadevices that the mirror will use. The device numbers (d##) are arbitrary. I typically use 10's(1st set of submirrors), 20's(2nd set of submirrors), and 30's(mirror containing the submirrors).
# metainit -f d10 1 1 c0t0d0s0
# metainit d20 1 1 c0t8d0s0
# metainit d30 -m d10

The -f means force the creation. The "1 1" means we are creating a 1 way 1 slice metadevice. "metainit d30 -m d10" creates the metadevice mirror and attaches the submirror "d10" to it.
Update the /etc/vfstab for / filesystem and /etc/system. Do not try to edit /etc/vfstab or /etc/system manually - Use the metaroot command!
# metaroot d30
Take a look at your /etc/vfstab and notice that the / filesystem will be mounted on /dev/md/dsk rather than /dev/dsk.
Create the mirror for all other filesystems
Swap filesystem:
# metainit -f d11 1 1 c0t0d0s1
# metainit d21 1 1 c0t8d0s1
# metainit d31 -m d11
/var filesystem:
# metainit -f d12 1 1 c0t0d0s3
# metainit d22 1 1 c0t8d0s3
# metainit d32 -m d12
/opt filesystem:
# metainit -f d13 1 1 c0t0d0s4
# metainit d23 1 1 c0t8d0s4
# metainit d33 -m d13
/export/home filesystem:
# metainit -f d14 1 1 c0t0d0s5
# metainit d24 1 1 c0t8d0s5
# metainit d34 -m d14
Edit the /etc/vfstab to mount the new mirrors on boot.
The /etc/vfstab prior to updating it:
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c0t0d0s1       -       -       swap    -       no      -
/dev/md/dsk/d30 /dev/md/rdsk/d30        /       ufs     1       no      -
/dev/dsk/c0t0d0s3       /dev/rdsk/c0t0d0s3      /var    ufs     1       no      -
/dev/dsk/c0t0d0s5       /dev/rdsk/c0t0d0s5      /export/home    ufs     2       yes     -
/dev/dsk/c0t0d0s4       /dev/rdsk/c0t0d0s4      /opt    ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -
The /etc/vfstab after updating it:
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/md/dsk/d31 -       -       swap    -       no      -
/dev/md/dsk/d30 /dev/md/rdsk/d30        /       ufs     1       no      -
/dev/md/dsk/d32 /dev/md/rdsk/d32        /var    ufs     1       no      -
/dev/md/dsk/d34 /dev/md/rdsk/d34        /export/home    ufs     2       yes
-
/dev/md/dsk/d33 /dev/md/rdsk/d33        /opt    ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -
Be very careful when editing this file. It is very easy to mistype something and not be able to mount that filesystem when you reboot. I suggest carefully reviewing this file before proceeding.
Suppress harmless warning messages (optional)
Typically, after a SDS install, you will receive the harmless but annoying messages on boot-up: "WARNING: forceload of misc/md_hotspares failed". This is a nuisance, so I typically suppress them by creating an empty hot spare pool:
# metainit hsp001
Reboot and allow the system to mount the mirrors.
# lockfs -fa
# init 6
Ignore the following errors on boot. Suns reason for these errors: "These warnings are harmless, and may be ignored. They are an artifact of the way drivers are loaded during the boot process when you have a mirrored root or /usr file system.":
WARNING: forceload of misc/md_trans failed
WARNING: forceload of misc/md_raid failed
WARNING: forceload of misc/md_hotspares failed
Attach the second submirror to the mirror. This will cause the data from the boot disk to be synchronized with the mirrored drive.
# metattach d30 d20
# metattach d31 d21
# metattach d32 d22
# metattach d33 d23
# metattach d34 d24
Use metastat to track progress
# metastat
d30: Mirror
   Submirror 0: d10
     State: Okay
   Submirror 1: d20
     State: Resyncing
   Resync in progress: 21 % done
   Pass: 1
   Read option: roundrobin (default)
   Write option: parallel (default)
   Size: 6563816 blocks...

Enable the mirror disk to be bootable:
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t8d0s0
# ls -l /dev/rdsk/c0t8d0s0
lrwxrwxrwx 1 root root 50 Aug 1 10:48 /dev/rdsk/c0t8d0s0 ->; ../../devices/pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw  (note:this line is red font)
Notice the red font. This is the device path that you will use to define the alternate boot path at the ok prompt.
ok  nvalias mirror /pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw
NOTE: You may have to replace the "dad" with "disk" depending on the boot prom. Issue a "show-disks" at the ok prompt to verify the correct path to the disk. Use "devalias" at the ok prompt to also give clues as to which device path to use.
In case of primary boot disk failure, boot from the alternate disk
ok  boot mirror
彻底解决8139网卡安装完驱动后不认的问题
首先要用jsn老兄的方法把你的/etc/hostname.rtls0 以及hosts、/etc/netmasks、/etc/netmasks、/etc/nsswitch.conf设置好。
然后注意看8139驱动的说明
Install method
a. Power-off your PC and insert your RTL8139 adapter.
b. Boot-up you Solaris/x86 and login as "root".
c. Copy the "rtls099.zip" into the temporary location in your hard-driver.
d. UNZIP the "rtls099.zip" and you will get 2 files, "rtls" and "Install".
e. If the PCI ID for your RTL8139 adapter is not VID_10EC_DID_8139 or VID_1113_DID_1211 or VID_1186_DID_1301, you can modify the "Install" file to match your PCI ID, VID_ABCD_DID_WXYZ for example, modify the "pci1186,1301" to "pciABCD,WXYZ".
f. Run the "Install" from File Manager to install the driver, and
it will modify 2 files, "/etc/name_to_major" and "/etc/driver_aliases"
g. You need to create the "/etc/hostname.rtls0" file and modify some
other related files to make your networking environments working well.
h. You can execute "touch /reconfigure" then "shutdown -i5 -g0", so that
Solaris will reboot and scan changed
hardware environment.
i. You can execute "ifconfig -a" to make sure the RTL8139 driver is up.
其实这句英文我只有
e. If the PCI ID for your RTL8139 adapter is not VID_10EC_DID_8139 or VID_1113_DID_1211 or VID_1186_DID_1301, you can modify the "Install" file to match your PCI ID, VID_ABCD_DID_WXYZ for example, modify the "pci1186,1301" to "pciABCD,WXYZ".
f. Run the "Install" from File Manager to install the driver, and
it will modify 2 files, "/etc/name_to_major" and "/etc/driver_aliases"
这里一开始没看明白我以为没什么用处。但是我大错特错了;(因为这里太重要了。
从F.可以知道,安装这个驱动他们会设置/etc/name_to_major和/etc/driver_aliases两个文件。当我们安装完后,需要把/etc/driver_aliases里的
rtls "pci1186,1301"
rtls "pci10ec,8139"
rtls "pci1113,1211"
设置为
#rtls "pci1186,1301"
rtls "pci10ec,8139"
#rtls "pci1113,1211"
然后重起
如果还不好使还有Install里的

# update
#   /etc/driver_aliases
#    /etc/name_to_major
这个#去掉。肯定能好使:)


Q.Our company has a large number of jumpstart servers located throughout the world. Every time a new release comes out, we need to either ship CDROMs to each site or have them download and burn their own copies. Then someone has to physically go to the machine and insert the CDROM into the jumpstart server so that the new image can be installed. This process is slow and tedious. There must be a better way to get the new image on all of our jumpstart servers.
A. You can install from a downloaded ISO image instead of burning your own CDROMs and use lofiadm (with version of Solaris greater than 7) to mount the file as a filesystem. You can then do the installation from the filesystem image.
To begin, make the machine think that the file is actually a device:

/usr/sbin/lofiadm -a /path/to/sol-8-u7-sparc-v1.iso
which creates /dev/lofi/1 and its associated entry in /devices, /devices/pseudo/lofi@0:1.
To mount the ISO image on /cdrom:

/sbin/mount -F hsfs -o ro /dev/lofi/1 /cdrom
Then you can cd to /cdrom/Solaris_8/Tools/ and run:

./setup_install_server /path/to/your/jumpstart/cdrom_image
When the installation of the first disk is complete, delete the loopback mount for the first ISO image:

cd /
/sbin/umount /cdrom
/usr/sbin/lofiadm -d /path/to/sol-8-u7-sparc-v1.iso
Create a loopback interface for the second ISO image, and mount it:

/usr/sbin/lofiadm -a /path/to/sol-8-u7-sparc-2.iso
/sbin/mount -F hsfs -o ro /dev/lofi/1 /cdrom
Then, finish up the installation of the second ISO image:

cd /cdrom/Solaris_8/Tools/
./add_to_install_server /path/to/your/jumpstart/cdrom_image
Finally, after the second image has finished, unmount the image and delete the block device:

cd /
/sbin/umount /cdrom
/usr/sbin/lofiadm -d /path/to/sol-8-u7-sparc-v2.iso

Cool Commands
Peter Baer Galvin
There are so many commands in Solaris that it is difficult to separate the cool ones from the mundane. For example, there are commands to report how much time a program spends in each system call, and commands to dynamically show system activities, and most of these commands are included with Solaris 8 as well as Solaris 9. This month, I’m highlighting some of the commands that you might find particularly useful.
Systems administrators are tool users. Through experience, we have learned that the more tools we have, the better able we are to diagnose problems and implement solutions. The commands included in this column are gleaned from experience, friends, acquaintances, and from attendance at the SunNetwork 2002 conference in September. “The /procodile Hunter” talk by Solaris kernel developers Brian Cantrill and Mike Shapiro was especially enlightening and frightening because Cantrill wrote code to illustrate a point faster than Shapiro could explain the point they were trying to illustrate!
Useful Solaris Commands
truss -c (Solaris >;= : This astounding option to truss provides a profile summary of the command being trussed:
$ truss -c grep asdf work.doc
syscall              seconds   calls  errors
_exit                    .00       1
read                     .01      24
open                     .00       8      4
close                    .00       5
brk                      .00      15
stat                     .00       1
fstat                    .00       4
execve                   .00       1
mmap                     .00      10
munmap                   .01       3
memcntl                  .00       2
llseek                   .00       1
open64                   .00       1
                        ----     ---    ---
sys totals:              .02      76      4
usr time:                .00
elapsed:                 .05
It can also show profile data on a running process. In this case, the data shows what the process did between when truss was started and when truss execution was terminated with a control-c. It’s ideal for determining why a process is hung without having to wade through the pages of truss output.
truss -d and truss -D (Solaris >;= : These truss options show the time associated with each system call being shown by truss and is excellent for finding performance problems in custom or commercial code. For example:
$ truss -d who
Base time stamp:  1035385727.3460  [ Wed Oct 23 11:08:47 EDT 2002 ]
0.0000 execve(“/usr/bin/who”, 0xFFBEFD5C, 0xFFBEFD64)  argc = 1
0.0032 stat(“/usr/bin/who”, 0xFFBEFA9                = 0
0.0037 open(“/var/ld/ld.config”, O_RDONLY)             Err#2 ENOENT
0.0042 open(“/usr/local/lib/libc.so.1”, O_RDONLY)      Err#2 ENOENT
0.0047 open(“/usr/lib/libc.so.1”, O_RDONLY)            = 3
0.0051 fstat(3, 0xFFBEF42C)                            = 0
. . .
truss -D is even more useful, showing the time delta between system calls:
Dilbert>; truss -D who
0.0000 execve(“/usr/bin/who”, 0xFFBEFD5C, 0xFFBEFD64)  argc = 1
0.0028 stat(“/usr/bin/who”, 0xFFBEFA9                = 0
0.0005 open(“/var/ld/ld.config”, O_RDONLY)             Err#2 ENOENT
0.0006 open(“/usr/local/lib/libc.so.1”, O_RDONLY)      Err#2 ENOENT
0.0005 open(“/usr/lib/libc.so.1”, O_RDONLY)            = 3
0.0004 fstat(3, 0xFFBEF42C)                            = 0
In this example, the stat system call took a lot longer than the others.
truss -T: This is a great debugging help. It will stop a process at the execution of a specified system call. (“-U” does the same, but with user-level function calls.) A core could then be taken for further analysis, or any of the /proc tools could be used to determine many aspects of the status of the process.
truss -l (improved in Solaris 9): Shows the thread number of each call in a multi-threaded processes. Solaris 9 truss -l finally makes it possible to watch the execution of a multi-threaded application.
Truss is truly a powerful tool. It can be used on core files to analyze what caused the problem, for example. It can also show details on user-level library calls (either system libraries or programmer libraries) via the “-u” option.
pkg-get: This is a nice tool (http://www.bolthole.com/solaris) for automatically getting freeware packages. It is configured via /etc/pkg-get.conf. Once it’s up and running, execute pkg-get -a to get a list of available packages, and pkg-get -i to get and install a given package.
plimit (Solaris >;= : This command displays and sets the per-process limits on a running process. This is handy if a long-running process is running up against a limit (for example, number of open files). Rather than using limit and restarting the command, plimit can modify the running process.
coreadm (Solaris >;= : In the “old” days (before coreadm), core dumps were placed in the process’s working directory. Core files would also overwrite each other. All this and more has been addressed by coreadm, a tool to manage core file creation. With it, you can specify whether to save cores, where cores should be stored, how many versions should be retained, and more. Settings can be retained between reboots by coreadm modifying /etc/coreadm.conf.
pgrep (Solaris >;= : pgrep searches through /proc for processes matching the given criteria, and returns their process-ids. A great option is “-n”, which returns the newest process that matches.
preap (Solaris >;= 9): Reaps zombie processes. Any processes stuck in the “z” state (as shown by ps), can be removed from the system with this command.
pargs (Solaris >;= 9): Shows the arguments and environment variables of a process.
nohup -p (Solaris >;= 9): The nohup command can be used to start a process, so that if the shell that started the process closes (i.e., the process gets a “SIGHUP” signal), the process will keep running. This is useful for backgrounding a task that should continue running no matter what happens around it. But what happens if you start a process and later want to HUP-proof it? With Solaris 9, nohup -p takes a process-id and causes SIGHUP to be ignored.
prstat (Solaris >;= : prstat is top and a lot more. Both commands provide a screen’s worth of process and other information and update it frequently, for a nice window on system performance. prstat has much better accuracy than top. It also has some nice options. “-a” shows process and user information concurrently (sorted by CPU hog, by default). “-c” causes it to act like vmstat (new reports printed below old ones). “-C” shows processes in a processor set. “-j” shows processes in a “project”. “-L” shows per-thread information as well as per-process. “-m” and “-v” show quite a bit of per-process performance detail (including pages, traps, lock wait, and CPU wait). The output data can also be sorted by resident-set (real memory) size, virtual memory size, execute time, and so on. prstat is very useful on systems without top, and should probably be used instead of top because of its accuracy (and some sites care that it is a supported program).
trapstat (Solaris >;= 9): trapstat joins lockstat and kstat as the most inscrutable commands on Solaris. Each shows gory details about the innards of the running operating system. Each is indispensable in solving strange happenings on a Solaris system. Best of all, their output is good to send along with bug reports, but further study can reveal useful information for general use as well.
vmstat -p (Solaris >;= : Until this option became available, it was almost impossible (see the “se toolkit”) to determine what kind of memory demand was causing a system to page. vmstat -p is key because it not only shows whether your system is under memory stress (via the “sr” column), it also shows whether that stress is from application code, application data, or I/O. “-p” can really help pinpoint the cause of any mysterious memory issues on Solaris.
pmap -x (Solaris >;= 8, bugs fixed in Solaris >;= 9): If the process with memory problems is known, and more details on its memory use are needed, check out pmap -x. The target process-id has its memory map fully explained, as in:
# pmap -x 1779
1779:   -ksh
Address  Kbytes     RSS    Anon  Locked Mode   Mapped File
00010000     192     192       -       - r-x--  ksh
00040000       8       8       8       - rwx--  ksh
00042000      32      32       8       - rwx--    [ heap ]
FF180000     680     664       -       - r-x--  libc.so.1
FF23A000      24      24       -       - rwx--  libc.so.1
FF240000       8       8       -       - rwx--  libc.so.1
FF280000     568     472       -       - r-x--  libnsl.so.1
FF31E000      32      32       -       - rwx--  libnsl.so.1
FF326000      32      24       -       - rwx--  libnsl.so.1
FF340000      16      16       -       - r-x--  libc_psr.so.1
FF350000      16      16       -       - r-x--  libmp.so.2
FF364000       8       8       -       - rwx--  libmp.so.2
FF380000      40      40       -       - r-x--  libsocket.so.1
FF39A000       8       8       -       - rwx--  libsocket.so.1
FF3A0000       8       8       -       - r-x--  libdl.so.1
FF3B0000       8       8       8       - rwx--    [ anon ]
FF3C0000     152     152       -       - r-x--  ld.so.1
FF3F6000       8       8       8       - rwx--  ld.so.1
FFBFE000       8       8       8       - rw---    [ stack ]
-------- ------- ------- ------- -------
total Kb    1848    1728      40       -
Here we see each chunk of memory, what it is being used for, how much space it is taking (virtual and real), and mode information.
df -h (Solaris >;= 9): This command is popular on Linux, and just made its way into Solaris. df -h displays summary information about file systems in human-readable form:
$ df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0      4.8G   1.7G   3.0G    37%    /
/proc                    0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
fd                       0K     0K     0K     0%    /dev/fd
swap                   848M    40K   848M     1%    /var/run
swap                   849M   1.0M   848M     1%    /tmp
/dev/dsk/c0t0d0s7       13G    78K    13G     1%    /export/home
Conclusion
Each administrator has a set of tools used daily, and another set of tools to help in a pinch. This column included a wide variety of commands and options that are lesser known, but can be very useful. Do you have favorite tools that have saved you in a bind? If so, please send them to me so I can expand my tool set as well. Alternately, send along any tools that you hate or that you feel are dangerous, which could also turn into a useful column!
Peter Baer Galvin (http://www.petergalvin.org) is the Chief Technologist for Corporate Technologies (http://www.cptech.com), a premier systems integrator and VAR. Before that, Peter was the systems manager for Brown University’s Computer Science Department. He has written articles for Byte and other magazines, and previously wrote Pete’s Wicked World, the security column, and Pete’s Super Systems, the systems management column for Unix Insider (http://www.unixinsider.com). Peter is coauthor of the Operating Systems Concepts and Applied Operating Systems Concepts textbooks. As a consultant and trainer, Peter has taught tutorials and given talks on security and systems administration worldwide.

在solris上,如何让STOP+A组合键失效
#kbd -a disable
or u can edit the /etc/default/kbd then #kbd –I

关于PC X-server的中文问题(终结篇)
http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=3&amp;topic=19325
作者:猫弗利
最近有很多朋友讨论关于PC X-server不能显示中文问题。
看到很多朋友禅精竭虑的用各种方法(甚至包括自己制作中文字库)
首先我为他们的这种钻研精神深深感动,同时我也感到很惭愧,
因为早在X诞生之时已经设计了解决途径;
最简便的解决方法/也是正确的方法就是使用 X Font Server。
1.机制
X Font Server 是X 为多语言准备的机制。
由于Unix的X 是C/S结构的;X允许client通过tcp/ip使用server上的font.
所以只要X Font server上有的font,client就可以使用,
而不论client的平台是法语、德语、中文还是日文。
一般的Unix X server也可以做 font server.
X fonts server(Fonts) -- tcp/ip -->; X client/Other X server
2.server端设置
一般的Unix在启动时都会启动X Font Server.
它的port是 7000(HP-UX) 或者 7100(Solaris),具体察看/etc/services
用netstat -an 可以检查端口是否被监听。
和很多tcp/ip service一样,可以是inetd监听也可以是xfs自己监听。
3.client设置
在PC X-server里面有Font Path一项,加上下面的font path.
tcp/font_server_host_name or IP :7100
有好一些的软件(如:exceed)有单独的选项。
4.后记。
好了,这样就可以随便选择语言了,想怎么玩就怎么玩了。
希望这是最后一次回答这个问题。
我不知道说什么好:
X Font Server 是个well-known的东东;而且很容易找到帮助;
不管是 man X 还是PC X-server自己的help里面都有详尽的描述。
我不知道为什么会有那么多的人前仆后继的想出各种麻烦的办法。
(初步试用,不是那么回事)
1557A DDS3 autoloader [This tape drive requires third-party software.] , [Testing has shown that these switch settings are best: Set switches 1 through 8 to 11001100.] 1537A
http://docs.sun.com/db/doc/816-2419/6m8p5t0mr?q=DDS4+&amp;a=view
如何禁止键盘上的power键
Disabling this feature is only accessible by the root user. To disable the button so
it is non-operable, complete the following:
  Open the file /usr/openwin/lib/speckeysd.map
  Comment out the line below -

        SunPowerSwitch              -       $OPENWINHOME/bin/sys-suspend

  log out and log back in

论坛徽章:
0
8 [报告]
发表于 2003-01-24 15:53 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

白白,春节后见了。

论坛徽章:
0
9 [报告]
发表于 2003-01-24 16:13 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

辛苦了,谢谢!

论坛徽章:
0
10 [报告]
发表于 2003-01-24 16:32 |只看该作者

贡献去年在论坛粘贴的资料,138页的WORD。

老大,没有下载D地方啊?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP