Commit Graph

99 Commits

Author SHA1 Message Date
Omar Polo 5864f3ce3c set next version 2024-04-04 19:28:14 +00:00
Omar Polo 9536c8ca63 prepare release 2.0.1 2024-04-04 19:16:33 +00:00
Omar Polo 40ea7b163e use -Werror=implicit-function-declaration for function detection
the previous -Werror triggers too easily: on NixOS for example the
FORTIFY_SOURCE #warning about a missing optimization level breaks all
the checks when using -O0 (which is the default for non-release builds).
2024-04-03 14:03:42 +00:00
Omar Polo 8f543d941e add a note regarding the usage of the bundled libtls
See https://codeberg.org/op/gmid/issues/2
2024-02-02 08:24:28 +00:00
Omar Polo 33a5425235 set next version 2024-01-24 15:13:35 +00:00
Omar Polo cd5e264f9d prepare release 2.0.1 2024-01-24 15:06:08 +00:00
Anna “CyberTailor” 6bce8180d9 configure: fix --mandir handling 2024-01-14 10:30:06 +00:00
Omar Polo 1ee636a45c start the 2.1 release cycle 2024-01-11 16:24:35 +00:00
Omar Polo eabbdf5a10 prepare release 2.0 2024-01-11 16:24:10 +00:00
Omar Polo 0d5282b647 configure: add --sysconfdir / $SYSCONFDIR handling
so that we don't have to hardcode /etc in gmid.c.  Helps on systems
like FreeBSD where the non-base programs are expected to look for
their config in /usr/local/etc.
2024-01-11 13:17:44 +00:00
Omar Polo 822125ca3f add more endian.h macros implementation for macos 2024-01-07 19:01:40 +00:00
Omar Polo 39204b7e48 we're in public alpha right now! 2023-08-24 23:21:56 +00:00
Omar Polo ae32f1aa8e don't leave HAVE_GETENTROPY undefined 2023-08-23 20:31:02 +00:00
Omar Polo 4d9d3093d4 resurrect landlock support
this time targetting ABI level 3; partially based on how claudio@
handled it in rpki-client.  Fun how this bit of code has come full
circle (gmid inspired what I wrote for got, which inspired what was
written for rpki-client, which has come back.)
2023-08-23 20:18:59 +00:00
Omar Polo cedef5b09c fix build of regress 2023-08-23 19:46:53 +00:00
Omar Polo 74c6900c91 fix previous; check for getentropy only when arc4random is missing
on macos we have the situation where we have arc4random available
but no getentropy().
2023-08-23 19:22:22 +00:00
Omar Polo 258131b1b6 typo 2023-08-23 17:44:35 +00:00
Omar Polo f9ab77a898 bundle libtls
gmid (like all other daemons that want to do privsep crypto) has a
very close relationship with libtls and need to stay in sync with
it.

OpenBSD' libtls was recently changed to use OpenSSL' EC_KEY_METHOD
instead of the older ECDSA_METHOD, on the gmid side we have to do
the same otherwise failures happens at runtime.  In a similar manner,
privsep crypto is silently broken in the current libretls (next
version should fix it.)

The proper solution would be to complete the signer APIs so that
applications don't need to dive into the library' internals, but
that's a mid-term goal, for the immediate bundling the 'little'
libtls is the lesser evil.

