Monday, March 4, 2013

Open Source Project Prepackages Kim Dotcom’s Security

http://www.wired.com/wiredenterprise/2013/03/crypton


When you use a web application, you leave your data at the mercy of the company who runs it. Usually, this isn’t a problem, but not always. Last week, the web-based help desk application Zendesk was hacked, potentially exposing data from users of Twitter, Tumblr and Pinterest, which use the application for customer support.
Part of the problem is that a web app gathers so many eggs in one basket. If someone hacks a service provider, it can affect many different people.
But if each user’s information was encrypted so that only that user could see it — locking out even the service provider — then we could reduce the risk of putting our data in these centralized web services. That’s the aim of Crypton, a new open source project that hopes to make it easier for app developers to add this type of encryption to their applications.
It’s not unlike the approach used by Kim Dotcom’s new service Mega. When you upload a file to Mega, it’s encrypted and the key is stored by the service. But the key itself is encrypted by a passphrase that isn’t stored on Mega. That means even Mega’s staff can’t look at the data without your passphrase.
Mega is doing this to limit their liability in case of piracy, but the same principle could be applied to just about any service that stores user data.
Crypton was created by SpiderOak, a company that operates an online store service that’s similar to Box or Dropbox. CTO Alan Fairless says SpiderOak was a Mega-like security system well before the launch of the Kim Dotcom service. But SpiderOak isn’t using Crypton per se — though the plan is to move to the open source tool, according to CEO Ethan Oberman.
The goal of Crypton is to make it trivial for any developer to add encryption to an application — even if the developer doesn’t have extensive experience with such things. “We love using and creating cloud applications, and we’d prefer not to to wait another five years for awareness to progress among developers and meaningful privacy to be a standard feature in cloud apps,” the project’s site says.
Crypton’s developers emphasize that it isn’t ready for production yet, and hasn’t had a full security review. But it’s ready, it could give developers a common code base that has been reviewed by experts, freeing them from having to re-invent the wheel every time they build a new application.
Crypton isn’t alone in trying to give users more control over the data they store in web applications. Least Authority offers a tool for users who want to encrypt data they store in the Amazon S3 cloud. And Unhosted takes a very different approach: it makes it possible to separate a web application from web storage. For example, you could use a Google Docs-style word processor hosted on one server, but the data would be stored on a server run by a completely different company or organization. If someone hacked the word processor server, there would be no data for them to harvest.
But Crypton’s approach may be easier for end users because all the encryption is handled by the provider, and they wouldn’t have to worry about signing up for separate hosting accounts.
Unhosted founder and developer Michiel Jong says that he’s happy to see other open source projects trying to solve this problem, but has some reservations. “Average users are probably not ready to really memorize a passphrase,” he says. “They will often expect to have some sort of password recovery method.”
The project’s developers also points to some other hurdles, such as the difficulty of doing truly secure encryption in a web browser, which has plagued projects like Cryptocat. The team says it’s mostly concerned with making it harder for someone who gains access to a remote server to also tap the data stored there — not with protecting users from people trying to eavesdrop on their internet connections.
Another potential problem with a centralized solution like Crypton is that if a problem is found, then every app that uses it could be vulnerable. But this is true of any application relying on common open source libraries.
It’s still early days for Crypton and it’s not ready for live service just yet. But the idea is a welcome one.

How To Skip Certain Errors In MySQL Replication

http://www.howtoforge.com/how-to-skip-certain-errors-in-mysql-replication


MySQL replication is nice, however it can happen that it stops because of an error, and restoring a working replication can be hard - you need to set locks on the master to get a consistent MySQL dump, and during that time websites are not accessible. However there's a way to make the MySQL slave ignore certain errors using the slave-skip-errors directive.
I do not issue any guarantee that this will work for you!

1 Preliminary Note

Using slave-skip-errors you can make the replication slave ignore certain error codes (you can find the list of MySQL error codes here: Server Error Codes and Messages). However, you should use this with caution - it should be your last instrument trying to restore replication because it can make your slave inconsistent. You should first try one of these: How To Repair MySQL Replication or use the replicate-ignore-db or replicate-ignore-table statements in the slave's my.cnf file to skip replication for databases/database tables that cause replication to fail (if you don't need replication for these databases/database tables).

2 Using slave-skip-errors

Let's assume replication has stopped, and you are getting something like this on the slave's MySQL shell:
SHOW SLAVE STATUS \G
mysql> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 1.2.3.4
                  Master_User: slave_user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000024
          Read_Master_Log_Pos: 933201702
               Relay_Log_File: mysqld-relay-bin.000113
                Relay_Log_Pos: 63519994
        Relay_Master_Log_File: mysql-bin.000021
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB: mysql,information_schema,performance_schema,test
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1054
                   Last_Error: Error 'Unknown column 'tx_feuserbranch_agb' in 'field list'' on query. Default database: 'dbtest'.
