Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7694117
  • 博文数量: 637
  • 博客积分: 10265
  • 博客等级: 上将
  • 技术积分: 6165
  • 用 户 组: 普通用户
  • 注册时间: 2004-12-12 22:00
文章分类

全部博文(637)

文章存档

2011年(1)

2010年(1)

2009年(3)

2008年(12)

2007年(44)

2006年(156)

2005年(419)

2004年(1)

分类:

2006-03-11 15:05:45

Debian

彩色终端的配置

debian:~# cat .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval `dircolors`
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
debian:~#

去掉注释

debian:~# vi .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval `dircolors`
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

debian:~# logout

Debian 默认[HOME][END]键没有开放,习惯了Redhat人用着可不爽,开启它。

debian:~# vi /etc/inputrc
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

logout注销后再登录即可.

安装配置OpenLDAP

  1. 通过apt-get安装OpenLDAP

    debian:~# apt-get install slapd
    Do you want to continue? [Y/n]

    Debian Configuration

    ┌────────────┤ Configuring slapd ├─────────────┐
    │ The DNS domain name is used to construct the base DN of your LDAP │
    │ directory. Entering foo.bar.org will give you the base DN dc=foo, │
    │ dc=bar, dc=org. │
    │ │
    │ Enter your DNS domain name │
    │ │
    │ example.net________________________________________________________ │
    │ │

    │ │
    └─────────────────────────────────────┘
    里是请输入你的域名例如:example.net = dc=example,dc=net

    Debian Configuration

    ┌────────────┤ Configuring slapd ├────────────────┐
    │ Whatever you enter here will be stored as the name of your organization │
    │ in the base DN of your LDAP directory. │
    │ │
    │ Enter the name of your organization │
    │ │
    │ netkiller ______________________________________________________________ │
    │ │

    │ │
    └────────────────────────────────────────┘
    这里输入组织名即ou=postfix

    Debian Configuration

    ┌────────────┤ Configuring slapd ├───────────────┐
    │ Please enter the password for the admin entry in your LDAP directory. │
    │ │
    │ Admin password │
    │ │
    │ _______________________________________________________________________ │
    │ │

    │ │
    └───────────────────────────────────────┘
    输入密码

    Debian Configuration

    ┌──────────────┤ Configuring slapd ├──────────────┐
    │ │
    │ slapd now defaults to having the old LDAPv2 protocol not allowed. │
    │ Programs and users are generally expected to be upgraded to LDAPv3. If │
    │ you have old programs which have not been moved to use LDAPv3 and you │
    │ still need LDAPv2 support then select this option and 'allow bind_v2' │
    │ will be added to your slapd.conf to tell slapd to accept LDAPv2 │
    │ connections. │
    │ │
    │ Allow LDAPv2 protocol │
    │ │

    │ │
    └────────────────────────────────────────┘
    再输入一次

    Starting OpenLDAP: slapd.
  2. 安装辅助工具

    debian:~# apt-get install ldap-utils migrationtools
  3. Debian OpenLDAP 与Redhat OpenLDAP配置很不同,要注册一点,redhat是配置文件中指定ldap管理员 'cn=manager,dc=example,dc=net'注意"cn=manager,dc=example,dc=net"并不存在于LDAP数据库中ldapsearch 也看不到有此项条目,而Debian是管理员是通过ldapadd加入的"cn=admin,dc=example,dc=net",它是存在于LDAP 数据库中的,并用 ldapsearch -x -D 'cn=admin,dc=example,dc=net' -b 'dc=example,dc=net' 'objectclass=*' namingContexts -w chen 可以列出该条目

    debian:~# ldapsearch -x -D 'cn=admin,dc=example,dc=net' -b 'dc=example,dc=net' 'objectclass=*' namingContexts -w chen
    # extended LDIF
    #
    # LDAPv3
    # base with scope sub
    # filter: objectclass=*
    # requesting: namingContexts
    #

    # example.net
    dn: dc=example,dc=net

    # admin, example.net
    dn: cn=admin,dc=example,dc=net

    # people, example.net
    dn: ou=people,dc=example,dc=net

    # postfix, example.net
    dn: ou=postfix,dc=example,dc=net

    # courier, postfix, example.net
    dn: cn=courier,ou=postfix,dc=example,dc=net

    # chen, postfix, example.net
    dn: uid=chen,ou=postfix,dc=example,dc=net

    # search result
    search: 2
    result: 0 Success

    # numResponses: 7
    # numEntries: 6
    debian:~#
  4. postfix.schema

    创建Schema文件,在/etc/ldap/schema/目录下创建名为postfix.schema的文件

    debian:~# cd /etc/ldap/schema/
    debian:/etc/ldap/schema# cat postfix.schema
    #
    # postfix-ldap directory schema v0.1
    #
    # Created by: netkiller
    # Created: 2004-4-12
    #
    # Note: The attribute and objectclass OIDs are valid
    #

    # Attribute Type Definitions


    # Postfix Style

    #attributetype ( 1.3.6.1.4.1.7006.1.2.1.1 NAME 'uidnumber'
    DESC 'UID of the user on the mailsystem'
    EQUALITY integerMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

    #attributetype ( 1.3.6.1.4.1.7006.1.2.1.2 NAME 'gidnumber'
    DESC 'GID of the user on the mailsystem'
    EQUALITY integerMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.12461.1.1.5 NAME 'mailbox'
    DESC 'The absolute path to the mailbox for a mail account in a non-default location'
    EQUALITY caseExactIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.12461.1.1.6 NAME 'quota'
    DESC 'A string that represents the quota on a mailbox'
    EQUALITY caseExactIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.12461.1.1.8 NAME 'maildrop'
    DESC 'RFC822 Mailbox - mail alias'
    EQUALITY caseIgnoreIA5Match
    SUBSTR caseIgnoreIA5SubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )

    attributetype ( 1.3.6.1.4.1.12461.1.1.7 NAME 'clearPassword'
    DESC 'A separate text that stores the mail account password in clear text'
    EQUALITY octetStringMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128})


    attributetype ( 1.3.6.1.4.1.12461.1.1.9 NAME 'mailsource'
    DESC 'Message source'
    EQUALITY caseIgnoreIA5Match
    SUBSTR caseIgnoreIA5SubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

    # Qmail Style

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.1 NAME 'qmailUID'
    DESC 'UID of the user on the mailsystem'
    EQUALITY integerMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.2 NAME 'qmailGID'
    DESC 'GID of the user on the mailsystem'
    EQUALITY integerMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.3 NAME 'mailMessageStore'
    DESC 'Path to the maildir/mbox on the mail system'
    EQUALITY caseExactIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.4 NAME 'mailAlternateAddress'
    DESC 'Secondary (alias) mailaddresses for the same user'
    EQUALITY caseIgnoreIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.5 NAME 'mailQuota'
    DESC 'The amount of space the user can use until all further messages get bounced.'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.6 NAME 'mailHost'
    DESC 'On which qmail server the messagestore of this user is located.'
    EQUALITY caseIgnoreIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.7 NAME 'mailForwardingAddress'
    DESC 'Address(es) to forward all incoming messages to.'
    EQUALITY caseIgnoreIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.8 NAME 'deliveryProgramPath'
    DESC 'Program to execute for all incoming mails.'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.9 NAME 'qmailDotMode'
    DESC 'Interpretation of .qmail files: both, dotonly, ldaponly, ldapwithprog, none'
    EQUALITY caseIgnoreIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.10 NAME 'deliveryMode'
    DESC 'multi field entries of: normal, forwardonly, nombox, localdelivery, reply, echo'
    EQUALITY caseIgnoreIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.11 NAME 'mailReplyText'
    DESC 'A reply text for every incoming message'
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} SINGLE-VALUE )

    attributetype ( 1.3.6.1.4.1.7006.1.2.1.12 NAME 'accountStatus'
    DESC 'The status of a user account: active, nopop, disabled'
    EQUALITY caseIgnoreIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

    # Postfix Virtual Domain

    attributetype ( 1.3.6.1.4.1.12461.1.1.4 NAME 'vd'
    DESC 'A virtual domain managed by Jamm'
    EQUALITY caseIgnoreIA5Match
    SUBSTR caseIgnoreIA5SubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

    attributetype ( 1.3.6.1.4.1.12461.1.1.1 NAME 'transport'
    DESC 'A string directing postfix which transport to use'
    EQUALITY caseExactIA5Match
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{20} SINGLE-VALUE )

    # Object Class Definitions

    objectclass ( 1.3.6.1.4.1.12461.1.2.1 NAME 'postfixAccount'
    DESC 'Postfix-LDAP User' SUP top AUXILIARY
    MUST ( mail $ uid )
    MAY ( mailbox $ quota $ maildrop $ clearPassword $
    mailMessageStore $ homeDirectory $ userPassword $
    mailAlternateAddress $ uidnumber $ gidnumber $ mailQuota $
    mailHost $ mailForwardingAddress $ mailReplyText $
    accountStatus ) )

    objectclass ( 1.3.6.1.4.1.12461.1.2.2 NAME 'postfixAliases'
    SUP top STRUCTURAL
    DESC 'Mail aliasing/forwarding entry'
    MUST ( mail $ uid )
    MAY ( maildrop $ description $ mailForwardingAddress $ accountStatus ) )

    objectclass ( 1.3.6.1.4.1.12461.1.2.3 NAME 'postfixVirtualDomain'
    SUP top STRUCTURAL
    DESC 'Virtual Domain entry to be used with postfix transport maps'
    MUST ( vd $ transport )
    MAY ( o $ description $ accountStatus ) )

    # Qmail Object Class Definitions
    objectclass ( 1.3.6.1.4.1.7006.1.2.2.1 NAME 'qmailUser'
    DESC 'QMail-LDAP User' SUP top AUXILIARY
    MUST ( mail $ uid )
    MAY ( mailMessageStore $ homeDirectory $ userPassword $
    mailAlternateAddress $ qmailUID $ qmailGID $ mailQuota $
    mailHost $ mailForwardingAddress $ deliveryProgramPath $
    qmailDotMode $ deliveryMode $ mailReplyText $
    accountStatus ) )
    debian:/etc/ldap/schema#
  5. slapd.conf

    配置slapd.conf文件,在include位置加入:

    debian:/etc/ldap# vi slapd.conf
    include /etc/ldap/schema/postfix.schema
  6. reload slapd

    debian:/etc/ldap# /etc/init.d/slapd force-reload
阅读(5790) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~