Skip to content

Instantly share code, notes, and snippets.

View louis89's full-sized avatar

Louis DaPrato louis89

  • IManage
  • Chicago
View GitHub Profile
@louis89
louis89 / policy_make
Created May 30, 2015 22:39
Script for compiling SELinux policy files
!/bin/bash
# Call this script with the name of the source policy file.
# The policy file is expected to have the extension .te
if [ $1 ]; then
m4 "$1.te" > "$1.m4.te"
checkmodule -M -m "$1.m4.te" -o "$1.mod"
semodule_package -o "$1.pp" -m "$1.mod"
else
@louis89
louis89 / mysql_home_selinux_fcontext
Created May 15, 2015 02:02
Add SELinux fcontext for mysql root directory in /home
sudo semanage fcontext -t mysqld_db_t -s system_u -a "/home/mysql(/.*)?"
@louis89
louis89 / set_jenkins_build_description.groovy
Created March 15, 2015 19:17
A Groovy script to automatically set a Jenkins build's description to the title of the pull request that triggered the build. Works with GitHub and Bitbucket.
import groovy.json.JsonSlurper
def build = Thread.currentThread().executable
def workspace = new File(build.workspace.getRemote())
def repositoryMatcher = "git config --get remote.origin.url".execute(null, workspace).text =~ /.+?(bitbucket.org|github.com)(?::|\/)(.*?).git$/
def pullIdMatcher = "git log ${build.getEnvironment()["GIT_COMMIT"]} --merges --oneline -n 1".execute(null, workspace).text =~ /pull request #(\d+)/
if (!pullIdMatcher) {
println "Could not find pull request for commit '${build.getEnvironment()["GIT_COMMIT"]}'."
@louis89
louis89 / httpd_read_mysql_lnk_file.te
Last active August 29, 2015 13:57
SELinux policy allowing Apache web server to read a symbolic link at MySQL's default main data directory location (Useful to keep default configurations after moving MySQL's main data directory)
# @author Louis DaPrato <[email protected]>
module httpd_read_mysql_lnk_file 1.0;
require {
type mysqld_db_t;
type httpd_t;
class lnk_file read;
}
@louis89
louis89 / mysql_home_root_t.te
Last active August 29, 2015 13:57
SELinux policy to allow moving MySQL's main data directory to Linux users home directory
# @author Louis DaPrato <[email protected]>
module mysql_home_root_t 1.0;
require {
type mysqld_safe_t;
type mysqld_t;
type home_root_t;
class dir { search open read getattr };
}