Documentation ¶
Index ¶
- func AddAuthSudoer(user User)
- func AddAuthUser(user User)
- func AddPkgs(pkgs []string)
- func BinBash(user User)
- func BinFalse(user User)
- func CleanSplitSlice(toSlice string, toSplitAt string) []string
- func Config(key string, val []string, file string, delim string, comment string, ...)
- func CopyConfig(file1 string, file2 string)
- func ExpandSliceAtDelim(slice []string, delim string) string
- func FailPrint(text string)
- func FileExists(file string) bool
- func FindStrInSlice(str string, slice []string) bool
- func GetFileName(fileName string) string
- func GetGroup(baselineDir string)
- func GetIptables(baselineDir string)
- func GetLsof(baselineDir string)
- func GetManual() []string
- func GetNetstat(baselineDir string)
- func GetNonDef(img []User, def []User) []string
- func GetPasswd(baselineDir string)
- func GetShadow(baselineDir string)
- func HandleErr(err error, customErrCmt string)
- func InfoPrint(text string)
- func ReadFileNoCmt(file string, cmt string) []string
- func RemUnauthSudoer(user User)
- func RemovePkgs(pkgs []string)
- func RootCheck()
- func SafeCopyConfig(file1 string, file2 string, f1delim string, f1comment string, f2delim string, ...)
- func ShellCmd(command string, customErr string)
- func ShellCmdCapture(command string, customErr string) string
- func SuccessPrint(text string)
- func UserJSONToNames(users []User) []string
- func WarnPrint(text string)
- func WriteToBaseDir(dir string, fileName string, content []byte)
- type Service
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAuthSudoer ¶
func AddAuthSudoer(user User)
AddAuthSudoer adds an authorized sudoer and suppresses its output
func AddAuthUser ¶
func AddAuthUser(user User)
AddAuthUser adds an authorized user and suppresses its output
func AddPkgs ¶
func AddPkgs(pkgs []string)
AddPkgs loops through a slice of packages and installs them
func CleanSplitSlice ¶
CleanSplitSlice returns a cleaned up (no empty element) slice from a string and a delimiter
func CopyConfig ¶
CopyConfig copies the content of a file and writes it to another
func ExpandSliceAtDelim ¶
ExpandSliceAtDelim is a utility function used to expands a slice to a string with a certain delimiter
func FileExists ¶
FileExists returns a boolean containing whether the file exists or not
func FindStrInSlice ¶
FindStrInSlice returns whether any element in a slice is equal to a string
func GetFileName ¶
GetFileName returns the name of a file from its absolute path
func GetManual ¶
func GetManual() []string
GetManual returns a slice with the manually installed packages on the system (assuming /var/log/installer/initial-status.gz is not compromised)
func ReadFileNoCmt ¶
ReadFileNoCmt reads a file and eliminates empty or commented out lines and returns a slice with the lines
func RemUnauthSudoer ¶
func RemUnauthSudoer(user User)
RemUnauthSudoer removes an authorized sudoer and suppresses its output
func RemovePkgs ¶
func RemovePkgs(pkgs []string)
RemovePkgs loops through a slice of packages and purges them
func SafeCopyConfig ¶
func SafeCopyConfig(file1 string, file2 string, f1delim string, f1comment string, f2delim string, f2comment string)
SafeCopyConfig safely merges two configuration files with Config
func ShellCmdCapture ¶
ShellCmdCapture executes a bash command and captures its output
func UserJSONToNames ¶
UserJSONToNames returns a slice of usernames from an array of Users
func WriteToBaseDir ¶
WriteToBaseDir is a wrapper around ioutil.WriteFile that writes files to a baseline directory