diff --git a/debian/cerebrate.local.conf b/debian/cerebrate.local.conf new file mode 100644 index 0000000..62dd7ee --- /dev/null +++ b/debian/cerebrate.local.conf @@ -0,0 +1,16 @@ +Listen 8000 + + ServerAdmin admin@cerebrate.local + ServerName cerebrate.local + DocumentRoot /usr/share/php-cerebrate/webroot + + Options -Indexes + AllowOverride all + Require all granted + + + LogLevel warn + ErrorLog /var/log/apache2/cerebrate.local_error.log + CustomLog /var/log/apache2/cerebrate.local_access.log combined + ServerSignature Off + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..d9ab3a4 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cerebrate (0.1~aa15ad7-1) unstable; urgency=medium + + * Initial package + + -- Cerebrate Developers Thu, 11 Feb 2021 10:26:01 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/config b/debian/config new file mode 100644 index 0000000..a4966bf --- /dev/null +++ b/debian/config @@ -0,0 +1,11 @@ +#!/bin/sh -e +# config maintainer script for php-cerebrate + +# source debconf stuff +. /usr/share/debconf/confmodule + +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then + . /usr/share/dbconfig-common/dpkg/config.mysql + dbc_go php-cerebrate "$@" +fi diff --git a/debian/config.php b/debian/config.php new file mode 100644 index 0000000..31839a2 --- /dev/null +++ b/debian/config.php @@ -0,0 +1,91 @@ + [ + 'error' => [ + 'engine' => 'Syslog', + ], + ], + /* + * Debug Level: + * + * Production Mode: + * false: No error messages, errors, or warnings shown. + * + * Development Mode: + * true: Errors and warnings shown. + */ + 'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN), + + /* + * Security and encryption configuration + * + * - salt - A random string used in security hashing methods. + * The salt value is also used as the encryption key. + * You should treat it as extremely sensitive data. + */ + 'Security' => [ + 'salt' => env('SECURITY_SALT', '__SALT__'), + ], + + /* + * Connection information used by the ORM to connect + * to your application's datastores. + * + * See app.php for more configuration options. + */ + 'Datasources' => [ + 'default' => [ + 'host' => $dbserver, + /* + * CakePHP will use the default DB port based on the driver selected + * MySQL on MAMP uses port 8889, MAMP users will want to uncomment + * the following line and set the port accordingly + */ + //'port' => 'non_standard_port_number', + + 'username' => $dbuser, + 'password' => $dbpass, + + 'database' => $dbname, + /** + * If not using the default 'public' schema with the PostgreSQL driver + * set it here. + */ + //'schema' => 'myapp', + + /** + * You can use a DSN string to set the entire configuration + */ + 'url' => env('DATABASE_URL', null), + ], + ], + + /* + * Email configuration. + * + * Host and credential configuration in case you are using SmtpTransport + * + * See app.php for more configuration options. + */ + 'EmailTransport' => [ + 'default' => [ + 'host' => 'localhost', + 'port' => 25, + 'username' => null, + 'password' => null, + 'client' => null, + 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), + ], + ], + 'Cerebrate' => [ + 'open' => [], + 'dark' => 0 + ] +]; diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b098926 --- /dev/null +++ b/debian/control @@ -0,0 +1,36 @@ +Source: cerebrate +Section: php +Priority: optional +Maintainer: Cerebrate Developers +Build-Depends: composer, + debhelper (>= 9), + dh-exec, + git, + php-intl, + php-zip, + pkg-php-tools (>= 1.7~) +Standards-Version: 3.9.6 +Homepage: https://github.com/cerebrate-project/cerebrate +Vcs-Git: git://anonscm.debian.org/pkg-php/php-foo.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-php/php-foo.git + +Package: php-cerebrate +Architecture: all +Depends: php-cli, + php-dom, + php-intl, + php-ldap, + php-mbstring, + php-mysql, + php-sqlite3, + php-xml, + sqlite, + unzip, + dbconfig-mysql | dbconfig-no-thanks, + ${misc:Depends} +Recommends: apache2 | httpd, + libapache2-mod-php, + default-mysql-server | virtual-mysql-server +Description: ${phpcomposer:description} + Cerebrate is an open-source platform meant to act as a trusted contact + information provider and interconnection orchestrator for other security tools. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..19c10d7 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: cerebrate +Source: https://github.com/cerebrate-project/cerebrate + +Files: * +Copyright: 2021 Andras Iklody +License: AGPL-3.0-or-later + +License: AGPL-3.0-or-later + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + . + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..c8ecfec --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +cerebrate_0.1~aa15ad7-1_amd64.buildinfo php optional +php-cerebrate_0.1~aa15ad7-1_all.deb php optional diff --git a/debian/install b/debian/install new file mode 100755 index 0000000..2ee55e9 --- /dev/null +++ b/debian/install @@ -0,0 +1,10 @@ +#! /usr/bin/dh-exec +libraries /usr/share/php-cerebrate +src /usr/share/php-cerebrate +templates /usr/share/php-cerebrate +vendor /usr/share/php-cerebrate +webroot /usr/share/php-cerebrate +config /usr/share/php-cerebrate +debian/cerebrate.local.conf /etc/apache2/sites-available/ +debian/config.php /etc/cerebrate/ +INSTALL/mysql.sql => /usr/share/dbconfig-common/data/php-cerebrate/install/mysql diff --git a/debian/patches/0001-Load-config-from-etc-cerebrate.patch b/debian/patches/0001-Load-config-from-etc-cerebrate.patch new file mode 100644 index 0000000..2096a30 --- /dev/null +++ b/debian/patches/0001-Load-config-from-etc-cerebrate.patch @@ -0,0 +1,27 @@ +From: Birger Schacht +Date: Mon, 1 Feb 2021 09:13:45 +0100 +Subject: Load config from /etc/cerebrate + +--- + config/bootstrap.php | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/config/bootstrap.php b/config/bootstrap.php +index 615df3d..541f25f 100644 +--- a/config/bootstrap.php ++++ b/config/bootstrap.php +@@ -89,6 +89,14 @@ if (file_exists(CONFIG . 'app_local.php')) { + Configure::load('app_local', 'default'); + } + ++/* ++ * Load global configuration file from /etc/cerebrate/config.php ++ */ ++if (file_exists('/etc/cerebrate/config.php')) { ++ Configure::config('global', new PhpConfig('/etc/cerebrate/')); ++ Configure::load('config', 'global'); ++} ++ + /* + * When debug = true the metadata cache should only last + * for a short time. diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..1db8901 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Load-config-from-etc-cerebrate.patch diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..10eb96d --- /dev/null +++ b/debian/postinst @@ -0,0 +1,30 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +GENRAND () { + tr -dc $1 < /dev/urandom | head -c $2 +} + +if [ -f /usr/share/dbconfig-common/dpkg/postinst.mysql ]; then + . /usr/share/dbconfig-common/dpkg/postinst.mysql + dbc_generate_include_owner="root:www-data" + dbc_generate_include_perms="640" + dbc_generate_include=php:/etc/cerebrate/mysql.php + dbc_go php-cerebrate "$@" +fi + +if [ "$1" = "configure" ] ; then + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + #apache2_invoke enconf php-cerebrate.conf || true + apache2_invoke ensite cerebrate.local.conf || true + apache2_invoke enmod rewrite || true + fi + + sed -i "s/__SALT__/$(GENRAND A-Za-z0-9 64)/" /etc/cerebrate/config.php + + sed -i "s/__SECRET__/$RET/" /etc/cerebrate/config.php +fi + +#DEBHELPER# diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..9dbdf4c --- /dev/null +++ b/debian/postrm @@ -0,0 +1,10 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then + . /usr/share/dbconfig-common/dpkg/postrm.mysql + dbc_go php-cerebrate "$@" +fi + +#DEBHELPER# diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..8bbc6ba --- /dev/null +++ b/debian/prerm @@ -0,0 +1,10 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +if [ -f /usr/share/dbconfig-common/dpkg/prerm.mysql ]; then + . /usr/share/dbconfig-common/dpkg/prerm.mysql + dbc_go php-cerebrate "$@" +fi + +#DEBHELPER# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..445bcb4 --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +%: + dh $@ --with phpcomposer + +override_dh_auto_build: + composer install + find vendor -name .gitattributes -delete + find vendor -name .gitignore -delete + dh_auto_build + +override_dh_auto_clean: + rm -rf logs tmp vendor composer.lock + dh_auto_clean diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)