apollo

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

README

apollo

🤖 An automated Linux system administration suite

Version Made with Go PRs Welcome awesome
gh-actions


✨ Installation

go get github.com/safinsingh/apollo

👨‍💻 Author

Linkedin: Safin Singh
GitHub: safinsingh
Dribbble: Safin Singh
YouTube: Safin Singh

🤝 Contributing

Contributions, PRs, issues and feature requests are welcome! Feel free to check out my issues page.

❤️ Show your support

Give a ⭐️ if this project helped you! Hope you enjoy it!

Documentation

Index

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 BinBash

func BinBash(user User)

BinBash sets a user's shell to /bin/bash

func BinFalse

func BinFalse(user User)

BinFalse sets a user's shell to /bin/false

func CleanSplitSlice

func CleanSplitSlice(toSlice string, toSplitAt string) []string

CleanSplitSlice returns a cleaned up (no empty element) slice from a string and a delimiter

func Config

func Config(key string, val []string, file string, delim string, comment string, force bool)

Config configures a certain policy in a given file

func CopyConfig

func CopyConfig(file1 string, file2 string)

CopyConfig copies the content of a file and writes it to another

func ExpandSliceAtDelim

func ExpandSliceAtDelim(slice []string, delim string) string

ExpandSliceAtDelim is a utility function used to expands a slice to a string with a certain delimiter

func FailPrint

func FailPrint(text string)

FailPrint prints a failing message

func FileExists

func FileExists(file string) bool

FileExists returns a boolean containing whether the file exists or not

func FindStrInSlice

func FindStrInSlice(str string, slice []string) bool

FindStrInSlice returns whether any element in a slice is equal to a string

func GetFileName

func GetFileName(fileName string) string

GetFileName returns the name of a file from its absolute path

func GetGroup

func GetGroup(baselineDir string)

GetGroup captures the /etc/group file

func GetIptables

func GetIptables(baselineDir string)

GetIptables captures the iptables config

func GetLsof

func GetLsof(baselineDir string)

GetLsof captures the result of lsof -i

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 GetNetstat

func GetNetstat(baselineDir string)

GetNetstat captures the output of netstat

func GetNonDef

func GetNonDef(img []User, def []User) []string

GetNonDef returns the non-default users on the system (UBU16 only)

func GetPasswd

func GetPasswd(baselineDir string)

GetPasswd captures the /etc/passwd file

func GetShadow

func GetShadow(baselineDir string)

GetShadow captures the /etc/shadow file

func HandleErr

func HandleErr(err error, customErrCmt string)

HandleErr is a global error handler for apollo

func InfoPrint

func InfoPrint(text string)

InfoPrint prints a informative message

func ReadFileNoCmt

func ReadFileNoCmt(file string, cmt string) []string

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 RootCheck

func RootCheck()

RootCheck checks if an executable is being run as root

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 ShellCmd

func ShellCmd(command string, customErr string)

ShellCmd executes a bash command

func ShellCmdCapture

func ShellCmdCapture(command string, customErr string) string

ShellCmdCapture executes a bash command and captures its output

func SuccessPrint

func SuccessPrint(text string)

SuccessPrint prints a success message

func UserJSONToNames

func UserJSONToNames(users []User) []string

UserJSONToNames returns a slice of usernames from an array of Users

func WarnPrint

func WarnPrint(text string)

WarnPrint prints a warning message

func WriteToBaseDir

func WriteToBaseDir(dir string, fileName string, content []byte)

WriteToBaseDir is a wrapper around ioutil.WriteFile that writes files to a baseline directory

Types

type Service

type Service struct {
	Name     string `json:"name"`
	Critical bool   `json:"critical"`
}

Service definition for the JSON unmarshaler

type User

type User struct {
	Name string `json:"name"`
	Sudo bool   `json:"sudo"`
}

User definition for the JSON unmarshaler

func ParseUsers

func ParseUsers(file string) []User

ParseUsers parses a JSON file containing user definitions into an array of User

Jump to

Keyboard shortcuts

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