(一)Apache配置:
一旦使用Apache做为Web server,则需要修改Apache的配置,将/login入口的http验证功能取消--移除apache配置相关文件中的类似如下行的代码:
<LocationMatch "/[^/]+/login">
AuthType Basic
AuthName "trac"
AuthUserFile E:/Trac/passwd.txt
Require valid-user
</LocationMatch>
最后类似这样的配置在http.conf中
<location /webbase/>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/www/webbase/
PythonOption TracUriRoot /webbase/
SetEnv PYTHON_EGG_CACHE /var/www/webbase/
</location>
(二)修改trac.ini配置:
(1)新增组件的支持:
在[components]段中增加:
trac.web.auth.LoginModule = disabled #禁用传统的登录模块插件
acct_mgr.web_ui.LoginModule = enabled
acct_mgr.web_ui.RegistrationModule = enabled
acct_mgr.htfile.HtPasswdStore = enabled
(2)设置密码表文件:
[account-manager]
password_format = htpasswd
password_store = HtPasswdStore
password_file = /var/www/webbase/conf/.htpasswd #这里配置密码文件的路径,根据实际情况修改
(3)添加初始用户以及修改目录权限
使用接下来的Linux命令添加初始用户
$sudo htpasswd -c /var/www/webbase/conf/.htpasswd user_name
并把密码文件的权限改了,包括所有的网站页面,使用以下命令
$ sudo chown -R root:www-data www
$ sudo chmod -R g+rsw www/
(4)给添加的用户admin的管理权限
使用接下来的Linux命令把用户设为trac-admin权限
trac-admin /path/to/my/project
permission add username-from-htpasswd TRAC_ADMIN
permission list username-from-htpasswd
这样就可以在管理页面对用户进行管理了。
可以使用的配置比对
# -*- coding: utf-8 -*-
[account-manager]
account_changes_notify_addresses =
authentication_url =
force_passwd_change = true
generated_password_length = 8
hash_method = HtDigestHashMethod
htdigest_realm =
htpasswd_hash_type = crypt
password_file = /var/www/webbase/conf/.htpasswd
password_format = htpasswd
password_store = HtPasswdStore
persistent_sessions = False
user_lock_max_time = 0
verify_email = False
[attachment]
max_size = 262144
render_unsafe_content = false
[browser]
color_scale = True
downloadable_paths = /trunk, /branches/*, /tags/*
hide_properties = svk:merge
intermediate_color =
intermediate_point =
newest_color = (255, 136, 136)
oldest_color = (136, 136, 255)
oneliner_properties = trac:summary
render_unsafe_content = false
wiki_properties = trac:description
[changeset]
max_diff_bytes = 10000000
max_diff_files = 0
wiki_format_messages = true
[components]
acct_mgr.admin.accountguardadminpage = enabled
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.guard.accountguard = enabled
acct_mgr.htfile.abstractpasswordfilestore = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.http.httpauthstore = enabled
acct_mgr.notification.accountchangelistener = enabled
acct_mgr.notification.accountchangenotificationadminpanel = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled
acct_mgr.pwhash.htpasswdhashmethod = enabled
acct_mgr.svnserve.svnservepasswordstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.emailverificationmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
iniadmin.iniadmin.iniadminplugin = disabled
svnauthz.* = enabled
svnauthz.admin_ui.svnauthzadminpage = enabled
timingandestimationplugin.api.timetrackingsetupparticipant = enabled
timingandestimationplugin.hours_layout_changer.hourslayoutchanger = enabled
timingandestimationplugin.hours_layout_changer.ticketpropslayoutchanger = enabled
timingandestimationplugin.query_webui.querywebuiaddon = enabled
timingandestimationplugin.stopwatch.ticketstopwatch = enabled
timingandestimationplugin.tande_filters.reportsfilter = enabled
timingandestimationplugin.tande_filters.timeclickfilter = enabled
timingandestimationplugin.tande_filters.totalhoursfilter = enabled
timingandestimationplugin.ticket_daemon.timetrackingticketobserver = enabled
timingandestimationplugin.ticket_daemon.timetrackingticketvalidator = enabled
timingandestimationplugin.ticket_webui.ticketwebuiaddon = enabled
timingandestimationplugin.webui.timingestimationandbillingpage = enabled
trac.web.auth.loginmodule = disabled
tracopt.perm.authz_policy.authzpolicy = enabled
tracopt.perm.config_perm_provider.extrapermissionsprovider = enabled
tracopt.ticket.commit_updater.committicketreferencemacro = enabled
tracopt.ticket.commit_updater.committicketupdater = enabled
tracopt.ticket.deleter.ticketdeleter = enabled
tracwysiwyg.wysiwygmodule = enabled
webadmin.* = enabled
webadmin.basics.projectadminpage = enabled
webadmin.logging.loggingadminpage = enabled
webadmin.perm.permissionadminpage = enabled
webadmin.plugin.pluginadminpage = enabled
webadmin.ticket.componentadminpage = enabled
webadmin.ticket.milestoneadminpage = enabled
webadmin.ticket.priorityadminpage = enabled
webadmin.ticket.severityadminpage = enabled
webadmin.ticket.tickettypeadminpage = enabled
webadmin.ticket.versionadminpage = enabled
webadmin.web_ui.adminmodule = enabled
[header_logo]
alt = webbase
height = 60
link = http://192.168.6.6/webbase
src =
width = 390
[inherit]
plugins_dir =
templates_dir =
[logging]
log_file = trac.log
log_level = DEBUG
log_type = none
[milestone]
stats_provider = DefaultTicketGroupStatsProvider
[mimeviewer]
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
pygments_default_style = trac
pygments_modes =
tab_width = 8
treat_as_binary = application/octet-stream,application/pdf,application/postscript,application/msword,application/rtf,
[notification]
admit_domains =
always_notify_owner = false
always_notify_reporter = false
always_notify_updater = true
ambiguous_char_width = single
email_sender = SmtpEmailSender
ignore_domains =
mime_encoding = none
sendmail_path = sendmail
smtp_always_bcc =
smtp_always_cc =
smtp_default_domain =
smtp_enabled = false
smtp_from = trac@localhost
smtp_from_name =
smtp_password =
smtp_port = 25
smtp_replyto = trac@localhost
smtp_server = localhost
smtp_subject_prefix = __default__
smtp_user =
ticket_subject_template = $prefix #$ticket.id: $summary
use_public_cc = false
use_short_addr = false
use_tls = false
[project]
admin =
admin_trac_url = .
descr = webbase平台
footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/" mce_href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
icon = common/trac.ico
name = webbase
url =
[query]
default_anonymous_query = status!=closed&cc~=$USER
default_query = status!=closed&owner=$USER
items_per_page = 100
ticketlink_query = ?status=!closed
[report]
items_per_page = 100
items_per_page_rss = 0
[revisionlog]
default_log_limit = 100
[roadmap]
stats_provider = DefaultTicketGroupStatsProvider
[search]
min_query_length = 3
[svn]
branches = trunk,branches/*
tags = tags/*
[svnauthzadmin]
show_all_repos = true
[ticket]
default_cc =
default_component = webkit/*
default_description =
default_keywords =
default_milestone = 3/19/11
default_owner =
default_priority = major
default_resolution = fixed
default_severity =
default_summary =
default_type = task
default_version =
max_comment_size = 262144
max_description_size = 262144
preserve_newlines = default
restrict_owner = false
workflow = ConfigurableTicketWorkflow
[ticket-custom]
billable = checkbox
billable.label = Billable?
billable.order = 3
billable.value = 1
estimatedhours = text
estimatedhours.label = Estimated Number of Hours
estimatedhours.order = 1
estimatedhours.value = 0
hours = text
hours.label = Add Hours to Ticket
hours.order = 2
hours.value = 0
totalhours = text
totalhours.label = Total Hours
totalhours.order = 4
totalhours.value = 0
[ticket-workflow]
accept = new,assigned,accepted,reopened -> accepted
accept.operations = set_owner_to_self
accept.permissions = TICKET_MODIFY
leave = * -> *
leave.default = 1
leave.operations = leave_status
reassign = new,assigned,accepted,reopened -> assigned
reassign.operations = set_owner
reassign.permissions = TICKET_MODIFY
reopen = closed -> reopened
reopen.operations = del_resolution
reopen.permissions = TICKET_CREATE
resolve = new,assigned,accepted,reopened -> closed
resolve.operations = set_resolution
resolve.permissions = TICKET_MODIFY
[timeline]
abbreviated_messages = True
changeset_collapse_events = false
changeset_long_messages = false
changeset_show_files = 0
default_daysback = 30
max_daysback = 90
newticket_formatter = oneliner
ticket_show_details = false
[trac]
auth_cookie_lifetime = 0
auth_cookie_path =
authz_file = /opt/svn/webbase/conf/passwd
authz_module_name = webbase
auto_preview_timeout = 2.0
auto_reload = False
backup_dir = db
base_url =
check_auth_ip = false
database = sqlite:db/trac.db
debug_sql = False
default_charset = utf-8
default_handler = WikiModule
default_language = gb2312
default_timezone =
genshi_cache_size = 128
htdocs_location =
ignore_auth_case = false
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,prefs,help,about
mysqldump_path = mysqldump
never_obfuscate_mailto = false
permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy
permission_store = DefaultPermissionStore
pg_dump_path = pg_dump
repository_dir =
repository_sync_per_request = (default)
repository_type = svn
resizable_textareas = true
secure_cookies = False
show_email_addresses = false
show_ip_addresses = false
timeout = 20
use_base_url_for_redirect = False
[versioncontrol]
allowed_repository_dir_prefixes =
[wiki]
ignore_missing_pages = false
max_size = 262144
render_unsafe_content = false
safe_schemes = cvs,file,ftp,git,irc,http,https,news,sftp,smb,ssh,svn,svn+ssh
split_page_names = false