Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 30 additions & 33 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
# Mokey goreleaser configs
# See here: https://goreleaser.com
version: 2
project_name: mokey

before:
hooks:
- go mod tidy

builds:
- env:
- id: mokey
env:
- CGO_ENABLED=1
goarch:
- amd64
goos:
- linux
ldflags:
- -s -w -X github.com/ubccr/mokey/server.Version={{.Version}}
- -s -w -X github.com/tubby1981/mokey/server.Version={{.Version}}
- -extldflags=-static
tags:
- sqlite_omit_load_extension
- osusergo
- netgo
archives:
- replacements:
linux: linux
amd64: x86_64
wrap_in_directory: true
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
files:
- LICENSE
- NOTICE
- README.md
- ChangeLog.md
- mokey.toml.sample

nfpms:
- vendor: University at Buffalo
homepage: https://github.com/ubccr/mokey
maintainer: Andrew E. Bruno <[email protected]>
license: MIT
description: |-
FreeIPA self-service account management tool
- id: mokey
formats:
- deb
- rpm
maintainer: Andrew E. Bruno <[email protected]>
vendor: University at Buffalo
homepage: https://github.com/tubby1981/mokey
license: MIT
description: |
FreeIPA self-service account management tool
overrides:
deb:
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}"
Expand All @@ -48,25 +40,30 @@ nfpms:
file_name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}"
scripts:
postinstall: ./scripts/nfpm/postinstall.sh
rpm:
signature:
key_file: key.gpg
deb:
signature:
key_file: key.gpg
#rpm:
# signature:
# key_file: key.gpg
#deb:
# signature:
# key_file: key.gpg
contents:
- src: ./scripts/nfpm/mokey.toml.default
dst: /etc/mokey/mokey.toml
type: "config|noreplace"
type: config|noreplace
- src: ./scripts/nfpm/mokey.env
dst: /etc/default/mokey
type: "config|noreplace"
- src: ./scripts/nfpm/translations/*
dst: /etc/mokey/translations/
file_info:
owner: mokey
group: mokey
- src: ./scripts/nfpm/mokey.service
dst: /usr/lib/systemd/system/mokey.service

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-SNAPSHOT-{{.ShortCommit}}"
version_template: "{{ incpatch .Version }}-SNAPSHOT-{{.ShortCommit}}"
changelog:
sort: desc
groups:
Expand All @@ -81,4 +78,4 @@ changelog:
filters:
exclude:
- '^docs:'
- 'typo'
- 'typo'
8 changes: 8 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Mokey ChangeLog

## [v0.6.7] - 2025-04-17
- Added `timeago` function with support for English, Portuguese, Spanish, Dutch, French, German, and Turkish. Based on [xeonx/timeago](https://github.com/xeonx/timeago).
- Some translations in the email templates were not working properly. This has been fixed.

## [v0.6.6] - 2025-04-16
- Add config option to hide registratrion link: enable_user_signup true/false
- Add support for multiple languages with configurable translations. See README

## [v0.6.5] - 2024-10-28

- Update fiber, htmx (v2.0.3), hyperscript (v0.9.13)
Expand Down
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ 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](https://github.com/ubccr/mokey/releases).
To install mokey download a copy of the pre-compiled binary [here](https://github.com/tubby1981/mokey/releases).

tar.gz archive:

Expand Down Expand Up @@ -83,7 +83,7 @@ $ chgrp mokey /etc/mokey/private/mokeyapp.keytab
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](https://github.com/ubccr/mokey/blob/main/mokey.toml.sample):
For other site specific config options [see here](https://github.com/tubby1981/mokey/blob/main/mokey.toml.sample):

```
$ vim /etc/mokey/mokey.toml
Expand Down Expand Up @@ -139,12 +139,39 @@ 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](examples/mokey-oidc/main.go).

## Translations

mokey supports multiple languages for its interface and email templates. Default are English and Dutch supported.

### Configuring Translations

1. **Place translation files**
Translation files should be placed in `/etc/mokey/translations/`.
For example:
- `english.toml` for English translations
- `dutch.toml` for Dutch translations

2. **Update the configuration file**
Add the following options to `/etc/mokey/mokey.toml`:
```toml
# Default language for the site
# Languages supported: English (english), Dutch (dutch)
# Default is english
default_language = "english"

# Directory where translations can be placed
translations_dir = "/etc/mokey/translations"
```

3. **Create custom translations**
Users can translate mokey into their own language by creating a new .toml file in the translations_dir and referencing it in the default_language configuration. This allows for complete customization of the interface and email templates in the preferred language.

## Building from source

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

```
$ git clone https://github.com/ubccr/mokey
$ git clone https://github.com/tubby1981/mokey
$ cd mokey
$ go build .
```
Expand Down
Binary file added a.out
Binary file not shown.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/ubccr/mokey/server"
"github.com/tubby1981/mokey/server"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/ubccr/mokey/cmd"
"github.com/ubccr/mokey/server"
"github.com/tubby1981/mokey/cmd"
"github.com/tubby1981/mokey/server"
)

var (
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module github.com/ubccr/mokey
// module github.com/ubccr/mokey
// replace github.com/ubccr/mokey => /opt/tromp/mokey
module github.com/tubby1981/mokey

require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/dchest/captcha v1.0.0
github.com/dustin/go-humanize v1.0.1
github.com/essentialkaos/branca/v2 v2.0.5
github.com/gofiber/fiber/v2 v2.52.5
github.com/gofiber/storage/memory/v2 v2.0.1
Expand All @@ -27,6 +28,8 @@ require (
golang.org/x/oauth2 v0.18.0
)

require github.com/dustin/go-humanize v1.0.1

require (
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package main

import (
"github.com/ubccr/mokey/cmd"
_ "github.com/ubccr/mokey/cmd/serve"
"github.com/tubby1981/mokey/cmd"
_ "github.com/tubby1981/mokey/cmd/serve"
)

func main() {
Expand Down
11 changes: 11 additions & 0 deletions mokey.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ keytab = "/etc/mokey/private/mokeyapp.keytab"
# Path to logo
# logo = "/etc/mokey/assets/my-logo.png"

# Default language for the site
# Languages supported: English (english), Dutch (dutch)
# Default is english
default_language = "english"

# Directory where translations can be placed
translations_dir = "/etc/mokey/translations"

#------------------------------------------------------------------------------
# User account settings
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -101,6 +109,9 @@ require_admin_verify = false
# you could hide this error message by setting this to true.
hide_invalid_username_error = false

# Enable or disable user signup link on the login page
enable_user_signup = true

#------------------------------------------------------------------------------
# Email
#------------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions scripts/nfpm/mokey.toml.default
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ ktuser = "mokeyapp"
# Path to keytab file
keytab = "/etc/mokey/private/mokeyapp.keytab"

# Default language for the site
# Languages supported: English (english), Dutch (dutch)
# Default is english
default_language = "english"

# Directory where translations can be placed
translations_dir = "/etc/mokey/translations"

#------------------------------------------------------------------------------
# User account settings
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -55,6 +63,9 @@ otp_issuer = "MYORG"
# Block list of user accounts from logging in
# block_users = ["username1", "username2", "username3"]

# Enable or disable user signup link on the login page
enable_user_signup = true

#------------------------------------------------------------------------------
# Email
#------------------------------------------------------------------------------
Expand Down
Loading