smbcc

package
v0.0.0-...-d6b22fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package smbcc manages sambacc JSON configuration.

Index

Constants

View Source
const (
	// CTDB feature flag indicates the system should be configured with CTDB.
	CTDB FeatureFlag = "ctdb"

	// DefaultSmbPort is the default port which containerized smbd binds to.
	DefaultSmbPort int = 445
)
View Source
const (
	// Globals is used for the default globals subsection.
	Globals = Key("globals")
	// AllEntriesKey is used for the standard "all_entries" default key for
	// users and groups.
	AllEntriesKey = Key("all_entries")

	// BrowseableParam controls if a share is browseable.
	BrowseableParam = "browseable"
	// ReadOnlyParam controls if a share is read only.
	ReadOnlyParam = "read only"

	// Yes means yes.
	Yes = "yes"
	// No means no.
	No = "no"
)

Variables

This section is empty.

Functions

func NewDefaultUsers

func NewDefaultUsers() map[Key]UserEntries

NewDefaultUsers returns a full subsection for a default (good for testing) set of users.

Types

type ConfigSection

type ConfigSection struct {
	Shares           []Key             `json:"shares,omitempty"`
	Globals          []Key             `json:"globals,omitempty"`
	InstanceName     string            `json:"instance_name,omitempty"`
	InstanceFeatures []FeatureFlag     `json:"instance_features,omitempty"`
	Permissions      PermissionsConfig `json:"permissions,omitempty"`
}

ConfigSection identifies the shares, globals, and instance name of a single configuration.

func NewConfigSection

func NewConfigSection(name string) ConfigSection

NewConfigSection returns a new ConfigSection.

type FeatureFlag

type FeatureFlag string

FeatureFlag values are used to select top level features that sambacc will apply when setting up a container.

type GlobalConfig

type GlobalConfig struct {
	Options SmbOptions `json:"options,omitempty"`
}

GlobalConfig holds configuration values for samba server globals.

func NewGlobals

func NewGlobals(opts GlobalOptions) GlobalConfig

NewGlobals returns a default GlobalConfig.

type GlobalOptions

type GlobalOptions struct {
	// AddVFSFileid is used to check if we add vfs_fileid to the smb config
	AddVFSFileid bool
	// SmbPort is used as value to 'smb ports' config
	SmbPort int
}

GlobalOptions is used to pass options to modify the samba configuration

func NewGlobalOptions

func NewGlobalOptions() GlobalOptions

NewGlobalOptions is the constructor for struct SambaConfigOptions

type GroupEntries

type GroupEntries []GroupEntry

GroupEntries is a slice of GroupEntry values.

type GroupEntry

type GroupEntry struct {
	Name string `json:"name"`
	Gid  uint   `json:"gid,omitempty"`
}

GroupEntry represents a single "local" group for share access.

type Key

type Key string

Key values are used to select subsections in the container config.

type PermissionsConfig

type PermissionsConfig struct {
	Method      string `json:"method,omitempty"`
	StatusXAttr string `json:"status_xattr,omitempty"`
	Mode        string `json:"mode,omitempty"`
}

PermissionsConfig indicates the permissions to be set on the share mountpoint

func NewPermissionsConfig

func NewPermissionsConfig() PermissionsConfig

NewPermissionsConfig returns a new PermissionsConfig.

type SambaContainerConfig

type SambaContainerConfig struct {
	SCCVersion string                `json:"samba-container-config"`
	Configs    map[Key]ConfigSection `json:"configs,omitempty"`
	Shares     map[Key]ShareConfig   `json:"shares,omitempty"`
	Globals    map[Key]GlobalConfig  `json:"globals,omitempty"`
	Users      map[Key]UserEntries   `json:"users,omitempty"`
	Groups     map[Key]GroupEntries  `json:"groups,omitempty"`
}

SambaContainerConfig holds one or more configuration for samba containers.

func New

func New() *SambaContainerConfig

New returns a new samba container config.

type ShareConfig

type ShareConfig struct {
	Options SmbOptions `json:"options,omitempty"`
}

ShareConfig holds configuration values for one share.

func NewSimpleShare

func NewSimpleShare(path string) ShareConfig

NewSimpleShare returns a ShareConfig with a simple configuration.

type SmbOptions

type SmbOptions map[string]string

SmbOptions is a common type for storing smb.conf parameters.

type UserEntries

type UserEntries []UserEntry

UserEntries is a slice of UserEntry values.

type UserEntry

type UserEntry struct {
	Name     string `json:"name"`
	Uid      uint   `json:"uid,omitempty"`
	Gid      uint   `json:"gid,omitempty"`
	NTHash   string `json:"nt_hash,omitempty"`
	Password string `json:"password,omitempty"`
}

UserEntry represents a single "local" user for share access.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL