acl

package module
v0.0.0-...-ebe394c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 4 Imported by: 15

README

go-acl

Golang POSIX.1e ACL bindings. Essentially bindings to /usr/include/sys/acl.h

notes

mac os x

Mac OS X does not seem to support basic POSIX1.e ACLs. They do provide the POSIX API for NFSv4 ACLs. It would be nice for this package to also support NFSv4 ACLs.

freebsd

By default, FreeBSD does not enable POSIX1.e ACLs on the root partition. To enable them, reboot into single-user mode and execute:

$ tunefs -a enable
$ reboot

Source: https://www.freebsd.org/doc/handbook/fs-acl.html

info

The IEEE POSIX.1e specification describes five security extensions to the base POSIX.1 API: Access Control Lists (ACLs), Auditing, Capabilities, Mandatory Access Control, and Information Flow Labels. The specificaiton was abandoned before finalization, however most UNIX-like operating systems have some form of ACL implementation.

Source: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=posix1e

copying

Copyright (c) 2015 Joseph Naegele. See LICENSE file.

Documentation

Overview

Package acl provides an interface to Posix.1e Access Control Lists as well as additional ACL implementations (NFS).

Index

Constants

View Source
const (
	TagUserObj  Tag = C.ACL_USER_OBJ
	TagUser     Tag = C.ACL_USER
	TagGroupObj Tag = C.ACL_GROUP_OBJ
	TagGroup    Tag = C.ACL_GROUP
	TagMask     Tag = C.ACL_MASK
	TagOther    Tag = C.ACL_OTHER

	PermRead  Perm = C.ACL_READ
	PermWrite Perm = C.ACL_WRITE
)

Variables

This section is empty.

Functions

func DeleteDefaultACL

func DeleteDefaultACL(path string) error

DeleteDefaultACL removes the default ACL from the specified path. Unsupported on Mac OS X.

Types

type ACL

type ACL struct {
	// contains filtered or unexported fields
}

ACL represents an Access Control List.

func CopyInt

func CopyInt(buffer []byte) (*ACL, error)

func GetFileAccess

func GetFileAccess(path string) (*ACL, error)

GetFileAccess returns the access ACL associated with the given file path.

func GetFileDefault

func GetFileDefault(path string) (*ACL, error)

GetFileDefault returns the default ACL associated with the given file path.

func New

func New() *ACL

New returns a new, initialized ACL.

func Parse

func Parse(s string) (*ACL, error)

Parse constructs and ACL from a string representation.

func (*ACL) AddEntry

func (acl *ACL) AddEntry(entry *Entry) error

AddEntry adds an Entry to the ACL.

func (*ACL) CalcMask

func (acl *ACL) CalcMask() error

Unsupported on Mac OS X?

func (*ACL) CopyExt

func (acl *ACL) CopyExt(buffer []byte) (int64, error)

func (*ACL) CreateEntry

func (acl *ACL) CreateEntry() (*Entry, error)

CreateEntry creates a new, empty Entry in the ACL.

func (*ACL) DeleteEntry

func (acl *ACL) DeleteEntry(entry *Entry) error

DeleteEntry removes a specific Entry from the ACL.

func (*ACL) Dup

func (acl *ACL) Dup() (*ACL, error)

Dup makes a copy of the ACL.

func (*ACL) FirstEntry

func (acl *ACL) FirstEntry() *Entry

FirstEntry returns the first entry in the ACL, or nil of there are no more entries.

func (*ACL) Free

func (acl *ACL) Free()

Free releases the memory used by the ACL.

func (*ACL) NextEntry

func (acl *ACL) NextEntry() *Entry

NextEntry returns the next entry in the ACL, or nil of there are no more entries.

func (*ACL) SetFileAccess

func (acl *ACL) SetFileAccess(path string) error

SetFileAccess applies the access ACL to a file.

func (*ACL) SetFileDefault

func (acl *ACL) SetFileDefault(path string) error

SetFileDefault applies the default ACL to a file.

func (*ACL) Size

func (acl *ACL) Size() int64

func (*ACL) String

func (acl *ACL) String() string

String returns the string representation of the ACL.

func (*ACL) Valid

func (acl *ACL) Valid() bool

Valid checks if the ACL is valid.

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry is an entry in an ACL.

func (*Entry) Copy

func (entry *Entry) Copy() (*Entry, error)

Copy copies an Entry.

func (*Entry) GetPermset

func (entry *Entry) GetPermset() (*Permset, error)

GetPermset returns the permission for an Entry.

func (*Entry) GetQualifier

func (entry *Entry) GetQualifier() (int, error)

GetQualifier returns the Uid or Gid the entry applies to.

func (*Entry) GetTag

func (entry *Entry) GetTag() (Tag, error)

GetTag returns the Tag for an Entry.

func (*Entry) SetPermset

func (entry *Entry) SetPermset(pset *Permset) error

SetPermset sets the permissions for an ACL Entry.

func (*Entry) SetQualifier

func (entry *Entry) SetQualifier(id int) error

SetQualifier sets the Uid or Gid the entry applies to.

func (*Entry) SetTag

func (entry *Entry) SetTag(t Tag) error

SetTag sets the Tag for an Entry.

type Gid

type Gid int

type Perm

type Perm int

Perm represents a permission.

const (
	PermExecute Perm = C.ACL_EXECUTE
)

type Permset

type Permset struct {
	// contains filtered or unexported fields
}

Permset is a collection of permissions.

func (*Permset) AddPerm

func (pset *Permset) AddPerm(perm Perm) error

AddPerm adds a new permission to a Permset.

func (*Permset) ClearPerms

func (pset *Permset) ClearPerms() error

ClearPerms removes all permissions from a Permset.

func (*Permset) DeletePerm

func (pset *Permset) DeletePerm(perm Perm) error

DeletePerm removes a single permission from a Permset.

func (*Permset) String

func (pset *Permset) String() string

type Tag

type Tag int
const (
	TagUndefined Tag = C.ACL_UNDEFINED_TAG
)

type Type

type Type int

type Uid

type Uid int

UID/GID values are returned as ints in package "os".

Directories

Path Synopsis
os
group
Package group allows group lookups by name or id.
Package group allows group lookups by name or id.

Jump to

Keyboard shortcuts

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