mokey

ubccrBSD-3-Clause活跃维护

FreeIPA 自助账户管理门户,让用户自己重置密码、管理账户信息,不用每次都找管理员。

FreeIPA self-service account management portal

v0.6.6发布于 2025-11-25 03:47 UTC217star42fork同步于 2026-11-10 18:04 UTC

怎么上手

由 README 提炼,执行前请确认
tar xvzf mokey-VERSION-linux-x86_64.tar.gz
sudo dpkg -i mokey_VERSION_amd64.deb
硬件要求按 README 说明

README 未说明显存或 GPU 要求;要求 Linux x86_64,且需部署在已加入 FreeIPA 域的主机上。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

给 FreeIPA 补上自助注册与密码重置的独立 Web 门户,无需改 LDAP schema

FreeIPA 自助账户管理门户,让用户自己重置密码、管理账户信息,不用每次都找管理员。

核心能力

  • 通过 FreeIPA JSON API 实现账号自助注册
  • 支持忘记密码与修改密码流程
  • 管理 SSH 公钥和 TOTP 双因素令牌
  • 提供 Hydra 的 OAuth/OIDC 登录与授权端点
  • 用 MariaDB 存储访问令牌,界面可定制

容易踩的坑

必须装在已注册进 FreeIPA 的机器上,并先用 ipa 命令建服务账号、角色和 keytab;需在 /etc/mokey/mokey.toml 里填 keytab 路径,token_secret 留空则重启后会话失效;项目处于 alpha 阶段,自助改密本身有安全风险,建议配 HTTPS 或放在反向代理后。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.6.6
  1. v0.6.6最新正式版2025-11-25 · 2025-11-25 03:47 UTC
    • Modify OIDC payload params (effects Hydra support)
  2. v0.6.52024-10-28 · 2024-10-28 18:55 UTC
    查看更新说明
    • Update fiber, htmx (v2.0.3), hyperscript (v0.9.13)
    • Add config option to hide invalid username error on login #92
  3. v0.6.42024-05-28 · 2024-05-28 13:13 UTC
    查看更新说明
    • Update fiber
    • Add option to require admin verification #121
    • Fix OTP enabled bug #125
  4. v0.6.32023-02-10 · 2023-02-10 01:05 UTC
    查看更新说明
    • Update fiber
    • Update hydra go client
    • Trim spaces in names when creating/updating account
    • Add better error messages for name length
    • Add ability to better control log level
  5. v0.6.22023-01-27 · 2023-01-27 02:19 UTC
    查看更新说明
    • Fix sshpubkey update bug

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    FreeIPA self-service account management tool

    What is mokey?

    mokey is web application that provides self-service user account management tools for FreeIPA. The motivation for this project was to implement the self-service account creation and password reset functionality missing in FreeIPA. This feature is not provided by default in FreeIPA, see here for more info and the rationale behind this decision. mokey is not a FreeIPA plugin but a complete standalone application that uses the FreeIPA JSON API. mokey requires no changes to the underlying LDAP schema and uses a MariaDB database to store access tokens. The user experience and web interface can be customized to fit the requirements of an organization's look and feel. mokey is written in Go and released under a modified BSD license.

    Project status

    mokey should be considered alpha software and used at your own risk. There are inherent security risks in providing features like self-service password resets and can make your systems vulnerable to abuse.

    Features

    • Account Signup
    • Forgot/Change Password
    • Add/Remove SSH Public Keys
    • Add/Remove TOTP Tokens
    • Enable/Disable Two-Factor Authentication
    • Hydra Consent/Login Endpoint for OAuth/OpenID Connect
    • Easy to install and configure (requires no FreeIPA/LDAP schema changes)

    Requirements

    • FreeIPA v4.6.8 or greater
    • Linux x86_64
    • Redis (optional)
    • Hydra v1.0.0 (optional)

    Install

    Note: mokey needs to be installed on a machine already enrolled in FreeIPA. It's also recommended to have the ipa-admintools package installed. Enrolling a host in FreeIPA is outside the scope of this document.

    To install mokey download a copy of the pre-compiled binary here.

    tar.gz archive:

    $ tar xvzf mokey-VERSION-linux-x86_64.tar.gz 
    

    deb, rpm packages:

    $ sudo dpkg -i mokey_VERSION_amd64.deb
    
    $ sudo rpm -ivh mokey-VERSION-amd64.rpm
    

    Setup and configuration

    Create a service account and role in FreeIPA with the "Modify users and Reset passwords" privilege. This service account will be used by the mokey application to reset users passwords. The "Modify Users" permission also needs to have the "ipauserauthtype" enabled. Run the following commands (requires ipa-admintools to be installed):

    $ mkdir /etc/mokey/private
    $ kinit adminuser
    $ ipa role-add 'Mokey User Manager' --desc='Mokey User management'
    $ ipa role-add-privilege 'Mokey User Manager' --privilege='User Administrators'
    $ ipa service-add mokey/$(hostname -f)
    $ ipa service-add-principal mokey/$(hostname -f) mokey/mokey
    $ ipa role-add-member 'Mokey User Manager' --service=mokey/mokey
    $ ipa permission-mod 'System: Modify Users' --includedattrs=ipauserauthtype
    $ ipa-getkeytab -s [your.ipa-master.server] -p mokey/mokey -k /etc/mokey/private/mokeyapp.keytab
    $ chmod 640 /etc/mokey/private/mokeyapp.keytab
    $ chgrp mokey /etc/mokey/private/mokeyapp.keytab
    $ kdestroy
    

    Edit mokey configuration file and set path to keytab file. The values for token_secret and csrf_secret will be automatically generated for you if left blank. Set these secret values if you'd like sessions to persist after a restart. For other site specific config options see here:

    $ vim /etc/mokey/mokey.toml
    # Path to keytab file
    keytab = "/etc/mokey/private/mokeyapp.keytab"
    
    # Secret key for branca tokens. Must be 32 bytes. To generate run:
    #    openssl rand -hex 32 
    token_secret = ""
    
    # CSRF token secret key. Should be a random string
    csrf_secret = ""
    

    It's highly recommended to run mokey using HTTPS. You'll need an SSL cert/private_key either using FreeIPA's PKI, self-signed, or from a commercial certificate authority. Creating SSL certs is outside the scope of this document. You can also run mokey behind haproxy or Apache/Nginx.

    Start mokey service:

    $ systemctl restart mokey
    $ systemctl enable mokey
    

    SSH Public Key Management

    mokey allows users to add/remove ssh public keys. Servers that are enrolled in FreeIPA can be configured to have sshd lookup users public keys in LDAP by adding the following lines in /etc/ssh/sshd_config and restarting sshd:

    AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys
    AuthorizedKeysCommandUser nobody
    

    Hydra Consent and Login Endpoint for OAuth/OpenID Connect

    mokey implements the login/consent flow for handling challenge requests from Hydra. This serves as the bridge between Hydra and FreeIPA identity provider. For more information on Hydra and the login/consent flow see here.

    To configure the Hydra login/consent flow set the following variables in /etc/mokey/mokey.toml:

    [hydra]
    admin_url = "http://127.0.0.1:4445"
    login_timeout = 86400
    fake_tls_termination = true
    

    Any OAuth clients configured in Hydra will be authenticated via mokey using FreeIPA as the identity provider. For an example OAuth 2.0/OIDC client application see here.

    Building from source

    First, you will need Go v1.21 or greater. Clone the repository:

    $ git clone https://github.com/ubccr/mokey
    $ cd mokey
    $ go build .
    

    License

    mokey is released under a BSD style license. See the LICENSE file.