基于用户名/密码认证和流量控制 安装pam_mysql(太麻烦,已放弃;以下步骤可以参考,有报错解决
1.yum install mysql -y
2.mysql -v
3.CREATE DATABASE openvpn;
4.USE openvpn;
5.
CREATE TABLE IF NOT EXISTS `user` ( `username` char(32) COLLATE utf8_unicode_ci NOT NULL, `password` char(128) COLLATE utf8_unicode_ci DEFAULT NULL, `active` int(10) NOT NULL DEFAULT ‘1‘, `creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `name` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `email` char(128) COLLATE utf8_unicode_ci DEFAULT NULL, `note` text COLLATE utf8_unicode_ci, `quota_cycle` int(10) NOT NULL DEFAULT ‘30‘, `quota_bytes` bigint(20) NOT NULL DEFAULT ‘10737418240‘, `enabled` int(10) NOT NULL DEFAULT ‘1‘, PRIMARY KEY (`username`), KEY `idx_active` (`active`), KEY `idx_enabled` (`enabled`) ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
6.
CREATE TABLE IF NOT EXISTS `log` ( `username` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `end_time` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00‘, `trusted_ip` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `trusted_port` int(10) DEFAULT NULL, `protocol` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, `remote_ip` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `remote_netmask` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `bytes_received` bigint(20) DEFAULT ‘0‘, `bytes_sent` bigint(20) DEFAULT ‘0‘, `status` int(10) NOT NULL DEFAULT ‘1‘, KEY `idx_username` (`username`), KEY `idx_start_time` (`start_time`), KEY `idx_end_time` (`end_time`) ) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
7.wget http://ncu.dl.sourceforge.net/project/pam-mysql/pam-mysql/0.7RC1/pam_mysql-0.7RC1.tar.gz
8.tar -zxvf pam_mysql-0.7RC1.tar.gz
9. ./configure --with-mysql=/usr/share/mysql -with-pam-mods-dir=/lib/security
1.报错:checking for C++ compiler error: C++ compiler cannot create executables 运行:yum install gcc-c++
2.报错:configure: error: Cannot find pam headers. Please check if your system is ready for pam module development. 运行:yum install pam-devel
10. make && make install
1.报错:pam_mysql.c:4253: error: ‘pam_mysql_ctx_t‘ has no member named ‘verbose‘ 运行:yum install mysql-devel
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。