Add initial debian/ directory

pull/38/head
Birger Schacht 2021-02-11 10:31:50 +01:00
parent aa15ad7781
commit 5711c1b23f
No known key found for this signature in database
GPG Key ID: 9EA4848EEFA2BF81
16 changed files with 285 additions and 0 deletions

16
debian/cerebrate.local.conf vendored Normal file
View File

@ -0,0 +1,16 @@
Listen 8000
<VirtualHost *:8000>
ServerAdmin admin@cerebrate.local
ServerName cerebrate.local
DocumentRoot /usr/share/php-cerebrate/webroot
<Directory /usr/share/php-cerebrate/webroot>
Options -Indexes
AllowOverride all
Require all granted
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/cerebrate.local_error.log
CustomLog /var/log/apache2/cerebrate.local_access.log combined
ServerSignature Off
</VirtualHost>

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
cerebrate (0.1~aa15ad7-1) unstable; urgency=medium
* Initial package
-- Cerebrate Developers <info@circl.lu> Thu, 11 Feb 2021 10:26:01 +0100

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

11
debian/config vendored Normal file
View File

@ -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

91
debian/config.php vendored Normal file
View File

@ -0,0 +1,91 @@
<?php
/*
* Local configuration file to provide any overrides to your app.php configuration.
* Copy and save this file as app_local.php and make changes as required.
* Note: It is not recommended to commit files with credentials such as app_local.php
* into source code version control.
*/
include '/etc/cerebrate/mysql.php';
return [
'Log' => [
'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
]
];

36
debian/control vendored Normal file
View File

@ -0,0 +1,36 @@
Source: cerebrate
Section: php
Priority: optional
Maintainer: Cerebrate Developers <info@circl.lu>
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.

21
debian/copyright vendored Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.

2
debian/files vendored Normal file
View File

@ -0,0 +1,2 @@
cerebrate_0.1~aa15ad7-1_amd64.buildinfo php optional
php-cerebrate_0.1~aa15ad7-1_all.deb php optional

10
debian/install vendored Executable file
View File

@ -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

View File

@ -0,0 +1,27 @@
From: Birger Schacht <schacht@cert.at>
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.

1
debian/patches/series vendored Normal file
View File

@ -0,0 +1 @@
0001-Load-config-from-etc-cerebrate.patch

30
debian/postinst vendored Normal file
View File

@ -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#

10
debian/postrm vendored Normal file
View File

@ -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#

10
debian/prerm vendored Normal file
View File

@ -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#

13
debian/rules vendored Executable file
View File

@ -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

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)