Commit 1889c815 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #602 in ZP/z-push from...

Merge pull request #602 in ZP/z-push from feature/ZP-1284-add-note-backend-operating-against to develop

* commit 'bdb83f2b':
  ZP-1284 Fix last few missed tabs. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Commit for cleanups - no functional changes. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Composer update. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Change tabs to spaces. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Fix problem with init on sink init with cache; we need to call Stat there and populate the structure.  Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 More variable cleanup. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Fix multiple variable issues with Changessink code.  Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Add ChangesSink code to the back end; style change on a few queries. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Fix missing "not deleted" in note lookup conditions. Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Revert config file to "as-shipped." Released under the Affero GNU General Public License (AGPL) version 3.
  ZP-1284 Stickynote backend initial code upload.
parents a69de7b5 bdb83f2b
The author of this backend is tickerguy (Karl Denninger)
Copyright 2017 Karl Denninger
Karl Denninger released this code as AGPLv3 here: ZP-1284 on Jira.z-hub.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License, version 3,
as published by the Free Software Foundation.
REQUIREMENTS:
1. php-pgsql module
2. An active Postgres server v9.0 or above (developed on 9.6.2; v9.6+
recommended) either on the local machine (preferred) or accessible via
the network. Note that if the connection is remote performance may
be impaired and security implications come into play; see Postgres'
documentation.
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
===============================================================
This backend does ZERO authentication of credentials. With Z-Push the
Logon process requires that ALL provided backends in the "combined" backend
succeed, so it is IMPERATIVE that AT LEAST one other back end be defined that
actually checks passwords. THIS IS NOT A BACKEND THAT CAN BE RUN STANDALONE
AS IT IMPLEMENTS NO SECURITY ON ITS OWN.
This is a design decision as not providing internal authentication removes
the need for a privileged (SUID root) "helper" application, OR hijacking
the IMAP server's authentication to check passwords. However, it thus relies
on at least one other backend (IMAP, CalDav or Carddav) to implement same.
===============================================================
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
INSTALL:
Create the postgres role account you intend to use ("stickynote" is what's
in the config files) and grant it login permission.
Edit the create-sticky-tables.sql file to make sure the proper permissions
are set in the GRANT statements (the role account you create and permit
to sign in), editing as required.
You must make sure that the connection parameters you intend to use for
Postgres are in accord with what you set up in the config.php file for
the hostname (or IP), along with the role and password (if required) for
access to the database. Note that if a password is not required setting
one will not hurt (it's ignored if not required for the given role and
connection.)
Once you have edited the create-sticky-tables.sql file, create the
database and schemas with the following command as the Postgres superuser
(usually psql):
createdb stickynote
psql stickynote <create-sticky-tables.sql
Then edit config.php (REQUIRED; it will NOT run without modification)
as necessary to fit and activate it in the combined backend.
<?php
/***********************************************
* File : config.php
* Project : Z-Push
* Descr : Stickynote backend configuration file
*
* Created : 8/29/2017
*
* Copyright 2017 Karl Denninger
*
* Karl Denninger releases this code under AGPLv3.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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/>.
*
* Consult LICENSE file for details
************************************************/
// ************************
// BackendStickyNote settings
// NOTE that StickyNote does NOT perform any actual login verification.
//
// YOU ARE WARNED THAT YOU MUST HAVE AT LEAST ONE OTHER BACK END DEFINED THAT
// DOES ACTUALLY CHECK PASSWORDS, OR YOU HAVE ***ZERO*** SECURITY ON THIS
// BACKEND! To enforce your reading this notice (and hopefully paying
// attention to it, the backend will NOT run unless you comment out the LAST
// parameter in this list.
//
// You must ALSO read and follow the REQUIREMENTS file to set up
// the roles and database schema required. Do that BEFORE configuring
// the below parameters (yes, they must match!)
//
// ************************
// The Postgresql server (IP number or name)
define('STICKYNOTE_SERVER', 'localhost');
// Postgresql server port (5432 is Postgres default)
define('STICKYNOTE_PORT', '5432');
// The database on the server
define('STICKYNOTE_DATABASE', 'stickynote');
// The username to use for the role
define('STICKYNOTE_USER', 'stickynote');
// The password to use for the role, if any
define('STICKYNOTE_PASSWORD', 'stickynote');
// If defined then a delete REALLY DELETES; if not it marks the item deleted
// in the database but DOES NOT physically remove it.
//define('STICKYNOTE_REALLYDELETE', 'true');
// You MUST comment this out or the code will not run
define('STICKYNOTE_MUSTNOTBESET', 'true');
create table note
(ordinal integer primary key, login text, domain text,
inserted timestamp with time zone default now(),
modified timestamp with time zone default now(),
deleted boolean default false, subject text, content text);
create table categories
(ordinal integer references note(ordinal) on update cascade
on delete cascade, tag text);
create index note_login on note using btree(login, domain);
create index tag_ordinal on categories using btree(ordinal);
create sequence ordinal;
grant all on note, categories, ordinal to stickynote;
This diff is collapsed.
......@@ -29,6 +29,7 @@ return array(
'BackendLDAP' => $baseDir . '/backend/ldap/ldap.php',
'BackendMaildir' => $baseDir . '/backend/maildir/maildir.php',
'BackendSearchLDAP' => $baseDir . '/backend/searchldap/searchldap.php',
'BackendStickyNote' => $baseDir . '/backend/stickynote/stickynote.php',
'BackendVCardDir' => $baseDir . '/backend/vcarddir/vcarddir.php',
'BackendZarafa' => $baseDir . '/backend/kopano/kopano.php',
'BaseException' => $baseDir . '/backend/kopano/mapi/class.baseexception.php',
......
......@@ -36,6 +36,7 @@ class ComposerStaticInit153a56a781a72686b71399955d98204f
'BackendLDAP' => __DIR__ . '/../..' . '/backend/ldap/ldap.php',
'BackendMaildir' => __DIR__ . '/../..' . '/backend/maildir/maildir.php',
'BackendSearchLDAP' => __DIR__ . '/../..' . '/backend/searchldap/searchldap.php',
'BackendStickyNote' => __DIR__ . '/../..' . '/backend/stickynote/stickynote.php',
'BackendVCardDir' => __DIR__ . '/../..' . '/backend/vcarddir/vcarddir.php',
'BackendZarafa' => __DIR__ . '/../..' . '/backend/kopano/kopano.php',
'BaseException' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.baseexception.php',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment