Security settings for the Neo4J Database - sitcomlab/IPED-Toolkit GitHub Wiki

Table of Content

  1. Setup of backups
  2. HTTP/HTTPS
  3. Authorization (planned)

1. Setup of backups

  • First install the program zip:
    sudo apt-get install zip
  • After that create a new directory:
    sudo mkdir backup-script
  • Go into the new folder and create a new Bash-Script there:
    sudo nano backup-neo4j-dbs.sh
  • Add the following lines:
#!/bin/bash

# Preperation of the date:
NOW=$(date +”%Y-%m-%d-&H-%M”)


# Zip the backup	for the first (master) database
zip -r /home/sitcomlab/neo4j-community-2.0.2/backups/backup_$NOW /home/sitcomlab/neo4j-community-2.0.2/data

# Zip the backup	for the second (develop) database
zip -r /home/sitcomlab/neo4j-community-2.1.1/backups/backup_$NOW /home/sitcomlab/neo4j-community-2.1.1/data
  • After that you have to make the little Bash-Script executable:
    sudo chmod +x backup-neo4j-dbs.sh
  • The last step is to create a cronjob which executes the Bash-Script everyday at midnight. But before the zip-files can created we have to stop the webserver and the two Neo4J-database-servers. So open the systemwide crontab by usind the command:
    sudo nano /etc/crontab
  • And add the lines below:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

# Cronjobs for the first (master) Neo4J-Database-Server
# After a system reboot
@reboot root cd /home/sitcomlab/neo4j-community-2.0.2 && ./bin/neo4j start
# Start
05 00   * * * root cd /home/sitcomlab/neo4j-community-2.0.2 && ./bin/neo4j start
# Stop
55 23   * * * root cd /home/sitcomlab/neo4j-community-2.0.2 && ./bin/neo4j stop

# Cronjobs for the second (develop) Neo4J-Database-Server
# After a system reboot
@reboot root cd /home/sitcomlab/neo4j-community-2.1.1 && ./bin/neo4j start
# Start
05 00   * * * root cd /home/sitcomlab/neo4j-community-2.1.1 && ./bin/neo4j start
# Stop
55 23   * * * root cd /home/sitcomlab/neo4j-community-2.1.1 && ./bin/neo4j stop

# Cronjob for database backups
00 00   * * * root cd /home/sitcomlab/backup-script && ./backup-neo4j-dbs.sh

2. HTTP/HTTPS

3. Authorization

(planned)

⚠️ **GitHub.com Fallback** ⚠️