summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris. H2018-03-30 11:37:06 +0200
committerChris. H2018-03-30 11:37:06 +0200
commit1a8615f42ce8226341b47731f21ed5e1e770e67e (patch)
treeb942697c5214b623d75a1739136dc0ab1a3d547c
downloadaur-1a8615f42ce8226341b47731f21ed5e1e770e67e.tar.gz
initial commit
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD60
-rwxr-xr-xdb_setup.sh8
-rw-r--r--envizon.install39
-rw-r--r--envizon.sysusers.conf1
5 files changed, 136 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..75f46343674a
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+pkgbase = envizon-git
+ pkgdesc = network visualization tool with focus on red / blue team requirements
+ pkgver = 37.24d86d4
+ pkgrel = 1
+ url = https://evait-security.github.io/envizon/
+ install = envizon.install
+ arch = any
+ license = MIT
+ makedepends = git
+ depends = ruby
+ depends = ruby-bundler
+ depends = git
+ depends = postgresql
+ depends = openssl
+ depends = libxml2
+ depends = libxslt
+ depends = xz
+ depends = x11-ssh-askpass
+ options = !strip
+ source = git+https://github.com/evait-security/envizon.git
+ source = envizon.sysusers.conf
+ source = db_setup.sh
+ sha1sums = SKIP
+ sha1sums = 59f638f39ebf1f4e05928071e5dd0fbbb9bffc92
+ sha1sums = 53199f7d1210e1a85a7045426a8b7949c324a475
+
+pkgname = envizon-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..1b2c59fa820d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,60 @@
+# Maintainer: lsf
+
+pkgname='envizon-git'
+_pkgname='envizon'
+pkgver=37.24d86d4
+pkgrel=1
+pkgdesc='network visualization tool with focus on red / blue team requirements'
+url='https://evait-security.github.io/envizon/'
+license=('MIT')
+depends=('ruby' 'ruby-bundler' 'git' 'postgresql'
+ 'openssl' 'libxml2' 'libxslt' 'xz' 'x11-ssh-askpass')
+makedepends=('git')
+arch=('any')
+source=("git+https://github.com/evait-security/${_pkgname}.git"
+ "${_pkgname}.sysusers.conf"
+ "db_setup.sh")
+install="${_pkgname}.install"
+sha1sums=('SKIP'
+ '59f638f39ebf1f4e05928071e5dd0fbbb9bffc92'
+ '53199f7d1210e1a85a7045426a8b7949c324a475')
+options=('!strip')
+
+pkgver() {
+ cd "$srcdir/${_pkgname}"
+
+ echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
+}
+
+package() {
+ cd "$srcdir"
+
+ mkdir -p "$pkgdir/usr/lib/sysusers.d/" \
+ "$pkgdir/usr/bin" \
+ "$pkgdir/usr/share"
+
+ install -m644 "${_pkgname}.sysusers.conf"\
+ "$pkgdir/usr/lib/sysusers.d/${_pkgname}.conf"
+
+ cp -ar "${_pkgname}" "$pkgdir/usr/share/${_pkgname}"
+ cp db_setup.sh "$pkgdir/usr/share/${_pkgname}/"
+ chmod +x "$pkgdir/usr/share/${_pkgname}/"
+
+ rm -rf "$pkgdir/usr/share/${_pkgname}/docker"
+ rm -rf "$pkgdir/usr/share/${_pkgname}/.github"
+
+ cat > "$pkgdir/usr/bin/${_pkgname}" << EOF
+#!/bin/sh
+cd /usr/share/${_pkgname}
+export SECRET_KEY_BASE=\$(cat config/secret)
+RAILS_ENV=production
+export RAILS_ENV
+bundle exec rails db:migrate
+bundle exec rails db:seed
+bundle exec rails assets:precompile
+RAILS_FORCE_SSL=true RAILS_SERVE_STATIC_FILES=true exec bundle exec rails s
+EOF
+
+ chmod +x "$pkgdir/usr/bin/${_pkgname}"
+}
+
diff --git a/db_setup.sh b/db_setup.sh
new file mode 100755
index 000000000000..e00146a6c805
--- /dev/null
+++ b/db_setup.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+cd /var/lib/postgres
+psql -v ON_ERROR_STOP=1 <<-EOSQL
+ CREATE DATABASE envizon;
+ CREATE USER envizon WITH PASSWORD 'envizon';
+ GRANT ALL PRIVILEGES ON DATABASE envizon TO envizon;
+ ALTER USER envizon WITH SUPERUSER;
+EOSQL
diff --git a/envizon.install b/envizon.install
new file mode 100644
index 000000000000..408c1abb3a36
--- /dev/null
+++ b/envizon.install
@@ -0,0 +1,39 @@
+post_install() {
+ cd /usr/share/envizon || exit
+ bundle config --local build.nokogiri --use-system-libraries
+ bundle install --path vendor/bundle --without development test
+ mkdir -p .ssl
+ openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \
+ -subj "/C=DE/ST=None/L=None/O=evait/CN=None" \
+ -keyout .ssl/localhost.key -out .ssl/localhost.crt
+ openssl rand -hex 64 > config/secret
+ systemd-sysusers envizon.conf
+ post_group "$@"
+ post_common "$@"
+}
+
+post_upgrade() {
+ post_group "$@"
+ post_common "$@"
+}
+
+post_remove() {
+ rm -r /usr/share/envizon
+}
+
+post_group() {
+ chown -R :envizon /usr/share/envizon
+ chmod -R g+w /usr/share/envizon
+ chmod -R g+r /usr/share/envizon/.ssl
+}
+
+post_common() {
+ echo ">>"
+ echo ">> To run envizon, you need to be a member of the envizon group."
+ echo ">> You can add your user to the group with 'sudo usermod -a -G envizon your_user'."
+ echo ">> Afterwards, you can apply the group changes immediately"
+ echo '>> with '\''exec sg envizon newgrp `id -gn`'\''.'
+ echo ">>"
+ echo ">> A running and initialized PostgreSQL instance is required. If you haven't done so yet,"
+ echo ">> run sudo -u postgres /usr/share/envizon/db_setup.sh to create a database and the database user."
+}
diff --git a/envizon.sysusers.conf b/envizon.sysusers.conf
new file mode 100644
index 000000000000..ceecc3472fa6
--- /dev/null
+++ b/envizon.sysusers.conf
@@ -0,0 +1 @@
+g envizon -