From 4d6991798d22d10d2e142e21c21813e7c44e49ce Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Wed, 11 Dec 2024 11:34:45 +0100 Subject: [PATCH] Rename authc in authctl. --- README.md | 2 +- TODO.md | 2 +- makefile | 2 +- man/{authc.1 => authctl.1} | 24 ++++++++++++------------ man/authd.1 | 2 +- mk/build.mk | 4 ++-- mk/commands.mk | 12 ++++++------ mk/install.mk | 10 +++++----- mk/migration.mk | 4 ++-- mk/setup.mk | 2 +- shard.yml | 2 +- src/client.cr | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) rename man/{authc.1 => authctl.1} (96%) diff --git a/README.md b/README.md index 192f8f6..d117637 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ To migrate an instance of authd, a simple copy of the storage directory will be ### Administrating users -> TODO: document how to manage users through `authc`. +> TODO: document how to manage users through `authctl`. ## APIs diff --git a/TODO.md b/TODO.md index b01830a..3b45dc3 100644 --- a/TODO.md +++ b/TODO.md @@ -20,7 +20,7 @@ They are simpler, use less memory and computation. ### CLI client -Current client **authc** lacks most requests. +Current client **authctl** lacks most requests. ### Documentation diff --git a/makefile b/makefile index 7347d5b..fe17d6f 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,7 @@ all: build-server Q ?= @ # By default, the following makefile rules will use the compiled version -# of the applications (authd, authc), not the ones from the system +# of the applications (authd, authctl), not the ones from the system # (in /usr/local/bin/ for example). # To avoid that, use: "make LOC=" LOC ?= ./bin/ diff --git a/man/authc.1 b/man/authctl.1 similarity index 96% rename from man/authc.1 rename to man/authctl.1 index 56c12f7..3eac52c 100644 --- a/man/authc.1 +++ b/man/authctl.1 @@ -2,24 +2,24 @@ .\" . = application with a manual page .\" Recent mdoc style: .Dd 24 november 2024 -.Dt "authc" 1 +.Dt "authctl" 1 .Os Linux "(Ubuntu and Alpine)" .Sh Name -.Nm authc +.Nm authctl .Nd a client for the .Xr authd 1 authentication daemon. .Sh Description -.Nm authc +.Nm authctl is a client for the .Xr authd 1 daemon, a micro-service providing authentication and authorization services. .Sh Synopsis . -.Nm authc +.Nm authctl .Op Fl h .Ar COMMAND No .Op Ar help @@ -70,7 +70,7 @@ password: banana In this example, the login and password of the user are set. The -.Xr authc +.Xr authctl application won't require them as command-line parameters for performing authenticated actions. .Sh Configuration file variables @@ -104,20 +104,20 @@ Show some help, but won't cover as much as the actual manual. Add the first user (will automatically be an admin). .br -.Nm authc +.Nm authctl .Ar bootstrap No .Ar login .Ar email-address (Temporary, will be removed someday) add a batch of users from old code base. .br -.Nm authc +.Nm authctl .Ar migration-script No Operations on users. .br -.Nm authc +.Nm authctl .Ar user No .Ar subcommand No @@ -197,7 +197,7 @@ to learn more about the parameters and options of the subcommands.) Operations on permissions. .br -.Nm authc +.Nm authctl .Ar permission No .Brq set \*(Ba check @@ -209,7 +209,7 @@ Available permissions: .Em none read edit admin . .It "" Example: -.Nm authc +.Nm authctl .Ar permission set 1000 dnsmanager "*" .Ar edit @@ -221,7 +221,7 @@ Available permissions: .Em none read edit admin . .It "" Example: -.Nm authc +.Nm authctl .Ar permission check 1000 forum "/thread15/" .El @@ -268,7 +268,7 @@ a document database library used in .Sh Limitations WARNING: -.Xr authc +.Xr authctl doesn't handle all possible commands of the .Xr authd application. diff --git a/man/authd.1 b/man/authd.1 index 8e42824..159ee29 100644 --- a/man/authd.1 +++ b/man/authd.1 @@ -232,7 +232,7 @@ TODO: expand the documentation the documentation of the way libipc works . .It -.Xr authc 1 +.Xr authctl 1 a command-line-interface client for .Xr authd . diff --git a/mk/build.mk b/mk/build.mk index 524aeb0..57b1bc9 100644 --- a/mk/build.mk +++ b/mk/build.mk @@ -2,9 +2,9 @@ SOURCE_FILES = $(wildcard src/*.cr src/*/*.cr src/*/*/*.cr) CRFLAGS ?= --progress bin/authd: $(SOURCE_FILES); $(Q)shards build authd $(CRFLAGS) -bin/authc: $(SOURCE_FILES); $(Q)shards build authc $(CRFLAGS) +bin/authctl: $(SOURCE_FILES); $(Q)shards build authctl $(CRFLAGS) build-server: bin/authd -build-client: bin/authc +build-client: bin/authctl build: build-server build-client release:; make build-server CRFLAGS="--progress --release" diff --git a/mk/commands.mk b/mk/commands.mk index 7fe57ce..d413edc 100644 --- a/mk/commands.mk +++ b/mk/commands.mk @@ -12,14 +12,14 @@ LOGIN_OPT = -l $(LOGIN) endif ACTIVATION_KEY ?= put-your-key-here -add-user:; $(Q)$(LOC)authc user add $(NAME) $(EMAIL) $(LOGIN_OPT) -register:; $(Q)$(LOC)authc user register $(NAME) $(EMAIL) -validate:; $(Q)$(LOC)authc user validate $(NAME) $(ACTIVATION_KEY) -get-user:; $(Q)$(LOC)authc user get $(NAME) $(LOGIN_OPT) +add-user:; $(Q)$(LOC)authctl user add $(NAME) $(EMAIL) $(LOGIN_OPT) +register:; $(Q)$(LOC)authctl user register $(NAME) $(EMAIL) +validate:; $(Q)$(LOC)authctl user validate $(NAME) $(ACTIVATION_KEY) +get-user:; $(Q)$(LOC)authctl user get $(NAME) $(LOGIN_OPT) SERVICE ?= 'auth' RESOURCE ?= '*' UID ?= 1000 PERMISSION ?= Read -permission-check:; $(LOC)authc permission check $(UID) $(SERVICE) $(RESOURCE) $(LOGIN_OPT) -permission-set:; $(LOC)authc permission set $(UID) $(SERVICE) $(RESOURCE) $(PERMISSION) $(LOGIN_OPT) +permission-check:; $(LOC)authctl permission check $(UID) $(SERVICE) $(RESOURCE) $(LOGIN_OPT) +permission-set:; $(LOC)authctl permission set $(UID) $(SERVICE) $(RESOURCE) $(PERMISSION) $(LOGIN_OPT) diff --git a/mk/install.mk b/mk/install.mk index 1ccfff5..47a9635 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -6,15 +6,15 @@ DOCDIR ?= $(SHAREDIR)/doc/authd MANDIR ?= $(SHAREDIR)/man install-authd: build-server ; $(Q)install -D -m 555 ./bin/authd $(DESTDIR)$(BINDIR)/authd -install-authc: build-client ; $(Q)install -D -m 555 ./bin/authc $(DESTDIR)$(BINDIR)/authc -install-binaries: install-authd install-authc +install-authctl: build-client ; $(Q)install -D -m 555 ./bin/authctl $(DESTDIR)$(BINDIR)/authctl +install-binaries: install-authd install-authctl gz-man-authd:; $(Q)gzip -k -f --best ./man/authd.1 -gz-man-authc:; $(Q)gzip -k -f --best ./man/authc.1 +gz-man-authctl:; $(Q)gzip -k -f --best ./man/authctl.1 install-man-authd: gz-man-authd ; $(Q)install -D -m 444 ./man/authd.1.gz $(DESTDIR)$(MANDIR)/man1/authd.1.gz -install-man-authc: gz-man-authc ; $(Q)install -D -m 444 ./man/authc.1.gz $(DESTDIR)$(MANDIR)/man1/authc.1.gz -install-man: install-man-authd install-man-authc +install-man-authctl: gz-man-authctl ; $(Q)install -D -m 444 ./man/authctl.1.gz $(DESTDIR)$(MANDIR)/man1/authctl.1.gz +install-man: install-man-authd install-man-authctl doc:; crystal docs install-dev-doc: doc ; $(Q)install -D docs/ $(DESTDIR)$(DOCDIR) diff --git a/mk/migration.mk b/mk/migration.mk index 4ba5793..b4e3b6f 100644 --- a/mk/migration.mk +++ b/mk/migration.mk @@ -22,10 +22,10 @@ $(USER_DB): migration-file: $(USER_DB) migrate-user: - ./bin/authc user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT) + ./bin/authctl user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT) migrate-all-users: @echo "Don't forget the admin login, for example: LOGIN=dnsmanager" - ./bin/authc migration-script $(USER_DB) $(LOGIN_OPT) + ./bin/authctl migration-script $(USER_DB) $(LOGIN_OPT) migration: migration-file migrate-all-users diff --git a/mk/setup.mk b/mk/setup.mk index f2aa1d5..3eb6e6f 100644 --- a/mk/setup.mk +++ b/mk/setup.mk @@ -11,7 +11,7 @@ run-authd: setup --service-name "auth" # First user always is the admin. -add-first-user:; $(Q)$(LOC)authc bootstrap $(NAME) $(EMAIL) +add-first-user:; $(Q)$(LOC)authctl bootstrap $(NAME) $(EMAIL) setup:; @[ -f $(PASSWORD_FILE) ] || echo -n "coucou" > $(PASSWORD_FILE) diff --git a/shard.yml b/shard.yml index d492b3f..6e01e76 100644 --- a/shard.yml +++ b/shard.yml @@ -10,7 +10,7 @@ authors: targets: authd: main: src/server.cr - authc: + authctl: main: src/client.cr crystal: 1.7.1 diff --git a/src/client.cr b/src/client.cr index 6cc46a4..7002690 100644 --- a/src/client.cr +++ b/src/client.cr @@ -103,7 +103,7 @@ class Actions # Migrate a batch of users from dnsmanager v1. # - # Usage: authc migration-script user-db.txt + # Usage: authctl migration-script user-db.txt # # user-db.txt should be formated as "login old-hash". def migration_script