The configure script has gained a new (undocumented for the time
being) flag `--with-libtls=bundled|system' to control which libtls
to use.  It defaults to `bundled' except for OpenBSD where it uses
the `system' one.  Note that OpenBSD versions before 7.3 (inclusive)
ought to use --with-libtls=bundled too since they still do ECDSA_METHOD.
2023-08-23 17:38:49 +00:00
Omar Polo f5dc7eddd7 fix INSTALL handling
Set a sane default for INSTALL, allow it to be changed either as
environment variable or configure argument, and propagate it correctly
to the generated config.mk.

Issue reported by xavi, thanks!
2023-08-13 09:53:12 +00:00
Omar Polo d13b044d59 address the strnvis(3) portability fiasco
strnvis originates on OpenBSD.  When NetBSD added it to their libc
they decided to swap the argument.  Without starting a holy war on
the "best" argument order, adding an implementation of a function
that's widely available and making its signature purposefully
incompatible is beyond justification.  FreeBSD (and so macos too?)
followed NetBSD in this, so we end up with *two* major and incompatible
strnvis implementations.  libbsd is in a limbo, they started with
the OpenBSD version but they'll probably switch to the NetBSD version
in the future.

That's why we can't have nice things.

Do the right thing(tm) and check for the presence of the original
strnvis(3), if not available or broken use the bundled one.
2023-08-07 15:39:57 +00:00
Omar Polo 5d2f4b1611 add compat for endian (now required by imsg) 2023-07-02 09:14:44 +00:00
Omar Polo 3d0204e7ef don't quote $5 when calling pkg-config
otherwise we fail the openssl test 'libcrypto libssl'
2023-06-23 22:38:10 +00:00
Omar Polo 1610f9541d rework the configure script
now it resembles less oconfigure and more the configure scripts I'm
using in my recent projects.  I'd argue it's more easy to use it.
2023-06-13 16:36:10 +00:00
Omar Polo 1ef09e6313 add -Wpointer-sign to the mix
It's not present in -W -Wall -Wextra on OpenBSD but it is enabled
on other systems.
2023-06-11 11:33:38 +00:00
Omar Polo c144b1b6f8 configure: look for WAIT_ANY 2023-06-08 19:46:06 +00:00
Omar Polo 68e38f49b2 use -MMD if the compiler supports it
it's better than the previous Makefile.depend approach since this
automatically adapts to the included headers without requiring
manual intervention to regen the list.
2023-06-08 14:43:29 +00:00
Omar Polo c26f2460e4 rework the daemon to do fork+exec
It uses the 'common' proc.c from various OpenBSD-daemons.

gmid grew organically bit by bit and it was also the first place where I
tried to implement privsep.  It wasn't done very well, in fact the
parent process (that retains root privileges) just fork()s a generation
of servers, all sharing *exactly* the same address space.  No good!

Now, we fork() and re-exec() ourselves, so that each process has a fresh
address space.

Some features (require client ca for example) are temporarly disabled,
will be fixed in subsequent commits.  The "ge" program is also
temporarly disabled as it needs tweaks to do privsep too.
2023-06-08 13:59:31 +00:00
Omar Polo 0b62f4842d drop landlock/seccomp and capsicum support
it reached a point where this stuff is not maintenable.  I'd like
to move forward with gmid, but the restriction of capsicum and the
linux environment at large that make landlock unusable (how can you
resolve DNS portably when under landlock?) -and don't get me started
on seccomp- makes it impossible for me to do any work.

So, I prefer removing the crap, resuming working on gmid by cleaning
stuff and consolidating the features, improving various things
etc... and then eventually see how to introduce some sandboxing
again on other systems.  Patches to resume sandboxing are, as always,
welcome!
2023-05-08 10:27:32 +00:00
Omar Polo bd8683d0fd add tests and compat for setresuid and setresgid 2022-12-02 11:53:35 +00:00
Omar Polo 0ab57224fb bump version ahead of 1.8 branch 2022-10-31 22:53:16 +00:00
Omar Polo 19a8d9fe74 add memmem compat 2022-10-31 22:53:16 +00:00
Omar Polo e59b7f30e7 fix previous 2022-10-30 07:43:18 +00:00
Omar Polo 8141737318 work around missing HOST_NAME_MAX too 2022-10-30 07:40:27 +00:00
Omar Polo fad3441ba9 work around missing LOGIN_NAME_MAX
Both Linux and OpenBSD have LOGIN_NAME_MAX available when including
limits.h, FreeBSD, Darwin and possibly others don't.

FreeBSD (and maybe Darwin) have MAXLOGNAME, so try to use that if
available.  Otherwise use _POSIX_LOGIN_NAME_MAX, but only has a fallback
since it has a lower value (9 at the time of writing).

If everything fails, use 32 which is what OpenBSD use by default;
OpenSMTPd also defaults to it.

(compat copied from kamid.)
2022-10-30 07:30:23 +00:00
Omar Polo 7f03b52bd6 shim for __dead 2022-09-08 20:51:13 +00:00
Omar Polo f759119d2f bump version 2022-07-04 19:18:39 +00:00
Omar Polo 1f6de7491c changes for 1.8.4 2022-07-04 14:51:39 +00:00
Omar Polo 96e3c01314 refactor the makefile / configure
steal more (good) stuff from mandoc-portable :)
2022-07-04 13:44:38 +00:00
Omar Polo a555e0d67b copyright years 2022-07-04 09:48:39 +00:00
Omar Polo cb2b85512c add proper copyrights
was a mistake on my part and a leftover from the first iterations.
Initially I only stole a few bits, that's why the comment but not the
copyright, but then i threwed out and restarted using oconfigure.
Then the configure script has its own independent changes, but need to
give attribution nevertheless.
2022-07-04 09:43:51 +00:00
Omar Polo 72e7fbbcb7 master is now 1.8.3-current 2022-04-07 18:10:13 +00:00
Omar Polo 1a04137e18 tag 1.8.3 -- "Lightbulb Sun" bugfix release
gmid 1.8.3 "Lightbulb Sun" bugfix release
=========================================

Released March 27, 2022.

signify(1) pubkeys for this release:
RWTy3UJQzpxBUAymBwb2EGLLm0b3H/1n8hzhaC9HYFYzNuTavGt9QSwC


Bug Fixes
~~~~~~~~~

    * fix a possible out-of-bound access in the CGI handling.  It was
      introduced last October during a refactoring, but due to how
      many malloc(3) implementations works this hasn't been found
      until now.  Otto' malloc is more strict fortunately.
2022-03-27 12:59:57 +00:00
Omar Polo 62a46b03c6 tag 1.8.2 -- "Lightbulb Sun" bugfix release
gmid 1.8.2 "Lightbulb Sun" bugfix release
=========================================

Released March 26, 2022.

signify(1) pubkeys for this release:
RWTy3UJQzpxBUAymBwb2EGLLm0b3H/1n8hzhaC9HYFYzNuTavGt9QSwC


Bug Fixes
~~~~~~~~~

    * fix a CGI timing issue: if a connection handled by a CGI scripts
      is interrupted with the right timing it causes the server
      process to exit with "fatal in client_by_id: invalid id X".


New Features
~~~~~~~~~~~~

    * add a new block `type { ... }' to define mime types mapping.


