DUO(3)

πŸ“¦
version 2.2.3 Β· 2 versions
, in epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– DUO β€” the Duo authentication service, bestie edition πŸ’–

okay so this is duo(3), a library functions manual, and it's literally the whole Duo two-factor auth API. sit down, grab a strawberry, we're doing this πŸ“


✨ SYNOPSIS ✨

#include <duo.h>

duo_t *
duo_open(const char *ikey, const char *skey, const char *progname,
    const char *cafile);

void
duo_set_conv_funcs(duo_t *d,
    char *(*conv_prompt)(void *conv_arg, const char *, char *, size_t),
    void (*conv_status)(void *conv_arg, const char *msg),
    void *conv_arg);

void
duo_set_host(duo_t *d, const char *hostname);

void
duo_set_ssl_verify(duo_t *d, int bool);

duo_code_t
duo_login(duo_t *d, const char *username, const char *client_ip,
    int flags, const char *command);

const char *
duo_geterr(duo_t *d);

void
duo_close(duo_t *d);

🌸 DESCRIPTION 🌸

The duo API gives you access to the Duo two-factor authentication service. that's the whole vibe. πŸ’…

πŸŽ€ duo_open()

duo_open() is how you get yourself a handle to the Duo service, no cap.

  • ikey and skey are the required integration and secret keys, respectively, for a Duo customer account.
  • progname is what identifies the program to the Duo service.
  • cafile should be NULL, OR the pathname of a PEM-format CA certificate if you want to override the default.

πŸ¦‹ duo_set_conv_funcs()

duo_set_conv_funcs() is your glow-up for the internal user conversation functions. here's the breakdown:

  • conv_prompt gets called to present the user a login menu and prompt, and to gather their response β€” it returns buf, or NULL on error. you can set it to NULL if automatic login is specified with DUO_FLAG_AUTO. ✨
  • conv_status gets called to display status messages to the user, and may be NULL if no status display is needed.
  • conv_arg gets passed as the first argument to these conversation functions.

πŸ‘‘ duo_set_host()

duo_set_host() lets you override the default Duo API host. iconic.

πŸ”₯ duo_set_ssl_verify()

duo_set_ssl_verify() lets you override SSL certificate verification β€” which is enabled by default, just so you know.

πŸ’œ duo_login()

duo_login() performs secondary authentication via the Duo service for the specified username.

client_ip is the source IP address of the connection to be authenticated, or NULL to specify the local host.

The following bitmask values are defined for flags:

  • DUO_FLAG_AUTO β€” attempt authentication without prompting the user, using their default out-of-band authentication factor.
  • DUO_FLAG_SYNC β€” do not report incremental status during authentication (like voice callback progress, for example). only issue one status message per authentication attempt.

If it's not NULL, the command to be authorized will be displayed during push authentication. 🫢

🧚 duo_geterr()

duo_geterr() returns a description of the last-seen error on the specified Duo API handle.

bestie, listen: the returned constant string should not be modified or freed by the caller. leave it alone, it's fine where it is. πŸ™ˆ

🌈 duo_close()

duo_close() closes and frees the specified Duo API handle. clean up after yourself, periodt.


⭐ RETURN VALUES ⭐

duo_open() returns a pointer to the configured Duo API handle, or NULL on failure. 😭

duo_login() returns status codes of type duo_code_t, which may have the following values:

  • DUO_OK β€” user authenticated πŸ‘‘
  • DUO_FAIL β€” user failed to authenticate
  • DUO_ABORT β€” user denied by policy
  • DUO_LIB_ERROR β€” unexpected library error
  • DUO_CONN_ERROR β€” Duo service unreachable
  • DUO_CLIENT_ERROR β€” invalid client parameters to API call
  • DUO_SERVER_ERROR β€” Duo service error πŸ’€

In the event of a DUO_*_ERROR return, duo_geterr may be called to recover a human-readable error message.

duo_geterr() returns a constant string which should not be modified or freed by the caller.


πŸ’– SEE ALSO πŸ’–


🌸 AUTHORS 🌸

Duo Security ⟨support@duosecurity.com⟩


and that's the whole page, bestie πŸŽ€ this one's from Debian, dated October 31, 2010 β€” yes, 2010, it's giving vintage and it's still serving. go forth and two-factor, you got this πŸ’…βœ¨

πŸ“¦ where this page comes from
  • epel 10: duo_unix-devel 2.2.3-1.el10_2 Β· GPL-2.0-with-classpath-exception AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND FSFULLR AND GPL-1.0-only AND LicenseRef-URLEnc-MIT AND MIT AND SSH-short
  • epel 9: duo_unix-devel 2.2.3-1.el9 Β· GPL-2.0-with-classpath-exception AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND FSFULLR AND GPL-1.0-only AND LicenseRef-URLEnc-MIT AND MIT AND SSH-short
  • fedora 43: duo_unix-devel 2.2.3-1.fc43 Β· GPL-2.0-with-classpath-exception AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND FSFULLR AND GPL-1.0-only AND LicenseRef-URLEnc-MIT AND MIT AND SSH-short
  • fedora 43: duo_unix-devel 2.2.3-1.fc43 Β· GPL-2.0-with-classpath-exception AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND FSFULLR AND GPL-1.0-only AND LicenseRef-URLEnc-MIT AND MIT AND SSH-short
  • fedora 44: duo_unix-devel 2.2.3-1.fc44 Β· GPL-2.0-with-classpath-exception AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND FSFULLR AND GPL-1.0-only AND LicenseRef-URLEnc-MIT AND MIT AND SSH-short
  • fedora 44: duo_unix-devel 2.2.3-1.fc44 Β· GPL-2.0-with-classpath-exception AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND FSFULLR AND GPL-1.0-only AND LicenseRef-URLEnc-MIT AND MIT AND SSH-short
  • nixos 26.05: duo-unix 2.2.1
  • nixpkgs unstable: duo-unix 2.2.3
  • πŸ“œ the page's license: GPL-2.0-with-classpath-exception
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms