随笔-10  评论-5  文章-0  trackbacks-0
  2007年1月4日
<!--
//--------------------------随机字符--------------------------
//str_0 长度
//str_1 是否大写字母
//str_2 是否小写字母
//str_3 是否数字
function rnd_str(str_0,str_1,str_2,str_3)
{
var Seed_array=new Array();
var seedary;
var i;

Seed_array[0]=""
Seed_array[1]= "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
Seed_array[2]= "a b c d e f g h i j k l m n o p q r s t u v w x y z";
Seed_array[3]= "0 1 2 3 4 5 6 7 8 9";


if (!str_1&&!str_2&&!str_3){str_1=true;str_2=true;str_3=true;}

if (str_1){Seed_array[0]+=Seed_array[1];}
if (str_2){Seed_array[0]+=" "+Seed_array[2];}
if (str_3){Seed_array[0]+=" "+Seed_array[3];}

Seed_array[0]= Seed_array[0].split(" ");
seedary=""
for (i=0;i<str_0;i++)
{
seedary+=Seed_array[0][Math.round(Math.random( )*(Seed_array[0].length-1))]
}
return(seedary);

}
-->


//--------------------调用时--------------

<script language="JavaScript" type="text/JavaScript">
var obj=document.all.jz_4;
var tmp=rnd_str(6,true,true,true);
obj.value=tmp;
document.write(tmp);
</script>
posted @ 2007-01-04 12:51 bismarck 阅读(370) | 评论 (1)编辑 收藏
  2006年12月29日

import java.sql.*;

/**
 * Created by IntelliJ IDEA.
 * User: tacimoto
 * Date: 2006-12-29
 * Time: 17:46:03
 * To change this template use File | Settings | File Templates.
 */
public class tacimoto {
    final String oracle_conn_str = "jdbc:oracle:thin:@192.168.0.50:1521:orcl";
    String Usr = "sjs";
    String pwd = "sjs";
    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;