Improvements
~~~~~~~~~~~~

    * use shell built-in `command' instead of which(1), prodded by
      cage and Allen Sobot.

    * configure script: allow to set MANDIR from cmdline (Allen Sobot)

    * add systemd-sysusers sample file in contrib/ (Nakaya)

    * [linux/seccomp] allow fstatat64(2), llseek(2) and sigreturn(2),
      needed by glibc on armv7.  (Tobias Berger)

    * [linux/seccomp] tightens rules by allowing openat(2) only with
      the O_RDONLY flag.
2022-03-26 13:22:22 +00:00
Omar Polo 9db5e7051e get rid of `which` in the configure too
should have been done already in 12fcba2; reminded by Allen Sobot,
thanks!
2022-03-18 16:31:05 +00:00
Omar Polo 5f966fbe41 configure: allow to set MANDIR from args
diff by Allen Sobot (chilledfrogs at disroot dot org), thanks!
2022-03-18 16:23:45 +00:00
Omar Polo f2dbf375a0 tag 1.8.1 -- "Lightbulb Sun" bugfix release
gmid 1.8.1 "Lightbulb Sun" bugfix release
=========================================

Released Feb 10, 2022.

signify(1) pubkeys for this release:
RWTy3UJQzpxBUAymBwb2EGLLm0b3H/1n8hzhaC9HYFYzNuTavGt9QSwC


Bug fixes
---------

    * fix landlock usage on linux: don't assume that access
      capabilities not listed are implicitly denied, because they are
      not.  Mickaël Salaün, the landlock author, found the same error
      on game of trees:

> In a nutshell, the ruleset's handled_access_fs is required for
> backward and forward compatibility (i.e. the kernel and user space may
> not know each other's supported restrictions), hence the need to be
> explicit about the denied-by-default access rights.

      In practice this affects only linux and only partially: thanks
      to the design of the daemon and the seccomp filter the effects
      of this mistake in handling landlock are fortunately limited.
      However, in theory at least, gmid could be for e.g. tricked into
      truncating existing files, so it's highly suggested to update.


Improvements
------------

All by Anna “CyberTailor”, thanks!

    * don't skip unit tests when SKIP_RUNTIME_TEST is set
    * add `gg' to the regress target dependencies
    * fix the "implicit declaration of asprintf" warning
    * sync vim syntax
2022-02-10 22:51:32 +00:00
Omar Polo f525aa55b8 start new release cycle 2022-02-03 09:57:51 +00:00
Omar Polo a14b9f779f prepare 1.8 release 2022-01-30 13:35:45 +00:00
Omar Polo 718c0d6c71 work around freebsd' printf
printf: Illegal option -i

this is why we can't have nice things, isn't it?
2022-01-03 18:11:51 +00:00
Omar Polo 7c956fefc2 track file dependency using -MMD if available
While here, move the SRCS variable to the configure and add the
-includes in Makefile.local; it de-clutters the Makefile a bit.
2022-01-03 18:05:54 +00:00