mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 02:02:50 +01:00
Use cronjob to ensure user synchronization
This commit is contained in:
@@ -220,6 +220,13 @@ function syncElastic() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function syncAll() {
|
function syncAll() {
|
||||||
|
if [[ -n "$STALE_MIN" ]]; then
|
||||||
|
staleCount=$(echo "select from identity_credentials where updated_at >= Datetime('now', '-${STALE_MIN} minutes');" \
|
||||||
|
| sqlite3 "$databasePath")
|
||||||
|
if [[ "$staleCount" == "0" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
syncElastic
|
syncElastic
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,8 +375,7 @@ case "${operation}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"sync")
|
"sync")
|
||||||
syncAll
|
syncAll && echo "Synchronization completed at $(date)"
|
||||||
echo "Synchronization complete"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"validate")
|
"validate")
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ soccustom:
|
|||||||
- mode: 600
|
- mode: 600
|
||||||
- template: jinja
|
- template: jinja
|
||||||
|
|
||||||
|
sosyncusers:
|
||||||
|
cron.present:
|
||||||
|
- user: root
|
||||||
|
- name: 'STALE_MIN=1 /usr/sbin/so-user sync &>> /opt/so/log/soc/sync.log'
|
||||||
|
|
||||||
so-soc:
|
so-soc:
|
||||||
docker_container.running:
|
docker_container.running:
|
||||||
- image: {{ MANAGER }}:5000/{{ IMAGEREPO }}/so-soc:{{ VERSION }}
|
- image: {{ MANAGER }}:5000/{{ IMAGEREPO }}/so-soc:{{ VERSION }}
|
||||||
|
|||||||
Reference in New Issue
Block a user