I am capturing information in a number of plugins (contact form 7, event espresso, etc) and I want to have that data saved into the CMS in an encrypted format. (Not hashing, which is one-way) I would then have the admin login and provide the password to decrypt that data (to be displayed in the CMS admin interface). How would I do this?
You can just use mcrypt_encrypt() while storing and mcrypt_decrypt() (with corresponding parameters) for reading data. It is really easy to use and straight forward - plus it is a battle-tested encryption package that has no (known) encryption flaws when used correctly.
Related
I want to store an API key for a service that the WordPress plugin I am developing needs to get information from an API. There are two options that I am aware of:
1) WordPress's options mechanism
2) Create a new database table
As far as I can tell, at the end of the day both are the same in that they are storing the information in a MySQL table and that data could potentially be accessed by another plugin.
Is there any way to store data so that it cannot be read by other plugins?
Is this even a concern I should be worried about?
A plugin can potentially dump your entire database and send it to it's authors through email, so one way or other to store it's pretty much useless.
This boils down essentially to 2 things, store it in an external database, where just your plugin have access to that or just do a two-way encode/decode with a salted key so your plugin it's the only thing can decrypt it.
If database access from other plugins is still a concern then store the API key within your PHP file. It won't be replaceable but you can take MySQL off the list.
On a personal opinion unless you are installing the worst and least known plugins on Wordpress you probably should be quite confident about the security of your website. To be fair probably caring about an API key to be stolen is the least concerning thing when you have someone that could access all your user details and passwords and potentially FTP access to your server.
The basic requirement of the site is to provide a plateform for blogging and single interface for managing various social network, emails, blog etc.
For blogging I am using .netblogengine. And facebook and gmail and blogger are currently being managed by signing in via their api.
I am using mysql and blog content is being saved in mysql column.
My first question is.. Suppose instead of saving blog content in mysql table column I just save the content in a txt file and save the name of the file in the column.. Doing so will reduce the size of table but will it also affect the performance?? I know I will not be able to search within the content but mysql size grows up quickly (50 mb with 8 users). The minimum number of users are atleast 30.
My second question.. I am thinking of asking all the acount (facebook, gmail etc) username and password and store them in the db. When even a user sign in all related account will be signed in using the saved data so that separate logging is not required. How ever username/password hacks are common headlines now days. I want to know how secure are the shared server environment in this regard? Will I be required to take some extra effort to secure these data or I can be sure that as long as my mysql logging details are safe all data are safe.
The short answer is saving text content like blog post in the database is going to be the best bet. Saving any attachments if there are any in separate files is a good idea though.
The data size on your disk is going to be similar either way, so there's no savings there. And since you would need to develop a unique naming convention for the text files you'd essentially be programming a partial database yourself; might as well leave it to the experts :)
In general, the table size getting to hundreds of megabytes is not going to hurt performance substantially. Assuming you've set up your indexes appropriately, the database engine will be able to seek directly to the data it needs.
Short answer on the account credentials, definitely don't save either username or especially password in unencrypted form in the database. It would be a question for the security experts on how to properly encrypt these to ensure security. https://security.stackexchange.com/
We are going to store some sensitive information about our customers in the db model res_partners.
However we don't want to store this information in a simple text field. We would prefer
some basic encrypting if possible for those fields. We do not want someone who
has access to the db to have access to these fields.
Is there a way we can get this done in openerp or postgres ?
Thank you,
Vishal Khialani
There is no such thing as "basic" encryption. Rot13 is not getting to get you anywhere here. If your data is sensitive enough to deserve protection, then you need to use state of the art cyphers such as Blowfish. I advise you give a good long look at Bruce Schneier's book Applied Cryptography
The easy (and insecure) way to achieve this is to overload the write and read methods of your model to encrypt before writing and decrypt after reading.
The tricky part is storing the encryption key. You could store it in a file on the computer running the OpenERP server (assuming the database is running on another server). This is still pretty weak, as the key will be available in clear on the server, but could still be useful if you don't trust your database server admin, but do trust you openerp server admin. It's still way easier to get the database server in a secure and trusted place, and if required to crypt offline copies of the database (such as backups).
If you want more security, you'll have to send the data encrypted to the client application, and let the decryption happen there, using a user-supplied key. I'm not enough knowledgeable of this part of openerp to say if it is easily feasible or not.
I need to use sensitive data with Drupal for a custom module to use. If I simply set them through the GUI, they will be stored unencrypted in the database. Anyone having access to it will have access to my sensitive data.
I can see two solutions for the moment:
Find a way to securely store those credentials into the database;
Put those sensitive data into a credentials_inc.php file, include it in settings.php to set variables my custom module could use and make sure that nobody else can read the file.
Which solution is best according to you? What do you recommend? Is there any other best option?
Best regards.
I would start off by using SecurePages module, to make sure the data entered somewhere along the way is not snooped.
Then to encrypt the information try using php's mcrypt with a short example of how to encrypt and decrypt.
Once the information is secured, you should have no problem storing the data in drupal's db structure. Also, an important note, you might check out hook_init() instead of trying to append something in settings.php. That is in general a bad practice.
The Encryption module provides an API that supports a few different encryption methods, including mcrypt (if you have it enabled).
The Encryption module is an excellent way to encrypt sensitive data within Drupal. However, this module does not provide adequate key management (it stores the encryption key within the Drupal database - like storing the keys to your house under your Welcome mat).
Along with Encrypt, you will also need an additional module like Townsend Security Key Connection which allows you to manage the encryption keys outside of the Drupal database in an encryption key manager (HSM, Cloud, VMware, etc.). Just remember - if you aren't properly managing your encryption keys, you aren't properly encrypting your data.
Full Disclosure: I work with Townsend Security on the Drupal team.
AES Encryption (http://drupal.org/project/aes) module comes with an easy developer API
$encrypted_data => aes_encrypt("mydata");
$decrypted_to_plain_text => aes_decrypt($encrypted_data);
I was thinking how one could integrate this with CCK, so data stored into the DB is encrypted just before storage, and decrypted on retrieval. The way I imagine the UI is to have a simple checkbox on the field setup page asking whether to store the data as encrypted.
This way, one could protect its database, in case hackers get a hold of it. Think of the recent email marketing website breaches, where the entire userbase was spammed.
http://www.reuters.com/article/2011/04/05/idUS100003661220110405