From f1f6e093d99e20c69802ce6c6e3c64d13f0ecaca Mon Sep 17 00:00:00 2001 From: Marek Szuba Date: Fri, 19 Jun 2020 19:12:40 +0200 Subject: net-misc/oidc-agent: new package OpenID Connect equivalent of ssh-agent. Signed-off-by: Marek Szuba --- net-misc/oidc-agent/Manifest | 1 + .../files/oidc-agent-3.3.1_desktop-category.patch | 9 ++++ .../files/oidc-agent-3.3.1_install-perms.patch | 58 +++++++++++++++++++++ .../oidc-agent-3.3.1_makefile-toolchain-vars.patch | 30 +++++++++++ ...c-agent-3.3.1_test-suite-buffer-overflows.patch | 51 +++++++++++++++++++ net-misc/oidc-agent/metadata.xml | 19 +++++++ net-misc/oidc-agent/oidc-agent-3.3.1.ebuild | 59 ++++++++++++++++++++++ 7 files changed, 227 insertions(+) create mode 100644 net-misc/oidc-agent/Manifest create mode 100644 net-misc/oidc-agent/files/oidc-agent-3.3.1_desktop-category.patch create mode 100644 net-misc/oidc-agent/files/oidc-agent-3.3.1_install-perms.patch create mode 100644 net-misc/oidc-agent/files/oidc-agent-3.3.1_makefile-toolchain-vars.patch create mode 100644 net-misc/oidc-agent/files/oidc-agent-3.3.1_test-suite-buffer-overflows.patch create mode 100644 net-misc/oidc-agent/metadata.xml create mode 100644 net-misc/oidc-agent/oidc-agent-3.3.1.ebuild (limited to 'net-misc/oidc-agent') diff --git a/net-misc/oidc-agent/Manifest b/net-misc/oidc-agent/Manifest new file mode 100644 index 000000000000..cd447dca2a23 --- /dev/null +++ b/net-misc/oidc-agent/Manifest @@ -0,0 +1 @@ +DIST oidc-agent-3.3.1.tar.gz 764721 BLAKE2B eea09b3b140ca81be0f3dc8f200120287682ddb328275be35bd736249b72eabb40c87ebd168e51c992ccd4b4a02138e17d3e20f3cebfb4d42bde01351aacead1 SHA512 75428bb52c0cf43256fddd3b33895d7c882ced367543763c68a385448dbe29805ee1fc035f3727e743a607ed4af851ae5db24b40cc6801fc31e45b6fec16bd66 diff --git a/net-misc/oidc-agent/files/oidc-agent-3.3.1_desktop-category.patch b/net-misc/oidc-agent/files/oidc-agent-3.3.1_desktop-category.patch new file mode 100644 index 000000000000..49bfcfdb70b3 --- /dev/null +++ b/net-misc/oidc-agent/files/oidc-agent-3.3.1_desktop-category.patch @@ -0,0 +1,9 @@ +--- a/config/scheme_handler/oidc-gen.desktop ++++ b/config/scheme_handler/oidc-gen.desktop +@@ -5,5 +5,5 @@ + Icon=utilities-terminal + Terminal=true + Type=Application +-Categories=Application;Network; ++Categories=Network; + MimeType=x-scheme-handler/edu.kit.data.oidc-agent; diff --git a/net-misc/oidc-agent/files/oidc-agent-3.3.1_install-perms.patch b/net-misc/oidc-agent/files/oidc-agent-3.3.1_install-perms.patch new file mode 100644 index 000000000000..1992ee0ef31f --- /dev/null +++ b/net-misc/oidc-agent/files/oidc-agent-3.3.1_install-perms.patch @@ -0,0 +1,58 @@ +--- a/Makefile ++++ b/Makefile +@@ -316,7 +316,7 @@ + + ## Bash completion + $(BASH_COMPLETION_PATH)/$(AGENT): $(CONFDIR)/bash-completion/oidc-agent $(BASH_COMPLETION_PATH) +- @install -m 744 $< $@ ++ @install -m 644 $< $@ + + $(BASH_COMPLETION_PATH)/$(GEN): $(BASH_COMPLETION_PATH) + @ln -s $(AGENT) $@ +@@ -332,15 +332,15 @@ + + ## Man pages + $(MAN_PATH)/man1/$(AGENT).1: $(MANDIR)/$(AGENT).1 $(MAN_PATH)/man1 +- @install $< $@ ++ @install -m 644 $< $@ + $(MAN_PATH)/man1/$(GEN).1: $(MANDIR)/$(GEN).1 $(MAN_PATH)/man1 +- @install $< $@ ++ @install -m 644 $< $@ + $(MAN_PATH)/man1/$(ADD).1: $(MANDIR)/$(ADD).1 $(MAN_PATH)/man1 +- @install $< $@ ++ @install -m 644 $< $@ + $(MAN_PATH)/man1/$(CLIENT).1: $(MANDIR)/$(CLIENT).1 $(MAN_PATH)/man1 +- @install $< $@ ++ @install -m 644 $< $@ + $(MAN_PATH)/man1/$(KEYCHAIN).1: $(MANDIR)/$(KEYCHAIN).1 $(MAN_PATH)/man1 +- @install $< $@ ++ @install -m 644 $< $@ + + + ## Lib +@@ -354,20 +354,20 @@ + @ln -sf $(SHARED_LIB_NAME_SO) $@ + + $(INCLUDE_PATH)/oidc-agent/api.h: $(SRCDIR)/$(CLIENT)/api.h $(INCLUDE_PATH)/oidc-agent +- @install $< $@ ++ @install -m 644 $< $@ + + $(INCLUDE_PATH)/oidc-agent/ipc_values.h: $(SRCDIR)/defines/ipc_values.h $(INCLUDE_PATH)/oidc-agent +- @install $< $@ ++ @install -m 644 $< $@ + + $(INCLUDE_PATH)/oidc-agent/oidc_error.h: $(SRCDIR)/utils/oidc_error.h $(INCLUDE_PATH)/oidc-agent +- @install $< $@ ++ @install -m 644 $< $@ + + $(LIBDEV_PATH)/liboidc-agent.a: $(APILIB)/liboidc-agent.a $(LIBDEV_PATH) +- @install $< $@ ++ @install -m 644 $< $@ + + ## scheme handler + $(DESKTOP_APPLICATION_PATH)/oidc-gen.desktop: $(CONFDIR)/scheme_handler/oidc-gen.desktop +- @install -D $< $@ ++ @install -m 644 -D $< $@ + @echo "Exec=x-terminal-emulator -e bash -c \"$(BIN_AFTER_INST_PATH)/bin/$(GEN) --codeExchange=%u; exec bash\"" >> $@ + + ## Xsession diff --git a/net-misc/oidc-agent/files/oidc-agent-3.3.1_makefile-toolchain-vars.patch b/net-misc/oidc-agent/files/oidc-agent-3.3.1_makefile-toolchain-vars.patch new file mode 100644 index 000000000000..0cdf44fba8c2 --- /dev/null +++ b/net-misc/oidc-agent/files/oidc-agent-3.3.1_makefile-toolchain-vars.patch @@ -0,0 +1,30 @@ +1. Support user-provided values of CC, CFLAGS and LDFLAGS +2. Do not force the use of a static version of libsodium + +--- a/Makefile ++++ b/Makefile +@@ -54,20 +54,20 @@ + endif + + # Compiler options +-CC = gcc ++CC := $(CC) + # compiling flags here +-CFLAGS = -g -std=c99 -I$(SRCDIR) -I$(LIBDIR) -Wall -Wextra ++CFLAGS := $(CFLAGS) -g -std=c99 -I$(SRCDIR) -I$(LIBDIR) -Wall -Wextra + ifndef MAC_OS + CFLAGS += $(shell pkg-config --cflags libsecret-1) + endif + TEST_CFLAGS = $(CFLAGS) -I. + + # Linker options +-LINKER = gcc ++LINKER := $(CC) + ifdef MAC_OS + LFLAGS = -lsodium -largp + else +-LFLAGS = -l:libsodium.a -lseccomp ++LFLAGS := $(LDFLAGS) -lsodium -lseccomp + endif + ifdef HAS_CJSON + LFLAGS += -lcjson diff --git a/net-misc/oidc-agent/files/oidc-agent-3.3.1_test-suite-buffer-overflows.patch b/net-misc/oidc-agent/files/oidc-agent-3.3.1_test-suite-buffer-overflows.patch new file mode 100644 index 000000000000..b43f20c06860 --- /dev/null +++ b/net-misc/oidc-agent/files/oidc-agent-3.3.1_test-suite-buffer-overflows.patch @@ -0,0 +1,51 @@ +--- a/test/src/utils/stringUtils/tc_strelim.c ++++ b/test/src/utils/stringUtils/tc_strelim.c +@@ -7,7 +7,7 @@ + + START_TEST(test_noFound) { + const char* const str = "abcdeffedcba"; +- char s[strlen(str)]; ++ char s[strlen(str) + 1]; + strcpy(s, str); + ck_assert_str_eq(strelim(s, 'x'), str); + } +--- a/test/src/utils/stringUtils/tc_strelimIfAfter.c ++++ b/test/src/utils/stringUtils/tc_strelimIfAfter.c +@@ -7,7 +7,7 @@ + + START_TEST(test_noElim) { + const char* const str = "abcdeffedcba"; +- char s[strlen(str)]; ++ char s[strlen(str) + 1]; + strcpy(s, str); + ck_assert_str_eq(strelimIfAfter(s, 'b', 'x'), str); + } +@@ -15,7 +15,7 @@ + + START_TEST(test_noFound) { + const char* const str = "abcdeffedcba"; +- char s[strlen(str)]; ++ char s[strlen(str) + 1]; + strcpy(s, str); + ck_assert_str_eq(strelimIfAfter(s, 'x', 'a'), str); + } +--- a/test/src/utils/stringUtils/tc_strelimIfFollowed.c ++++ b/test/src/utils/stringUtils/tc_strelimIfFollowed.c +@@ -7,7 +7,7 @@ + + START_TEST(test_noElim) { + const char* const str = "abcdeffedcba"; +- char s[strlen(str)]; ++ char s[strlen(str) + 1]; + strcpy(s, str); + ck_assert_str_eq(strelimIfFollowed(s, 'b', 'x'), str); + } +@@ -15,7 +15,7 @@ + + START_TEST(test_noFound) { + const char* const str = "abcdeffedcba"; +- char s[strlen(str)]; ++ char s[strlen(str) + 1]; + strcpy(s, str); + ck_assert_str_eq(strelimIfFollowed(s, 'x', 'a'), str); + } diff --git a/net-misc/oidc-agent/metadata.xml b/net-misc/oidc-agent/metadata.xml new file mode 100644 index 000000000000..befedd639221 --- /dev/null +++ b/net-misc/oidc-agent/metadata.xml @@ -0,0 +1,19 @@ + + + + + marecki@gentoo.org + Marek Szuba + + + oidc-agent is a set of tools to manage OpenID Connect tokens and make them + easily usable from the command line. We followed the ssh-agent design, so users + can handle OIDC tokens in a similar way as they do with ssh keys. + oidc-agent is usually started in the beginning of an X-session or a login + session. Through use of environment variables the agent can be located and + used to handle OIDC tokens. + + + indigo-dc/oidc-agent + + diff --git a/net-misc/oidc-agent/oidc-agent-3.3.1.ebuild b/net-misc/oidc-agent/oidc-agent-3.3.1.ebuild new file mode 100644 index 000000000000..12161b8e9044 --- /dev/null +++ b/net-misc/oidc-agent/oidc-agent-3.3.1.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit xdg-utils + +DESCRIPTION="oidc-agent for managing OpenID Connect tokens on the command line" +HOMEPAGE="https://github.com/indigo-dc/oidc-agent" +SRC_URI="https://github.com/indigo-dc/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" +IUSE="test" + +DEPEND="app-crypt/libsecret + dev-libs/libsodium + net-libs/libmicrohttpd" +RDEPEND="${DEPEND}" +BDEPEND="test? ( dev-libs/check )" + +RESTRICT="!test? ( test )" + +PATCHES=( + "${FILESDIR}"/${PN}-3.3.1_desktop-category.patch + "${FILESDIR}"/${PN}-3.3.1_install-perms.patch + "${FILESDIR}"/${PN}-3.3.1_makefile-toolchain-vars.patch + "${FILESDIR}"/${PN}-3.3.1_test-suite-buffer-overflows.patch +) + +src_compile() { + # Parallel building doesn't work + emake -j1 +} + +src_install() { + emake \ + PREFIX="${ED}" \ + BIN_AFTER_INST_PATH="/usr" \ + INCLUDE_PATH="${ED}"/usr/include \ + LIB_PATH="${ED}"/usr/$(get_libdir) \ + install +} + +pkg_postinst() { + xdg_desktop_database_update + + elog + elog "You should use oidc-gen to initially generate your account configuration" + elog "before it can be loaded into oidc-agent using oidc-add. For details, please" + elog "consult the man page of oidc-gen, or full documentation at" + elog " https://indigo-dc.gitbooks.io/oidc-agent/" + elog +} + +pkg_postrm() { + xdg_desktop_database_update +} -- cgit v1.2.3-18-g5258