Thi*_*his 8 active-directory software-rec wiki markdown restructuredtext
我需要为我们的工程组建立一个wiki;我们是企业范围的 Windows Active Directory 域的一部分。大多数企业 IT 应用程序使用 NTLM 进行身份验证(通过 Internet Exploder 自动);虽然我不是企业 IT 部门的一员,但我认识到单点登录 (SSO) 对于用户接受度很重要。
我希望找到一个经过充分测试并且可以在 linux 上托管的免费和开源 wiki参见 End Note 1,同时允许企业 Windows 笔记本电脑在没有密码提示的情况下自动进行身份验证。
我见过一些让moin使用 NTLM进行身份验证的技巧,请参阅 End Note 2,但我不知道这在实践中的实际效果如何;所以任何使用 moin + NTLM 的部署经验都是有价值的。我也看过FOS Wiki,但FOS Wiki 似乎不支持自动登录。
简而言之,我正在寻找具有原生、自动 NTLM 身份验证支持的最佳免费、开源、linux wiki 实现,请参阅尾注 3;如果它可以使用Markdown或reStructured Text ,我会加分。
我最终使用了它moin,我安装在/opt/moin...我使用 WSGI 托管它apache2...我无法执行moin自动 NTLM 身份验证,除非我在 Windows 下托管它...我在 linux 下托管它,但它仍然根据我们的身份验证NT 域中的本地 LDAP 服务器。
这是/opt/moin/config/wikiconfig.py...如果您使用它,请理解我清理了配置,并且下面的 LDAP 身份验证代码中的“foo”实际上是我公司的名称...每个人都有不同的 LDAP 设置,因此您可能需要调整一些您环境中的身份验证参数... YMMV...
# -*- coding: iso-8859-1 -*-\n# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a\n# western country and you don\'t know that you use utf-8, you probably want to\n# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode\n# encoding) you MUST use: coding: utf-8\n# That setting must match the encoding your editor uses when you modify the\n# settings below. If it does not, special non-ASCII chars will be wrong.\n\n"""\n MoinMoin - Configuration for a single wiki\n\n If you run a single wiki only, you can omit the farmconfig.py config\n file and just use wikiconfig.py - it will be used for every request\n we get in that case.\n\n Note that there are more config options than you\'ll find in\n the version of this file that is installed by default; see\n the module MoinMoin.config.multiconfig for a full list of names and their\n default values.\n\n Also, the URL http://moinmo.in/HelpOnConfiguration has\n a list of config options.\n\n ** Please do not use this file for a wiki farm. Use the sample file\n from the wikifarm directory instead! **\n"""\n\nimport os\n\nfrom MoinMoin.config import multiconfig, url_prefix_static\nfrom MoinMoin.auth.ldap_login import LDAPAuth\nfrom MoinMoin.auth import MoinAuth\n\n\nclass Config(multiconfig.DefaultConfig):\n\n # Critical setup ---------------------------------------------------\n\n # Directory containing THIS wikiconfig:\n wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))\n\n # We assume that this config file is located in the instance directory, like:\n # instance_dir/\n # wikiconfig.py\n # data/\n # underlay/\n # If that\'s not true, feel free to just set instance_dir to the real path\n # where data/ and underlay/ is located:\n #instance_dir = \'/where/ever/your/instance/is\'\n instance_dir = \'/opt/moin\'\n\n # Where your own wiki pages are (make regular backups of this directory):\n data_dir = os.path.join(instance_dir, \'data\', \'\') # path with trailing /\n\n # Where system and help pages are (you may exclude this from backup):\n data_underlay_dir = os.path.join(instance_dir, \'underlay\', \'\') # path with trailing /\n\n # The URL prefix we use to access the static stuff (img, css, js).\n # Note: moin runs a static file server at url_prefix_static path (relative\n # to the script url).\n # If you run your wiki script at the root of your site (/), just do NOT\n # use this setting and it will automatically work.\n # If you run your wiki script at /mywiki, you need to use this:\n #url_prefix_static = \'/mywiki\' + url_prefix_static\n\n\n # Wiki identity ----------------------------------------------------\n\n # Site name, used by default for wiki name-logo [Unicode]\n sitename = u\'QA Wiki\'\n\n # Wiki logo. You can use an image, text or both. [Unicode]\n # For no logo or text, use \'\' - the default is to show the sitename.\n # See also url_prefix setting below!\n logo_string = u\'<img src="%s/common/moinmoin.png" alt="MoinMoin Logo">\' % url_prefix_static\n\n # name of entry page / front page [Unicode], choose one of those:\n\n # a) if most wiki content is in a single language\n page_front_page = u"DefaultPage"\n\n # b) if wiki content is maintained in many languages\n #page_front_page = u"FrontPage"\n\n # The interwiki name used in interwiki links\n interwikiname = u\'QAWiki\'\n # Show the interwiki name (and link it to page_front_page) in the Theme,\n # nice for farm setups or when your logo does not show the wiki\'s name.\n #show_interwiki = 1\n\n\n # Security ----------------------------------------------------------\n\n # This is checked by some rather critical and potentially harmful actions,\n # like despam or PackageInstaller action:\n #superuser = [u"YourName", ]\n superuser = [u"Mike_Pennington", ]\n\n # IMPORTANT: grant yourself admin rights! replace YourName with\n # your user name. See HelpOnAccessControlLists for more help.\n # All acl_rights_xxx options must use unicode [Unicode]\n acl_rights_before = u"Mike_Pennington:read,write,delete,revert,admin"\n acl_rights_default = u"Mike_Pennington:read,write,delete,revert,admin, Known:read,write All:read"\n\n # The default (ENABLED) password_checker will keep users from choosing too\n # short or too easy passwords. If you don\'t like this and your site has\n # rather low security requirements, feel free to DISABLE the checker by:\n #password_checker = None # None means "don\'t do any password strength checks"\n password_checker = None\n\n # Link spam protection for public wikis (Uncomment to enable)\n # Needs a reliable internet connection.\n #from MoinMoin.security.antispam import SecurityPolicy\n\n\n # Mail --------------------------------------------------------------\n\n # Configure to enable subscribing to pages (disabled by default)\n # or sending forgotten passwords.\n\n # SMTP server, e.g. "mail.provider.com" (None to disable mail)\n #mail_smarthost = ""\n\n # The return address, e.g u"J\xc3\xbcrgen Wiki <noreply@mywiki.org>" [Unicode]\n #mail_from = u""\n\n # "user pwd" if you need to use SMTP AUTH\n #mail_login = ""\n\n\n # User interface ----------------------------------------------------\n\n # Add your wikis important pages at the end. It is not recommended to\n # remove the default links. Leave room for user links - don\'t use\n # more than 6 short items.\n # You MUST use Unicode strings here, but you need not use localized\n # page names for system and help pages, those will be used automatically\n # according to the user selected language. [Unicode]\n navi_bar = [\n # If you want to show your page_front_page here:\n #u\'%(page_front_page)s\',\n u\'DefaultPage\',\n u\'SiteIndex\',\n u\'RecentChanges\',\n u\'FindPage\',\n u\'HelpContents\',\n ]\n\n # The default theme anonymous or new users get\n theme_default = \'modernized\'\n\n\n # Language options --------------------------------------------------\n\n # See http://moinmo.in/ConfigMarket for configuration in\n # YOUR language that other people contributed.\n\n # The main wiki language, set the direction of the wiki pages\n language_default = \'en\'\n\n # the following regexes should match the complete name when used in free text\n # the group \'all\' shall match all, while the group \'key\' shall match the key only\n # e.g. CategoryFoo -> group \'all\' == CategoryFoo, group \'key\' == Foo\n # moin\'s code will add ^ / $ at beginning / end when needed\n # You must use Unicode strings here [Unicode]\n page_category_regex = ur\'(?P<all>Category(?P<key>(?!Template)\\S+))\'\n page_dict_regex = ur\'(?P<all>(?P<key>\\S+)Dict)\'\n page_group_regex = ur\'(?P<all>(?P<key>\\S+)Group)\'\n page_template_regex = ur\'(?P<all>(?P<key>\\S+)Template)\'\n\n # Content options ---------------------------------------------------\n\n # Show users hostnames in RecentChanges\n show_hosts = 1\n\n # Enable graphical charts, requires gdchart.\n #chart_options = {\'width\': 600, \'height\': 300}\n\n\n # LDAP authentication ---------------------------------------------------\n\n ldap_authenticator1 = LDAPAuth(\n server_uri=\'ldap://10.16.16.237/\',\n bind_dn = r\'Americas\\%(username)s\',\n base_dn=\'dc=amer,dc=foo,dc=com\',\n bind_pw=\'%(password)s\',\n scope=2,\n referrals=0, # LDAP REFERRALS (0 needed for AD)\n search_filter=\'(sAMAccountName=%(username)s)\',\n givenname_attribute=\'givenName\',\n surname_attribute=\'sn\',\n aliasname_attribute=\'displayname\',\n email_attribute=\'mail\',\n email_callback=None, # callback function called to make up email address\n coding=\'utf-8\', # coding used for ldap queries and result values\n timeout=10, # how long we wait for the ldap server [s]\n start_tls=0, # usage of Transport Layer Security 0 = No, 1 = Try, 2 = Required\n tls_cacertdir=None,\n tls_cacertfile=None,\n tls_certfile=None,\n tls_keyfile=None,\n tls_require_cert=0, # 0 == ldap.OPT_X_TLS_NEVER (needed for self-signed certs)\n bind_once=True, # set to True to only do one bind - useful if configured to bind as the user on the first attempt\n autocreate=True, # set to True to automatically create/update user profiles\n #name=\'ldap\', # use e.g. \'ldap_pdc\' and \'ldap_bdc\' (or \'ldap1\' and \'ldap2\') if you auth against 2 ldap servers\n report_invalid_credentials=True, # whether to emit "invalid username or password" msg at login time or not\n )\n\n auth = [ldap_authenticator1,] # this is a list, you may have multiple ldap authenticators\n # as well as other authenticators\n\n cookie_lifetime = (0, 4) # no anon user sessions, 1h session lifetime for logged-in users\n\n # customize user preferences (optional, see MoinMoin/config/multiconfig for internal defaults)\n # you maybe want to use user_checkbox_remove, user_checkbox_defaults, user_form_defaults,\n # user_form_disable, user_form_remove.\n (\'checkbox_defaults\',\n {\n \'mailto_author\': 0,\n \'edit_on_doubleclick\': 1,\n \'remember_last_visit\': 0,\n \'show_comments\': 0,\n \'show_nonexist_qm\': False,\n \'show_page_trail\': 1,\n \'show_toolbar\': 1,\n \'show_topbottom\': 0,\n \'show_fancy_diff\': 1,\n \'wikiname_add_spaces\': 0,\n \'remember_me\': 1,\n },\n "Defaults for user preferences, see HelpOnConfiguration/UserPreferences.")\nRun Code Online (Sandbox Code Playgroud)\n\n我正在使用 wsgi 和 moin,所以我需要/opt/moin/moin.wsgi
# -*- coding: iso-8859-1 -*-\n"""\n MoinMoin - mod_wsgi driver script\n\n To use this, add those statements to your Apache\'s VirtualHost definition:\n\n # you will invoke your moin wiki at the root url, like http://servername/FrontPage:\n WSGIScriptAlias / /some/path/moin.wsgi\n\n # create some wsgi daemons - use someuser.somegroup same as your data_dir:\n WSGIDaemonProcess daemonname user=someuser group=somegroup processes=5 threads=10 maximum-requests=1000 umask=0007\n\n # use the daemons we defined above to process requests!\n WSGIProcessGroup daemonname\n\n @copyright: 2008 by MoinMoin:ThomasWaldmann\n @license: GNU GPL, see COPYING for details.\n"""\n\nimport sys, os\n\n# a) Configuration of Python\'s code search path\n# If you already have set up the PYTHONPATH environment variable for the\n# stuff you see below, you don\'t need to do a1) and a2).\n\n# a1) Path of the directory where the MoinMoin code package is located.\n# Needed if you installed with --prefix=PREFIX or you didn\'t use setup.py.\n#sys.path.insert(0, \'PREFIX/lib/python2.3/site-packages\')\n\n# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.\n# See wiki/config/... for some sample config files.\n#sys.path.insert(0, \'/path/to/wikiconfigdir\')\nsys.path.insert(0, \'/opt/moin\')\nsys.path.insert(0, \'/opt/moin/code\')\nsys.path.insert(0, \'/opt/moin/config\')\n\n# b) Configuration of moin\'s logging\n# If you have set up MOINLOGGINGCONF environment variable, you don\'t need this!\n# You also don\'t need this if you are happy with the builtin defaults.\n# See wiki/config/logging/... for some sample config files.\n#from MoinMoin import log\n#log.load_config(\'/path/to/logging_configuration_file\')\n\nfrom code.MoinMoin.web.serving import make_application\n\n# Creating the WSGI application\n# use shared=True to have moin serve the builtin static docs\n# use shared=False to not have moin serve static docs\n# use shared=\'/my/path/to/htdocs\' to serve static docs from that path\napplication = make_application(shared=True)\nRun Code Online (Sandbox Code Playgroud)\n\nFWIW,这是我的 apache 配置文件....../etc/apache2/conf.d/moin.conf
# Create some wsgi daemons - use these parameters for a simple setup\nWSGIDaemonProcess moin user=www-data group=www-data processes=5 threads=10 maximum-requests=1000 umask=0007\n\n#\nWSGIProcessGroup moin\nRun Code Online (Sandbox Code Playgroud)\n\n这是/etc/apache2/sites-available/netwiki...
<VirtualHost *:80>\n ServerName netwiki.us.foo.com\n\n RewriteEngine on\n RewriteCond %{HTTPS} !=on\n RewriteRule ^(.*)$ https://netwiki.us.foo.com/$1 [L,R]\n\n DocumentRoot /opt/moin/code/\n WSGIScriptAlias / /opt/moin/moin.wsgi\n</VirtualHost>\n\n<VirtualHost *:443>\n ServerName netwiki.us.foo.com\n DocumentRoot /opt/moin/code/\n WSGIScriptAlias / /opt/moin/moin.wsgi\n\n # Generate with...\n # openssl req -new -x509 -days 365 -nodes -out netwiki.pem -keyout netwiki.key\n SSLEngine on\n SSLCertificateFile /etc/apache2/ssl/netwiki.pem\n SSLCertificateKeyFile /etc/apache2/ssl/netwiki.key\n</VirtualHost>\nRun Code Online (Sandbox Code Playgroud)\n