    public tacimoto() {
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
            conn = DriverManager.getConnection(oracle_conn_str, Usr, pwd);
            stmt = conn.createStatement();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public boolean executeUpdate(String sql) {
        try {
            stmt.executeUpdate(sql);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public ResultSet executeQuery(String sql) {
        rs = null;
        try {
            rs = stmt.executeQuery(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rs;
    }

    public void close() {
        try {
            conn.close();
            stmt.close();
        } catch (Exception e) {
            e.printStackTrace();
            try {
                conn.close();
                stmt.close();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }

    public static void main(String [] args) {
        tacimoto tac = new tacimoto();
        ResultSet rs = tac.executeQuery("select * from ROLE");
        try
        {
            System.err.print("NAME"+"     ");
            System.err.println("DES");
            System.err.println("-----------------------------------------------------------");
            if(rs != null)
            while(rs.next())
            {
                System.out.print(rs.getString("name")+"     ");
                System.out.println(rs.getString("des"));
            }
        }catch(Exception e)
        {
            e.printStackTrace();
        }

    }
}

我用的开发工具是IDEA5.1,数据库是Oracle 10G。
注意:要把oracle的连接驱动加到工程中,否则 Class.forname会找不到类。
把驱动复制到lib中,然后settings--> module--->把类加到工程中即可。我所用的驱动叫:ojdbc14.jar

posted @ 2006-12-29 18:51 bismarck 阅读(216) | 评论 (0)编辑 收藏
  2006年12月28日
首先要安装ftp服务的相关组建: rpm -qa | grep ftp 应该有以下东西: ftp-0.17-32.1.2 lftp-3.4.2-5 vsftpd-2.0.4-1.2 确认有这些东西后输入setup 在system service中选中vsftpd按空格选中,然后quit 输入:service vsftpd start 启动服务 输入:service vsftpd start 停止服务 输入:service vsftpd restart 重新启动服务
posted @ 2006-12-28 11:02 bismarck 阅读(11975) | 评论 (0)编辑 收藏
    修改/etc/profile或者用户目录的配置文件(比如.bashrc),设置JAVA_HOME环境变量,例如:
 JAVA_HOME=/usr/j2sdk1.5.0_04 (把这个替换成你的JRE目录)
 export JAVA_HOME

   然后使设置生效:你可以注销再登录,也可以直接运行一下/etc/profile
这个方法直接一些,程序不会再去搜索JRE

3. 在JRE或者JDK安装完成后,把安装包拷贝到某个目录,假设是/usr/local,然后用下列命令解压:
tar zxvf lumaqq_2005-linux_gtk2_x86_no_jre.tar.gz
这时/usr/local下会出现LumaQQ目录,你要是不喜欢这个目录,随便你改名移动都行。然后直接运行lumaqq脚本就行啦!

不过呢,要注意三点:
i. lumaqq的脚本使用的是bash shell语法,如果你的环境有所差异,请修改相应的命令
ii. 如果出现权限问题,使用chmod -R 777 [安装目录]更改权限
iii. 如果以前安装过旧版本的LumaQQ,务必执行rm -rf ~/.lumaqq

posted @ 2006-12-28 10:12 bismarck 阅读(249) | 评论 (0)编辑 收藏

at

1.作用
at命令用来在指定时刻执行指定的命令序列。

2.格式
at [-V] [-q x] [-f file] [-m] time

3.主要参数
-V:显示标准错误输出。
-q:许多队列输出。
-f:从文件中读取作业。
-m:执行完作业后发送电子邮件到用户。
time:设定作业执行的时间。time格式有严格的要求,由小时、分钟、日期和时间的偏移量组成,其中日期的格式为MM.DD.YY,MM是分钟,DD是日期,YY是指年份。偏移量的格式为时间+偏移量,单位是minutes、hours和days。

4.应用实例
#at -f data 15:30 +2 days

上面命令表示让系统在两天后的17:30执行文件data中指明的作业。
atq是查询自己的at
qtrm 工作编号:删除指定at
atq 使at当前所有队列显示

posted @ 2006-12-28 09:30 bismarck 阅读(1893) | 评论 (0)编辑 收藏
  2006年12月20日
如果想得到当前时间的年月日,时分秒信息可以这么输入
#date +%y%m%d%H%M%S
如此简单
posted @ 2006-12-20 16:49 bismarck 阅读(536) | 评论 (0)编辑 收藏
  2006年12月19日
转帖来自:Jims of 肥肥 世家

LDAP(轻量级目录服务访问协议,Lightweight Directory Access Protocol)基于X.500标准,支持TCP/IP,使用简单方便。现在越来越多的网络应用系统都支持LDAP。OpenLDAP是LDAP的一种开源实现,本笔记基于OpenLDAP2.1.29。


--------------------------------------------------------------------------------

Table of Contents

1. 目录服务简介
1.1. X.500和LDAP
1.2. LDAP产品
1.3.
2. OpenLDAP安装笔记
2.1. 源码安装
2.2. 数据录入
2.2.1. 手动录入方法
2.2.2. 文件方式
2.2.3. 脚本方式
2.3. 常用命令介绍
2.4. 启用sasl验证
2.5. 配置复制服务器
3. HowTo
3.1. 禁止整个服务器的匿名访问
Chapter 1. 目录服务简介
Table of Contents

1.1. X.500和LDAP
1.2. LDAP产品
1.3.
目录是一个为查询、浏览和搜索而优化的专业分布式数据库,它成树状结构组织数据,就好象Linux/Unix系统中的文件目录一样。目录数据库和关系数据库不同,它有优异的读性能,但写性能差,并且没有事务处理、回滚等复杂功能,不适于存储修改频繁的数据。所以目录天生是用来查询的,就好象它的名字一样。目录服务是由目录数据库和一套访问协议组成的系统。类似以下的信息适合储存在目录中:

企业员工和企业客户之类人员信息;

公用证书和安全密钥;

邮件地址、网址、IP等电脑信息;

电脑配置信息。

...

1.1. X.500和LDAP
现在国际上的目录服务标准有两个,一个是较早的X.500标准,一个是较新的LDAP标准。

X.500是一个协议族,由一系列的概念和协议组成,包括:

X.501是模型定义,定义目录服务的基本模型和概念;

X.509是认证框架,定义如何处理目录服务中客户和服务器认证;

X.511是抽象服务定义,定义X.500提供的功能性服务;

X.518是分布式操作过程定义,定义如何跨平台处理目录服务;

X.519是协议规范,定义了X.500协议,包括DAP(Directory Access Protocol,目录访问协议)、DSP(Directory System Protocol,目录系统协议)、DOP(Directory Operator Protocol,目录操作绑定协议)、DISP(Directory Information Shadowing Protocol,目录信息阴影协议 );

X.520定义属性类型要求;

X.521定义对象类型;

X.525定义如果在目录服务器间复制内容。

X.500标准中定义了很多内容,包括:

定义了信息模型,确定目录中信息的格式和字符集,如何在项中表示目录信息(定义对象类、属性等模式);

定义命名空间,确定对信息进行的组织和引用,如何组织和命名项-目录信息树DIT和层次命名模型;

定义功能模型,确定可以在信息上执行的操作;

定义认证框架,保证目录中信息的安全,如何实现目录中信息的授权保护-访问控制模型;

定义分布操作模型,确定数据如何分布和如何对分布数据执行操作,如何将全局目录树划分为管理域,以便管理。

定义客户端与服务器之间的通信的各种协议。

由于X.500较复杂,且需严格遵照OSI七层协议模型。造成应用开发较困难。所以开发了LDAP,以便在INTERNET上使用。

LDAP协议于1993年获批准,产生LDAPv1版,1997年发布最新的LDAPv3版,该版本是LDAP协议发展的一个里程碑,它作为X.500的简化版提供了很多自有的特性,使LDAP功能更为完备,具有更强大的生命力。

LDAP也是一个协议族,包含以下内容:

RFC 2251--LDAPv3核心协议,定义了LDAPv3协议的基本模型和基本操作;

RFC 2252--定义LDAPv3基本数据模式(Schema)(包括语法、匹配规则、属性类型和对象类)以及标准的系统数据模式;

RFC 2253--定义LDAPv3中的分辩名(DN)表达式;

RFC 2254--定义了LDAPv3中的过滤表达式;

RFC 2255--定义LDAPv3统一资源地址的格式;

RFC 2256--定义LDAPv3中使用X.500的Schema列表;

RFC 2829--定义了LDAPv3中的认证方式;

RFC 2830--定义了如何通过扩展使用TLS服务;

RFC 1823--定义了C的LDAP客户端API开发接口;

RFC 2847--定义了LDAP数据导入、导出文件接口LDIF。

这些协议定义了LDAP的内容,包括:

定义了一个信息模型,确定了LDAP目录中信息的格式和字符集,如何表示目录信息(定义对象类、属性、匹配规则和语法等模式);

定义了命名空间,确定信息的组织方式--目录树DIT,以DN和RDN为基础的命名方式,以及LDAP信息的Internet表示方式;

定义了功能模型,确定在可以在信息上执行的操作及API。

定义了安全框架,保证目录中信息的安全,定义匿名、用户名/密码、SASL等多种认证方式,以及与TLS结合的通讯保护框架;

定义分布式操作模型,基于指引方式的分布式操作框架;

定义了LDAP扩展框架。

1.2. LDAP产品
现在市场上有关LDAP的产品已有很多,各大软件公司都在他们的产品中集成了LDAP服务,如Microsoft的ActiveDirectory、Lotus的Domino Directory、IBM的WebSphere中也集成了LDAP服务。LDAP的开源实现是OpenLDAP,OpenLDAP比商业产品功能一点也不差,而且源码开发。

1.3.

Chapter 2. OpenLDAP安装笔记
Table of Contents

2.1. 源码安装
2.2. 数据录入
2.2.1. 手动录入方法
2.2.2. 文件方式
2.2.3. 脚本方式
2.3. 常用命令介绍
2.4. 启用sasl验证
2.5. 配置复制服务器
2.1. 源码安装
我的安装方法是以源码编译的方式进行的,以root用户进行安装。安装所需软件如下:

openldap-2.1.29

Berkeley DB 4.2.52

具体的安装步骤如下:

由于openldap需要Berkeley DB来存放数据,所以需先安装Berkeley DB 4.2.52,可到它的网站下载,网址见上面。运行下面的命令解压:

# tar -zxvf db-4.2.52.tar.gz

解完压后,会生成一个db-4.2.52目录,进行该目录下的build_unix目录。执行以下命令进行配置安装。

# ../dist/configure
# make
# make install

也是按linux源码安装的三步曲完成,没有什么好说的了。该软件默认是安装在/usr/local/BerkeleyDB.4.2目录下。安装完成后,要把/usr/local/BerkeleyDB.4.2/lib的库路径加到/etc/ld.so.conf文件内,添加完成后执行一次ldconfig,使配置文件生效。这样编译openldap时才能找到相应的库文件。这样资料库就安装完成了,接下来可以安装openldap了。ld.so.conf是什么东西?它就是系统动态链接库的配置文件。此文件内,存放着可被LINUX共享的动态链接库所在目录的名字(系统目录/lib,/usr/lib除外),各个目录名间以空白字符(空格,换行等)或冒号或逗号分隔。一般的LINUX发行版中,此文件均含一个共享目录/usr/X11R6/lib,为X window窗口系统的动态链接库所在的目录。 ldconfig是它的管理命令,具体操作方法可查询man手册,这里就不细讲了。

到openldap官方网站下载最新的稳定版源码,并解压。查看INSTALLT 和README文档,这个很重要,因为安装方法和一些注意事项都在里面有介绍。认真弄明白文档内容能节省你不少的安装调试时间。这也是开源软件的一个特点,给用户提供了最大的灵活性和可配置性。但也增加了系统安装配置的难度,需要有相关的文档配置说明和指导。在官方网站上还有详细的帮助文件,在整个系统配置中需要经常查询。

# tar -zxvf openldap-stable-20040329.tgz

解压完成后,会生成一个openldap-2.1.29目录。进行该目录,执行以下命令进行配置安装。

# env CPPFLAGS="-I/usr/local/BerkeleyDB.4.2/include"
LDFLAGS="-L/usr/local/BerkeleyDB.4.2/lib" ./configure --prefix=/usr/local/openldap
--enable-ldbm

注意以上配置语句,要设置资料库的include和lib路径,否则在配置到资料库相关内容时会提示Berkeley DB版本不兼容,并中断配置。如果没有--enable-ldbm选项,在make test时会提示ldbm找不到。为了减少出错,还是加上为好。

#make depens
#make
#make test

在make test阶段要花费较长时间进行测试,好像有16项吧。你可以放松一下,上上网,聊聊天,听听歌,呵呵,开玩笑了,这个时间应该是最紧张的了。成与不成就看这下的了,如果没问题就可安装了。

#make install

通过配置命令可以看出,我们把openldap安装到/usr/local/openldap目录下。建议以源码安装的软件都放到独立的目录下,不要放到软件默认的目录。好处是方便管理和控制,所有文件在统一的目录下,卸载软件只要删除整个目录就可以了。

安装完相关软件后就可以着手配置了。Berkeley DB资料库没什么好配置的。主要是配置openldap 服务。配置文件在软件的安装目录的etc/openldap下,有四个文件,主要的是slapd.conf and ldap.conf,其它两个是backup文件。首先,我们先来配置slapd.conf文档。系统默认的slapd.conf文件如下:

# $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.23.2.8 2003/05/24 23:19:14 kurt Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include      /usr/local/openldap/etc/openldap/schema/core.schema  
#设置schema配置文档包含

# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral       ldap://root.openldap.org

pidfile         /usr/local/openldap/var/slapd.pid
#设置pid和args文档位置
argsfile        /usr/local/openldap/var/slapd.args

# Load dynamic backend modules:
# modulepath    /usr/local/openldap/libexec/openldap
# moduleload    back_bdb.la
# moduleload    back_ldap.la
# moduleload    back_ldbm.la
# moduleload    back_passwd.la
# moduleload    back_shell.la

# Sample security restrictions
#       Require integrity protection (prevent hijacking)
#       Require 112-bit (3DES or better) encryption for updates
#       Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
#       Root DSE: allow anyone to read it
#       Subschema (sub)entry DSE: allow anyone to read it
#       Other DSEs:
#       Subschema (sub)entry DSE: allow anyone to read it
#       Other DSEs:
#               Allow self write access
#               Allow authenticated users read access
#               Allow anonymous users to authenticate
#       Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
#       by self write
#       by users read
#       by anonymous auth
#
# if no access controls are present, the default policy is:
#       Allow read by all
#
# rootdn can always write!

#######################################################################
# ldbm database definitions
#######################################################################

database        bdb                                
#设置使用的资料库,也可用lbdm。
suffix          "dc=my-domain,dc=com"              
#设置目录后缀
rootdn          "cn=Manager,dc=my-domain,dc=com"   
#设置目录管理员
# Cleartext passwords, especially for the rootdn, should
# be avoid.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw          secret                             
#设置管理密码,这里用了明文的“secret”密码。这样设置不安全,需使用加密的密码,下面会讲到如何设置加密密码。
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory       /usr/local/openldap/var/openldap-data  
#设置资料库路径
# Indices to maintain
index   objectClass     eq                        
#设置目录项索引

要服务器正常动作,要修改一些始初参数和设置,修改后的配置文档如下:

# $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.23.2.8 2003/05/24 23:19:14 kurt Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
#为了有效使用目录服务,包含相关的文件。注意,在包含文件时是要按一定顺序的,因为
#文件里的属性存在依赖关系。如果顺序不对,服务器启动不了,文档间的依赖关系在文档
#中都有说明,请仔细查看一下。如果懒得看也可以按我的顺序。
include         /usr/local/openldap/etc/openldap/schema/core.schema
include         /usr/local/openldap/etc/openldap/schema/corba.schema
include         /usr/local/openldap/etc/openldap/schema/cosine.schema
include         /usr/local/openldap/etc/openldap/schema/inetorgperson.schema   
include         /usr/local/openldap/etc/openldap/schema/misc.schema            
include         /usr/local/openldap/etc/openldap/schema/openldap.schema
include         /usr/local/openldap/etc/openldap/schema/nis.schema
include         /usr/local/openldap/etc/openldap/schema/samba.schema
# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral       ldap://root.openldap.org

pidfile         /usr/local/openldap/var/slapd.pid
argsfile        /usr/local/openldap/var/slapd.args

loglevel 1                       
#增加了日志功能,需修改syslog配置文件,在文件中增加一项:local4.* /var/log/ldap.log日志级别定义可查相官方网站的文档。
#1级记录的信息很多,可用于调试。
# Load dynamic backend modules:
# modulepath    /usr/local/openldap/libexec/openldap
# moduleload    back_bdb.la
# moduleload    back_ldap.la
# moduleload    back_ldbm.la
# moduleload    back_passwd.la
# moduleload    back_shell.la

# Sample security restrictions
#       Require integrity protection (prevent hijacking)
#       Require 112-bit (3DES or better) encryption for updates
#       Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
#       Root DSE: allow anyone to read it
#       Subschema (sub)entry DSE: allow anyone to read it
#       Other DSEs:
#               Allow self write access
#               Allow authenticated users read access
#               Allow anonymous users to authenticate
#       Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
#       by self write
#       by users read
#       by anonymous auth
#
# if no access controls are present, the default policy is:
#       Allow read by all
#
# rootdn can always write!

#######################################################################
# ldbm database definitions
#######################################################################

database        bdb
suffix          "dc=it,dc=com"
#改成你自已的目录后缀,
rootdn          "cn=root,dc=it,dc=com"
#设置root为管理员,与linux的root没有什么关系。
# Cleartext passwords, especially for the rootdn, should
# be avoid.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw          {MD5}mjkiuPt0wXhpxxkdiOOO+0000000AKq0by
#设置root密码,用MD5加密。密码串用slappasswd -h {MD5}指令
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory       /usr/local/openldap/var/openldap-data   
# Indices to maintain
index   objectClass     eq
#这里可根据你的需要设置相关索引,以加快查询速度。具体内容可查询官方网站管理手册。

#ACL configure以下内容定义访问控制
access to  attr=userPassworduserPassword
#只能由自已修改,有效验证用户查询。
       by self write
       by anonymous auth
access to attr=mail
       by dn="cn=root,dc=it,dc=tigerhead" writemail
#只能由自已修改,有效验证用户查询。
       by self write
       by anonymous auth
access to dn=".*,dc=it,dc=tigerhead"
#允许所有人查询没受控制访问限制的信息。
       by self write
       by * read

到现在为止,服务器基本就配置完成了,可以启动了,服务器程序是位于安装目录的libexec下的slapd程序。注意,不是sldap哦。ok,到现在为止,服务器基本就配置完成了,可以启动了,服务器程序是位于安装目录的libexec下的slapd程序。注意,不是sldap哦。启动服务器执行以下命令:

# ./slapd

如果没有提示什么出错信息,直接返回shell状态,就说明服务器正常启动了,你可以查询日志或用ps -aux查看。或用以下命令查询服务器:

ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts

如果命令执行成功,返回一些信息,则说明服务器正常运行了。如果启动不成功,它会提示一些出错信息,多数是slapd.conf配置出错。回头仔细核查一下配置文档。

客户端配置文档是ldap.conf。该文档相当简单,其实不和配置也能正常操作。

# $OpenLDAP: pkg/ldap/libraries/libldap/ldap.conf,v 1.9 2000/09/04 19:57:01 kurt Exp $
#
# LDAP Defaults
#

# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE    dc=it, dc=com设置目录起点
#URI    ldap://ldap.example.com ldap://ldap-master.example.com:666

#SIZELIMIT      12
#TIMELIMIT      15
#DEREF          never

2.2. 数据录入
服务器正常运作后,就可以录入信息了。信息的录入有三种方法,一种是手工录入,一种是.ldif文件格式录入,一种是脚本自动录入。我们先从最基础的手工录入方式开始介绍,了解录入信息的格式。明白了手工录入的格式,其它两种方式都很容易明白。信息录入用到ldapadd这个程序。可在安装目录的bin目录下找到。

2.2.1. 手动录入方法
第一步是要建立DN:

# ldapadd -x -D 'cn=root,dc=it,dc=com' -W
dn: dc=it,dc=com
objectClass: dcObject
objectClass: organization
dc: it
o: Corporation
description: d Corporation
注意:如果你用复制/粘贴功能把以上内容拷贝过去,一定要注意每行后面不要有空格。

第二步是建立RDN:

# ldapadd -x -D 'cn=root,dc=it,dc=com'        -W -x表示用简单验证,-D表示指定目录,-W表示弹出密码输入提示

输入密码,这里的密码是cn=root的密码,不是操作系统root用户的密码。验证通过后就可输入以下内容:

dn: uid=qq,dc=it,dc=com
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: qq
cn: qq
sn: qq
telephoneNumber: 138888888
description: openldap test
telexNumber: tex-8888888
street: my street
postOfficeBox: postofficebox
displayName: qqdisplay
homePhone: home1111111
mobile: mobile99999
mail:qq@qq.com

输入完所有信息后,按Ctrl+d结束存盘。如果出现出错信息,请查一下对象类和属性的对应关系有没有错或输入失误。初学者就容易出错的地方是对象类和属性的对应关系没有处理好。对象类和属性是在schema文档中定义的。它们之间的关系是这样的,对象类中有些属性是必选的,有些属性是可选的。录入信息的属性必须在对象类中有定义才能用。

输入以下命令可查询到刚才输入的信息。

# ldapsearch -x -b 'dc=it,dc=com'            
-b选项是设置目录起点,如果设置了客户端的BASE配置参数,该项可不用。

如果按以上配置文件设置了acl,用上面的查询命令是查询不到受保护的内容的。如上面的userPassword and mail。要查询到这些受限内容,需要通过验证才可以:

# ldapsearch -x -LLL -h it.com -b 'dc=it,dc=com' -D 'uid=qq,dc=it,dc=com' -W 'uid=qq'
接着提示输入密码。输入userPassword的密码回车,所有信息就都出来了。

2.2.2. 文件方式
.ldif文件方式也就是把以上手工输入的内容先写入一个.ldif文件中,然后,用ldapadd命令的-f参数导入。

# ldapadd -x -D "cn=root,dc=it,dc=com" -W -f test.ldif

一个完整的global.ldif文件例子:

dn: dc=info, dc=net
objectClass: top
objectClass: organization
o: info.net

dn: ou=People, dc=info, dc=net
objectClass: top
objectClass: organizationalUnit
ou: People
description: User Info

dn: cn=Admin, dc=info, dc=net
objectClass: top
objectClass: person
objectClass: organizationalPerson
cn: Admin
sn: Admin
userPassword: Admin
description: Administrator for info.net

dn: id=1, ou=people, dc=info, dc=net
objectclass: top
objectclass: InfoPerson
id: 1
username: 张三
tel:021-63138990
card_id:ABC001


再次提醒,注意每行后面不要留有空格。

2.2.3. 脚本方式
脚本录入方式需要自已编写脚本,或到网上下载。有一个用PHP写的LDAP管理工具不错,叫phpLDAPadmin。可以到以下网址下载:http://phpldapadmin.sourceforge.net。安装方法也很简单,只要解压出来,拷贝到apache的web目录下,按说明配置一下设定文档,就ok了。

2.3. 常用命令介绍
接着为大家介绍一下几个常用的ldap命令,如果你用了phpLDAPadmin程序,其实它已经有一个很好的图形介面帮你完成这些命令了。但了解一下还是对你还是很有益的,因为命令方法才是最根本的。

删除命令ldapdelete

# ldapdelete -x -D 'cn=root,dc=it,dc=com' -W 'uid=qq1,dc=it,dc=com'

设置使用者密码,当然了,你的用户需要有userPassword项了。

#ldappasswd -x -D "cn=root,dc=it,dc=com" -W "uid=qq1,dc=it,dc=com" -S
New password:
Re-enter new password:
Enter bind password:
Result: Success (0)


"Enter bind password" 是 "cn=root,dc=it,dc=com"管理员的密码。

管理员密码更改

#slappasswd
New password
Re-enter new password
{SSHA}83DJ4KVwqlk1uh9k2uDb8+NT1U4RgkEs

接下再拷贝到 path/to/sldap.conf 的 rootpw 即可,重启使用配置文件生效

通过ldapmodify修改目录内容

# ldapmodify -x -D "cn=root,dc=it,dc=com" -W -f modify.ldif

通过ldif文件修改ldap数据,ldif文件格式如下:

dn: cn=qq,dc=it,dc=com
changetype: modify
replace: mail
mail: modme@example.com
-
add: title
title: Grand Poobah
-
add: jpegPhoto
jpegPhoto:< file:///tmp/modme.jpeg
-
delete: description
-

2.4. 启用sasl验证
前提是你在系统中安装了sasl认证库,并在编译openldap时支持它,默认就支持了。到http://asg.web.cmu.edu/cyrus下载。安装方法见我写的sendmail安装笔记。安装好之后,需要在sasl中建立相应的帐号,用以下命令可完成。

# saslpasswd2 -c test

接着配置slapd.conf文件,加入以下内容。

sasl-regexp
       uid=(.*),cn=.*,cn=auth
       uid=$1,dc=it,dc=com

重启服务器使配置文件生效。这个配置是最大权限的配置,如果要细化请查阅相关文档。用以下命令测试。

# ldapsearch -U qq  -b 'uid=qq,dc=it,dc=com' -D 'dc=it,dc=com' -Y DIGEST-MD5

采用digest-md5验证,提示密码,输入saslpasswd2的密码。

2.5. 配置复制服务器
由于没有配置两台服务器,所以还没有测试。

Chapter 3. HowTo
Table of Contents

3.1. 禁止整个服务器的匿名访问
3.1. 禁止整个服务器的匿名访问
在slapd.conf配置文件中加入disallow bind_anon即可。


在windows下在dos命令行模式启动和停止openldap服务的命令:
启动openldap:
  net start openldap-slapd
关闭openldap:
  net stop openldap-slapd
posted @ 2006-12-19 13:38 bismarck 阅读(774) | 评论 (0)编辑 收藏
  2006年12月15日

  mysql-front   中的中文内容有的时候没法正确显示,只要在定义链接时把 字符集 设成 ‘binary’所有中文信息就能正常显示了。

posted @ 2006-12-15 17:33 bismarck 阅读(867) | 评论 (2)编辑 收藏
  2006年12月14日
刚刚接触linux,装完fedora后想启动的时候就启动tomcat的服务,总算是搞定了

在/etc/rc.d/rc.local中加入:
export JDK_HOME=/usr/java/jdk1.5.0_09
export JAVA_HOME=/usr/java/jdk1.5.0_09
cd /home/software/tomcat/bin
./catalina.sh start
就是如同dos下的批处理当然是要根据实际你tomcat安在哪来决定。

posted @ 2006-12-14 19:01 bismarck 阅读(861) | 评论 (1)编辑 收藏


1.下载eclipse,我下的是3.2.1
2.下载jbpm软件包,上jboss那个网站,去下jbpm-starters-kit-3.0.4.zip,其中包括了gpd软件包,主公作区,和相关数据库文件生成的目录。
3.要在eclipse下能够可视化编辑jbpm流程只需要将解压目录下的 \jbpm-starters-kit-3.1.2\jbpm-designer\jbpm-gpd-feature\eclipse的feature和plugins的内容考到eclipse目录下的对应目录下就可以了。重新启动eclipse可以发现能够建立jboss jbpm的project了。

另外一个问题就是生成数据库文件

将 jbpm-starters-kit-3.1.1 下的子目录 jbpm 改名为 jbpm.3 ,否则在执行下面的 ant 命令时会报如 jbpm.3 目录不存在的错误
 修改build.properties文件也行, 把jbpm.3那个地方改成你解压根目录下jbpm文件夹的路径

(注意:生成脚本后没有oracle的,要改一下build.xml文件才能生成oracle的:

找到下边内容

<target name="all.tests"  depends="daffodildb.test,derby.test,firebird.test,hsqldb.test,mssql.test,mysql.test,postgresql.test,sybase.test" description="test jBPM on all databases and produces html reports in the build directory"/>

  <target name="all.scripts"
    depends="prepare,daffodildb.scripts,derby.scripts,
    firebird.scripts,hsqldb.scripts,mssql.scripts,mysql.scripts,
    postgresql.scripts,sybase.scripts"
    description="generates all database scripts for all databases in the build directory"/>
   
    改成 <target name="all.tests"
   depends="daffodildb.test,derby.test,firebird.test,
    hsqldb.test,mssql.test,mysql.test,postgresql.test,oracle.test,sybase.test"
   description="test jBPM on all databases and produces html reports in the build directory"/>

   <target name="all.scripts"
    depends="prepare,daffodildb.scripts,derby.scripts,
    firebird.scripts,hsqldb.scripts,mssql.scripts,mysql.scripts,
    postgresql.scripts,oracle.scripts,sybase.scripts"
     相信我们也能看出来,这两段内容我们可以去掉那些你不想此次编译出来的脚本,比如不想编译出来 mysql的脚本那么就把 mysql.test? 和 mysql.scripts 去掉吧。别忘了逗号。

1.首先要有ant,并且在环境变量中进行配置;
2.配置方法如下:
  新建“ANT_HOME”里边加上ant的根目录
      "path"里边加上ANT_HOME 中的lib 和 bin目录。
3.进入cmd中,将目录确定在这个解压目录 打ant 就能生成一个build文件价里边有所有数据库脚本

posted @ 2006-12-14 16:20 bismarck 阅读(5929) | 评论 (1)编辑 收藏
仅列出标题