Query: 'INSERT INTO fe_users (email,first_name,last_name,address,ip,city,country,telephone,fax,company,tx_feuserbranch_brancha,
tx_feuserbranch_customernr,tx_feuserbranch_agb,username,password,name,usergroup,disable,by_invitation,tx_srfeuserregister_password,
tstap,crdate,cruser_id,fe_cruser_id,pid) VALUES ('test333@example.com','John','Doe','test','55555','test','Deutschland','49111111111',
'','test','0','55','on','test333@example.com','xxxxxxxxxxxxxx','John Doe','0','1','0','','1361359747','1361359747','0','0','33')'
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 120460827
              Relay_Log_Space: 3500841420
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: Yes
           Master_SSL_CA_File: /etc/mysql/newcerts/ca-cert.pem
           Master_SSL_CA_Path:
              Master_SSL_Cert: /etc/mysql/newcerts/client-cert.pem
            Master_SSL_Cipher:
               Master_SSL_Key: /etc/mysql/newcerts/client-key.pem
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1054
               Last_SQL_Error: Last_Error: Error 'Unknown column 'tx_feuserbranch_agb' in 'field list'' on query. Default database: 'dbtest'.
Query: 'INSERT INTO fe_users (email,first_name,last_name,address,ip,city,country,telephone,fax,company,tx_feuserbranch_brancha,
tx_feuserbranch_customernr,tx_feuserbranch_agb,username,password,name,usergroup,disable,by_invitation,tx_srfeuserregister_password,
tstap,crdate,cruser_id,fe_cruser_id,pid) VALUES ('test333@example.com','John','Doe','test','55555','test','Deutschland','49111111111',
'','test','0','55','on','test333@example.com','xxxxxxxxxxxxxx','John Doe','0','1','0','','1361359747','1361359747','0','0','33')'
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
1 row in set (0.00 sec)

mysql>
As you can see in the Last_Errno row the error code of the error that caused replication to stop is 1054 (Unknown column '%s' in '%s'). If you want the MySQL slave to ignore such errors, just open your my.cnf (on Debian and Ubuntu it's /etc/mysql/my.cnf)...
vi /etc/mysql/my.cnf
... and add the line slave-skip-errors = 1054:
[...]
expire_logs_days        = 10
max_binlog_size         = 100M
server-id=2
replicate-ignore-db = mysql
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
replicate-ignore-db = test
slave-skip-errors = 1054
[...]
Restart MySQL afterwards:
/etc/init.d/mysql restart
Log into MySQL again...
mysql -u root -p
... and check the slave's status again - it should now be working again:
SHOW SLAVE STATUS \G
To make the slave ignore multiple error codes, just separate them by commas:
slave-skip-errors = 1062,1054
You can find the list of MySQL error codes here: Server Error Codes and Messages

3 Links

Friday, March 1, 2013

Howto: Syncing multiple calendars between Android and Zarafa

http://liquidat.wordpress.com/2013/02/27/howto-syncing-multiple-calendars-between-android-and-zarafa


Syncing multiple calendards between Zarafa (or any other groupware) and Android over ActiveSync is not possible due to limitation in Android. However, Zarafa can export calendars via CalDav, and there is an Android apps which adds CalDav calendars to the native calendar system.

Background: ActiveSync and CalDav

ActiveSync is the Microsoft way of syncing data, and is well established in the business ecosystems and thus also in groupware sync solutions like z-push. However, sharing multiple calendars via ActiveSync is not possible with Android without any special hacks. Additionally, ActiveSync is patented and copyrighted and as as result for each device which is able to sync via ActiveSync a fee is payed to Microsoft.
CalDav on the other hand is an open standard for syncing data, available to everyone for free. Unfortunately, it is not natively supported by Android although many groupware solutions provide support for it. But there are 3rd party apps to add CalDav support to Android.

Zarafa

The zarafa support for CalDav is quickly added by installing the zarafa-ical package. Here is for example the package description on a CentOS/Fedora system:

1$ rpm -qi zarafa-ical
2[...]
3The zarafa-ical package includes the Zarafa iCal/CalDAV gateway service
4to enable users to access their calendar using iCalendar (RFC 2445/5545)
5or CalDAV (RFC 4791) compliant clients. The iCal/CalDAV gateway service
6can be configured to listen for HTTP and HTTPS requests.

The configuration is done in /etc/zarafa/ical.cfg. The only really interesting part is if you want to enable ical over TLS or not. After everything is set up, try to reach the calendars of your system via web browser, the address should look similar to https://www.example.net:8443/caldav/testuser/Calendar. Afterwards, create some more calendars to verify later on that everything worked.
Many other groupware solutions offer CalDav support as well, the setup should be equal similar. The beauty in CalDav is that it does not contain any special magic.

Android

Once Zarafa is set up, you can configure the Android client. As mentioned before, Android does not provide native CalDav support, thus a 3rd party app is required. I made quite good experiences with the app CalDav sync beta. While the app does cost 2,55 €, the author does promise to open source the app once it has matured enough.
After the app was installed, you just enter user credentials and server URL and are ready to go:
Screenshot_2013-02-23-01-12-31
The synced calendars show up in the Android calendar overview natively, and can be re-used in any calendar app out there which accesses the default Android calendar store:
Screenshot_2013-02-23-01-13-18
That’s it, you can now sync all calendars you want, even carious task lists, to your Android mobile phone. It works pretty well for my own Zarafa setup, but we’ve also tested it at credativ with dedicated calendar server in a productive environment.

Conclusion

As a result, the sync between multiple calendars in Zarafa and Android does work now flawlessly. An additional bonus is that you are free to choose the colors of the calendars, in contrast to the ActiveSync implementation where you are stuck with a random color. :)
Besides, CalDav is also implemented in groupware fat clients like Thunderbird, KDE’s Kmail and Gnome’s Evolution, and you can now access all data via the same interface.