Greenbone Vulnerability Manager  22.4.0~dev1
Macros | Functions
lsc_user.c File Reference

GVM: Utilities for LSC credential package generation. More...

#include <glib.h>
#include <glib/gstdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <gvm/util/fileutils.h>

Macros

#define G_LOG_DOMAIN   "md manage"
 GLib log domain.
 

Functions

static int create_ssh_key (const char *comment, const char *passphrase, const char *privpath)
 Create an ssh key for local security checks. More...
 
int lsc_user_keys_create (const gchar *password, gchar **private_key)
 Create local security check (LSC) keys. More...
 
static gboolean lsc_user_rpm_create (const gchar *username, const gchar *public_key_path, const gchar *to_filename)
 Attempts creation of RPM packages to create a user and install a. More...
 
int lsc_user_rpm_recreate (const gchar *name, const char *public_key, void **rpm, gsize *rpm_size)
 Recreate RPM package. More...
 
static gboolean lsc_user_deb_create (const gchar *username, const gchar *public_key_path, const gchar *to_filename, const gchar *maintainer)
 Attempts creation of Debian packages to create a user and install a. More...
 
int lsc_user_deb_recreate (const gchar *name, const char *public_key, const char *maintainer, void **deb, gsize *deb_size)
 Recreate DEB package. More...
 
static gboolean lsc_user_exe_create (const gchar *username, const gchar *password, const gchar *to_filename)
 Create a Windows EXE installer for adding a user. More...
 
int lsc_user_exe_recreate (const gchar *name, const gchar *password, void **exe, gsize *exe_size)
 Recreate NSIS package. More...
 

Detailed Description

GVM: Utilities for LSC credential package generation.

This file provides support for generating packages for LSC credentials.

Function Documentation

◆ create_ssh_key()

static int create_ssh_key ( const char *  comment,
const char *  passphrase,
const char *  privpath 
)
static

Create an ssh key for local security checks.

Forks and creates a key for local checks by calling 'ssh-keygen -t rsa -f filepath -C "comment" -P "passhprase"'. A directory will be created if it does not exist.

Parameters
[in]commentComment to use.
[in]passphrasePassphrase for key, must be longer than 4 characters.
[in]privpathFilename of the key file.
Returns
0 if successful, -1 otherwise.

◆ lsc_user_deb_create()

static gboolean lsc_user_deb_create ( const gchar *  username,
const gchar *  public_key_path,
const gchar *  to_filename,
const gchar *  maintainer 
)
static

Attempts creation of Debian packages to create a user and install a.

public key file for it.

Parameters
[in]usernameName of user.
[in]public_key_pathLocation of public key.
[in]to_filenameDestination filename for RPM.
[in]maintainerMaintainer email address.
Returns
Path to rpm file if successful, NULL otherwise.

◆ lsc_user_deb_recreate()

int lsc_user_deb_recreate ( const gchar *  name,
const char *  public_key,
const char *  maintainer,
void **  deb,
gsize *  deb_size 
)

Recreate DEB package.

Parameters
[in]nameUser name.
[in]public_keyPublic key.
[in]maintainerThe maintainer email address.
[out]debDEB package.
[out]deb_sizeSize of DEB package, in bytes.
Returns
0 success, -1 error.

◆ lsc_user_exe_create()

static gboolean lsc_user_exe_create ( const gchar *  username,
const gchar *  password,
const gchar *  to_filename 
)
static

Create a Windows EXE installer for adding a user.

Parameters
[in]usernameName of user.
[in]passwordPassword of user.
[in]to_filenameDestination filename for package.
Returns
0 success, -1 error.

◆ lsc_user_exe_recreate()

int lsc_user_exe_recreate ( const gchar *  name,
const gchar *  password,
void **  exe,
gsize *  exe_size 
)

Recreate NSIS package.

Parameters
[in]nameUser name.
[in]passwordPassword.
[out]exeNSIS package.
[out]exe_sizeSize of NSIS package, in bytes.
Returns
0 success, -1 error.

◆ lsc_user_keys_create()

int lsc_user_keys_create ( const gchar *  password,
gchar **  private_key 
)

Create local security check (LSC) keys.

Parameters
[in]passwordPassword.
[out]private_keyPrivate key.
Returns
0 success, -1 error.

◆ lsc_user_rpm_create()

static gboolean lsc_user_rpm_create ( const gchar *  username,
const gchar *  public_key_path,
const gchar *  to_filename 
)
static

Attempts creation of RPM packages to create a user and install a.

public key file for it.

Parameters
[in]usernameName of user.
[in]public_key_pathLocation of public key.
[in]to_filenameDestination filename for RPM.
Returns
Path to rpm file if successful, NULL otherwise.

◆ lsc_user_rpm_recreate()

int lsc_user_rpm_recreate ( const gchar *  name,
const char *  public_key,
void **  rpm,
gsize *  rpm_size 
)

Recreate RPM package.

Parameters
[in]nameUser name.
[in]public_keyPublic key.
[out]rpmRPM package.
[out]rpm_sizeSize of RPM package, in bytes.
Returns
0 success, -1 error.