如何在Ubuntu Linux上安装Kanboard并通过LDAP进行身份验证
Kanboard是一个免费的开源项目管理软件程序,旨在使用Kanban方法有效地管理项目。
使用KANBAN方法可以将工作流程可视化,限制正在进行的工作和有效地工作。
与板的项目清晰概述,每个列代表工作流程的步骤。
任务限制避免在同时处理太多任务,并专注于完成工作。
Kanban方法具有比Scrum等其他敏捷项目管理方法更少的限制。
Kanban更灵活,只关注必需品。
本文介绍了Ubuntu 16的Kanboard的安装和配置。
1.更新系统
在安装Kanboard之前,更新系统。
# sudo apt-get update
2.安装MariaDB.
默认情况下,Kanboard使用SQLite来存储数据。
我们将使用MariaDB来提高生产中的表现。
使用以下命令安装MariaDB。
# sudo apt-get install mariadb-server mariadb-client
检查MariaDB的状态,并在系统启动期间启用它。
# sudo systemctl status mysql # sudo systemctl enable mysql
可选地,我们可以使用mysql_secure_installation保护MariaDB
# sudo mysql_secure_installation
3.配置MariaDB数据库
接下来,我们将为Kanboard创建一个数据库和用户。
# mysql -u root -p -e "CREATE DATABASE kanboard;" # mysql -u root -p -e "CREATE USER 'kanboarduser'@'localhost' IDENTIFIED BY 'somepassword';" # mysql -u root -p -e "GRANT ALL PRIVILEGES ON kanboard.* TO 'kanboarduser'@'localhost' IDENTIFIED BY 'somepassword' WITH GRANT OPTION;" # mysql -u root -p -e "FLUSH PRIVILEGES;"
4.安装Apache和PHP
Kanboard需要PHP 5.3.9或者更大。
有关最佳性能,我们将使用以下命令安装PHP 7及其必要的依赖项。
# sudo apt-get install -y apache2 libapache2-mod-php7.0 php7.0-cli php7.0-mbstring php7.0-sqlite3 php7.0-opcache php7.0-json php7.0-mysql php7.0-pgsql php7.0-ldap php7.0-gd
检查Apache和PHP的状态,启用Apache以在系统启动期间启动。
# sudo systemctl status apache2 # sudo systemctl enable apache2 # php --version
5.安装Kanboard.
更改为Web root并下载最新的Kanboard,解压缩并将数据和插件目录的所有权更改为Apache用户,例如:www-data。
删除zip文件。
# cd /var/www/html # sudo wget https://kanboard.net/kanboard-latest.zip # sudo apt-get install unzip # sudo unzip kanboard-latest.zip # sudo chown -R www-data:www-data kanboard/data kanboard/plugins # sudo rm kanboard-latest.zip
从下载的Kanboard目录导入MySQL架构
# mysql -u root -p kanboard < /var/www/html/kanboard/app/Schema/Sql/mysql.sql
编辑Kanboard配置文件以使用MariaDB数据库
# cd /var/www/html/kanboard # sudo mv config.default.php config.php
将数据库驱动程序从SQLite更改为MariaDB。
还指定MariaDB用户名,密码,数据库和主机名。
# vi config.php //Database driver: sqlite, mysql or postgres (sqlite by default) define('DB_DRIVER', 'mysql'); //Mysql/Postgres username define('DB_USERNAME', 'kanboarduser'); //Mysql/Postgres password define('DB_PASSWORD', 'somepassword'); //Mysql/Postgres hostname define('DB_HOSTNAME', 'localhost'); //Mysql/Postgres database name define('DB_NAME', 'kanboard');
重新启动Apache并将浏览器指向http://<public_ip_or_domain_name/kanboard>使用用户名作为"admin"和密码作为'admin'登录。
登录后,通过单击页面右上角的"管理"下拉菜单中的"用户管理"更改管理员的密码。
6.设置Cron作业
Kanboard需要在日常运行后台工作,以便以下 -
→报告和分析(计算每个项目的日常统计数据)→发送逾期任务通知→执行与事件"为任务的日常后台作业的自动操作"
我们将使用CRONTAB定义一个CRONJOB,用于使用CRONTAB由Apache用户执行的CRONTAB:www-data
# sudo crontab -u www-data -e no crontab for www-data - using an empty one
在凌晨8点执行每日Cronjob
0 8 * * * cd /var/www/html/kanboard && ./cli cronjob >/dev/null 2>&1
7. OpenLDAP身份验证
到目前为止,我们已经安装了带有管理员访问的Kanboard。
我们还可以使用LDAP作为本地帐户提供程序来验证用户。
在OpenLDAP设置中,我们通过名称'Mike'创建了LDAP用户。
让我们在Kanboard中验证此用户。
激活LDAP身份验证时,登录过程会类似于以下→首先尝试使用数据库进行身份验证用户。
→如果在数据库中找不到用户,则执行LDAP身份验证。
→如果LDAP身份验证成功,则默认情况下,本地用户将自动创建,没有密码,并标记为LDAP用户。
编辑Kanboard配置文件以添加LDAP认证用户。
启用调试模式,然后将日志写入文件,然后选择LDAP配置。
我们可以在以后将调试模式更改为false。
对于本文,日志文件位置将位于/var/www/html/kanboard/data/debug.log
# cd /var/www/html/kanboard/ # vi config.php define('DEBUG', true); //Available log drivers: syslog, stderr, stdout or file define('LOG_DRIVER', 'file'); //Log filename if the log driver is "file" define('LOG_FILE', DATA_DIR.DIRECTORY_SEPARATOR.'debug.log');
对于LDAP身份验证,请编辑以下内容。
//Enable LDAP authentication (false by default) define('LDAP_AUTH', true); //LDAP server hostname define('LDAP_SERVER', '10.0.0.196'); //LDAP server port (389 by default) define('LDAP_PORT', 389); //By default, require certificate to be verified for ldaps://style URL. Set to false to skip the verification define('LDAP_SSL_VERIFY', false); //Enable LDAP START_TLS define('LDAP_START_TLS', false); //Set to true if you want to preserve the case define('LDAP_USERNAME_CASE_SENSITIVE', false); //LDAP bind type: "anonymous", "user" or "proxy" define('LDAP_BIND_TYPE', 'user'); //LDAP username to use with proxy mode //LDAP username pattern to use with user mode define('LDAP_USERNAME', 'uid=%s,ou=groups,dc=theitroad,dc=com'); //LDAP password to use for proxy mode define('LDAP_PASSWORD', ''); //LDAP DN for users //Example for ActiveDirectory: CN=Users,DC=kanboard,DC=local //Example for OpenLDAP: ou=People,dc=example,dc=com define('LDAP_USER_BASE_DN', 'ou=groups,dc=theitroad,dc=com'); //LDAP pattern to use when searching for a user account //Example for ActiveDirectory: '(&(objectClass=user)(sAMAccountName=%s))' //Example for OpenLDAP: 'uid=%s' define('LDAP_USER_FILTER', 'uid=%s'); //LDAP attribute for username //Example for ActiveDirectory: 'samaccountname' //Example for OpenLDAP: 'uid' define('LDAP_USER_ATTRIBUTE_USERNAME', 'uid'); //LDAP attribute for user full name //Example for ActiveDirectory: 'displayname' //Example for OpenLDAP: 'cn' define('LDAP_USER_ATTRIBUTE_FULLNAME', 'cn'); //LDAP attribute for user email define('LDAP_USER_ATTRIBUTE_EMAIL', 'mail'); //LDAP attribute to find groups in user profile define('LDAP_USER_ATTRIBUTE_GROUPS', 'gid'); //LDAP attribute for user avatar image: thumbnailPhoto or jpegPhoto define('LDAP_USER_ATTRIBUTE_PHOTO', ''); //LDAP attribute for user language, example: 'preferredlanguage' //Put an empty string to disable language sync define('LDAP_USER_ATTRIBUTE_LANGUAGE', ''); //Allow automatic LDAP user creation define('LDAP_USER_CREATION', false); //LDAP DN for administrators //Example: CN=Kanboard-Admins,CN=Users,DC=kanboard,DC=local define('LDAP_GROUP_ADMIN_DN', 'cn=ircusers,ou=groups,dc=theitroad,dc=com'); //LDAP DN for managers //Example: CN=Kanboard Managers,CN=Users,DC=kanboard,DC=local define('LDAP_GROUP_MANAGER_DN', ''); //Enable LDAP group provider for project permissions //The end-user will be able to browse LDAP groups from the user interface and allow access to specified projects define('LDAP_GROUP_PROVIDER', false); //LDAP Base DN for groups define('LDAP_GROUP_BASE_DN', 'ou=groups,dc=theitroad,dc=com'); //LDAP group filter //Example for ActiveDirectory: (&(objectClass=group)(sAMAccountName=%s*)) define('LDAP_GROUP_FILTER', ''); //LDAP user group filter //If this filter is configured, it will search user groups in LDAP_GROUP_BASE_DN with this filter //Example for OpenLDAP: (&(objectClass=posixGroup)(memberUid=%s)) define('LDAP_GROUP_USER_FILTER', '(&(objectClass=posixGroup)(memberUid=%s))'); //LDAP attribute for the group name define('LDAP_GROUP_ATTRIBUTE_NAME', 'cn');
保存文件并尝试以"迈克"和密码作为"MyPass"登录,以至于我们在OpenLDAP文章中创建的"mypass"。
我们可能会发现用户的"Mike"无法登录,因为Kanboard无法在MySQL数据库中将用户标记为LDAP用户,因此无法创建默认本地用户。
了解有关Kanboard Github Center中的问题。
如果我们对LDAP部分有任何疑问,请在GitHub问题部分中发布。
此问题的解决方法是通过在管理界面的右上部分中执行SQL查询或者通过用户管理手动将用户作为LDAP用户添加为LDAP用户。
在"用户管理"部分中,单击"新用户"并仅填写用户名,将此用户标记为"远程用户",并将其角色作为"安全部分"中的角色提供。
我们还可以执行以下查询以从MySQL Shell作为root用户执行相同;
mysql> insert into users (username, is_ldap_user) VALUES ('mike',1);
现在远程LDAP用户'Mike'将能够在Kanboard中进行身份验证。