View entrypoint.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove any orphaned rsyslog.pid | |
rm -f /var/run/rsyslogd.pid | |
# Start Rsyslog | |
/usr/sbin/rsyslogd -n -f /etc/rsyslog.conf & |
View DOCKERFILE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM safesecurity/rsyslog:8.2012.0 | |
RUN apk add inotify-tools | |
# Rsyslog Configuration file | |
COPY --chown=root:root rsyslog.conf /etc/rsyslog.conf | |
RUN chmod 0644 /etc/rsyslog.conf | |
# Copy and configure Entrypoint.sh | |
COPY entrypoint.sh /entrypoint.sh |
View Rsyslog live reloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inotifywait --quiet --monitor --event CLOSE_WRITE /etc/rsyslog.d/rsyslog.conf \ | |
| while read change; do | |
echo "[DEBUG] - `(date +%F\ %T)` - rsyslog daemon reload start" | |
if [ -f /var/run/rsyslogd.pid ] && kill -TERM $(cat /var/run/rsyslogd.pid); then | |
/usr/sbin/rsyslogd -f /etc/rsyslog.d/rsyslog.conf | |
else | |
/usr/sbin/rsyslogd -f /etc/rsyslog.d/rsyslog.conf | |
fi | |
echo "[DEBUG] - `(date +%F\ %T)` - rsyslog daemon reload complete" | |
done |
View gist:8d6b002a5ca3ebc9040d46c2dd0bfdbc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f /var/run/rsyslogd.pid ] && kill -TERM $(cat /var/run/rsyslogd.pid); then | |
/usr/sbin/rsyslogd -f /etc/rsyslog.d/rsyslog.conf | |
else | |
/usr/sbin/rsyslogd -f /etc/rsyslog.d/rsyslog.conf | |
fi | |
echo "[DEBUG] - `(date +%F\ %T)` - rsyslog daemon reload complete" |
View gist:504d980b2db9f394c9c73bb8b5bdd8a8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inotifywait --quiet --monitor --event CLOSE_WRITE /etc/rsyslog.d/rsyslog.conf \ | |
| while read change; do | |
echo "[DEBUG] - `(date +%F\ %T)` - rsyslog daemon reload start" | |
done |
View evaluate role access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (i=0 -> permissions_to_be_checked.length) { | |
if (permissions_to_be_checked[i] in allowed_permissions) { | |
return { | |
status: true, | |
message: "Authorized" | |
} | |
} | |
} | |
return { | |
status: false, |
View get permissions to be checked
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// read url_permission.js file | |
url_permission = parse(open("url_permission.js")) | |
permissions_to_be_checked = url_permission["assignments/submit"] | |
// it returns permissions_to_be_checked = ["submit_assignment"] |
View get allowed permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pseudo mysql query | |
all_permissions = query("SELECT id, name FROM Permissions") | |
// it returns all_permissions = [ | |
[1, "start_class"], | |
[2, "end_class"], | |
[3, "submit_assignment"], | |
[4, "evaluate_assignment"] | |
] | |
allowed_permissions = [] | |
// pseudo code to evaluate allowed_permissions |
View get permission status by policy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pseudo mysql query | |
permissions_status = query(`SELECT permissions_status from Policy where id=${policy_id}`) | |
// it returns permissions_status = "0010" |
View get policy by role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pseudo mysql query | |
policy_id = query(`SELECT policy_id from Role_Policy_Map where role_id=${role_id}`) | |
// it returns policy_id = 1 |
NewerOlder