harlam/openvpn-auth

v1.0.3 2019-08-19 18:36 UTC

This package is auto-updated.

Last update: 2024-09-05 07:28:03 UTC


README

OpenVPN 认证脚本

安装

composer create-project harlam/openvpn-auth

配置

  • 编辑 container.php.env

  • 创建表格(如果使用数据库而不是文件)

-- OpenVPN users
create table users
(
  id         bigserial primary key,
  username   varchar(255) not null,
  password   varchar(255) not null,
  is_active  boolean      not null       default false,
  created_at timestamp without time zone default now()
);

create index idx_users_username on users (username);
create index idx_users_is_active on users (is_active);
create index idx_users_created_at on users (created_at);

-- Auth logs
create table auth_log
(
  id         bigserial primary key,
  username   varchar(255)                default null,
  ip_addr    varchar(15)                 default null,
  is_success boolean not null,
  details    varchar(1024),
  created_at timestamp without time zone default now()
);

create index idx_auth_log_username on auth_log (username);
create index idx_auth_log_ip_addr on auth_log (ip_addr);
create index idx_auth_log_is_success on auth_log (is_success);
create index idx_auth_log_created_at on auth_log (created_at);

php box.phar build

  • openvpn-auth.phar.env 移动到新位置

使用

在 OpenVPN 服务器配置中

...
auth-user-pass-verify "/etc/openvpn-auth/openvpn-auth.phar" via-env
...