update ffsync 1.5

This commit is contained in:
Adrien Beudin
2014-11-15 16:24:32 +00:00
parent 363f126eeb
commit 0d7e8fb9ae
19 changed files with 771 additions and 178 deletions

12
conf/ffsync.ini Normal file
View File

@@ -0,0 +1,12 @@
[uwsgi]
chmod-socket = 660
master = true
enable-threads = true
workers = 2
no-orphans = true
log-date = true
uid = ffsync
gid = ffsync
pythonpath = /opt/yunohost/ffsync/local/lib/python2.7/site-packages
wsgi-file = /opt/yunohost/ffsync/syncserver.wsgi
vacuum = true

View File

@@ -1,84 +0,0 @@
-- MySQL dump 10.13 Distrib 5.5.31, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: ffsync
-- ------------------------------------------------------
-- Server version 5.5.31-0+wheezy1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`username` varchar(255) NOT NULL DEFAULT '',
`md5` varchar(124) DEFAULT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `wbo`
--
DROP TABLE IF EXISTS `wbo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wbo` (
`username` varchar(100) NOT NULL DEFAULT '',
`id` varchar(65) NOT NULL DEFAULT '',
`collection` varchar(100) NOT NULL DEFAULT '',
`parentid` varchar(65) DEFAULT NULL,
`predecessorid` int(11) DEFAULT NULL,
`modified` double DEFAULT NULL,
`sortindex` int(11) DEFAULT NULL,
`payload` text,
`payload_size` int(11) DEFAULT NULL,
`ttl` int(11) DEFAULT NULL,
PRIMARY KEY (`username`,`collection`,`id`),
KEY `parentindex` (`username`,`parentid`),
KEY `predecessorindex` (`username`,`predecessorid`),
KEY `modifiedindex` (`username`,`collection`,`modified`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `wbo`
--
LOCK TABLES `wbo` WRITE;
/*!40000 ALTER TABLE `wbo` DISABLE KEYS */;
/*!40000 ALTER TABLE `wbo` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2013-12-12 11:27:30

View File

@@ -1,16 +1,14 @@
location PATHTOCHANGE {
alias ALIASTOCHANGE;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.php;
try_files $uri $uri/ /index.php?$args;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
try_files $uri @ffsync;
}
location @ffsync {
uwsgi_pass unix:///run/uwsgi/app/ffsync/socket;
include uwsgi_params;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View File

@@ -1,26 +0,0 @@
<?php
// you can disable registration to the firefox sync server here,
// by setting ENABLE_REGISTER to false
//
define("ENABLE_REGISTER", true);
// firefox sync server url, this should end with a /
// e.g. https://YourDomain.de/Folder_und_ggf_/index.php/
//
define("FSYNCMS_ROOT", "https://URLFFSYNC/index.php/");
// Database connection credentials
//
define("SQLITE_FILE", "weave_db");
define("MYSQL_ENABLE", true);
define("MYSQL_HOST", "localhost");
define("MYSQL_DB", "yunobase");
define("MYSQL_USER", "yunouser");
define("MYSQL_PASSWORD", "yunopass");
// Use bcrypt instead of MD5 for password hashing
define("BCRYPT", true);
define("BCRYPT_ROUNDS", 12);
?>

35
conf/syncserver.ini Normal file
View File

@@ -0,0 +1,35 @@
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000
[app:main]
use = egg:syncserver
[syncserver]
# This must be edited to point to the public URL of your server,
# i.e. the URL as seen by Firefox.
public_url = https://ynhbaseurl/
# This defines the database in which to store all server data.
sqluri = sqlite:////opt/yunohost/ffsync/syncserver.db
# This is a secret key used for signing authentication tokens.
# It should be long and randomly-generated.
# The following command will give a suitable value on *nix systems:
#
# head -c 20 /dev/urandom | sha1sum
#
# If not specified then the server will generate a temporary one at startup.
#secret = INSERT_SECRET_KEY_HERE
# Set this to "false" to disable new-user signups on the server.
# Only request by existing accounts will be honoured.
# allow_new_users = false
# Uncomment and edit the following to use a local BrowserID verifier
# rather than posing assertions to the mozilla-hosted verifier.
# Audiences should be set to your public_url without a trailing slash.
#[browserid]
#backend = tokenserver.verifiers.LocalVerifier
#audiences = https://localhost:5000

View File

@@ -1,39 +0,0 @@
--- weave_storage.php 2013-12-16 13:44:24.252240725 +0000
+++ weave_storage.php.new 2013-12-16 13:43:15.480260767 +0000
@@ -720,6 +720,36 @@
function create_user($username, $password)
{
+ $mail = $auth_user;
+ $dn = "ou=users,dc=yunohost,dc=org";
+ $filter = "(&(objectclass=inetOrgPerson)(mail=".$mail."))";
+ $justthese = array("uid");
+ // connect to ldap server
+ $ldapconn = ldap_connect("localhost")
+ or die("Could not connect to LDAP server.");
+
+ ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
+ ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
+
+ if ($ldapconn) {
+ $ldapbind = @ldap_bind($ldapconn);
+ if (! $ldapbind) {
+ log_error("create_user:" . $exception->getMessage());
+ error_log("create_user:" . $exception->getMessage());
+ return 0;
+ }
+ else {
+ $sr = ldap_search($ldapconn, $dn, $filter, $justthese);
+ $info = ldap_get_entries($ldapconn, $sr);
+ if ( ! $info["count"]) {
+ log_error("create_user:" . $exception->getMessage());
+ error_log("create_user:" . $exception->getMessage());
+ return 0;
+ }
+ }
+ @ldap_unbind($ldapconn);
+ }
+
log_error("Create User - Username: ".$username."|".$password);
try