app.config encryption - app-config

I am devoloping an windows application in dot net.It's config file includes sensitive data such as sql pass..So When deploying application i want to give it as encrypted.
I googled arund and found one that Rsiprovider to encrypt the fields.
But encryption is machine specific and needs deploying config file in clear mode and after first run of program ,encryption is succeed on the runnig machine.
Is there a way to deploy config files as encrypted ?

Think about it - if you encrypt before shipping you will also have to provide a key somewhere. And then the problem shifts to how to hide that key...
The post-setup encryption is meant to hide the config from prying eyes.

This link has helped me make an encrypted config file. The problem with other solutions is that they are machine specific, so if you encrypt the .config, it cannot be de-crypted in another machine (not very feasible when you are deploying the app to many machines)

Related

Best practice to hide username/password from outside world for UI Automation

Resources: Selenium UI automation, Java, Bitbucket, GCP, Linux VM
I have automation project which is maintained in Bitbucket,
and I have VM Linux machine which is under Google Cloud.
My team wants me to hide the credentials which is currently
embedded in test script. And it seems like my user/pass are very where
on my local machine, Bitbucket, test scripts, Linux VM etc.
How can we hide the credentials here or at least limit the exposure ?
what I have done so far:
I removed credentials from test scripts and going to flush out
BitBucket repo so that old commits which are having credentials
we will be removed
Work around - I will create text/property file to maintain credentials
for little time and copied to Linux directory so I do not have user/pass
in my test scripts as well as BitBucket
I have found java utility classes of Base64 encrypt/decrypt, but No use of this.
I am still exploring Goolge Storage encrption/ KMS etc.
Please throw your ideas. Thanks
You said you have checked the Base 64 encryption option but did not find it useful. I would still say you can use Base 64 with below option:
Create an excel test data sheet or any property file.
While creating the Test script or filling the test data sheet you can manually encrypt Password (must have) and Username (if required) using Base 64.
This way in your test data sheet as well you will have the encrypted and protected credentials.
Next you can use the base 64 decoder utility and read the property file and get the required username and password and decrypt them using the utility and pass them to required web element.
This could be a solution you may want to work. Let me know if it suits you.

IIS Shared Configuration Webfarm - Error when dynamically updating bindings

First time posting a question so apologies for anything I'm doing wrong.
I have a webfarm of 4 IIS servers running windows server 2016 which uses an azure file storage account for its webfiles. It also save its shared configuration files to the same azure file storage account. This webfarm is then behind an azure load balancer.
Everything works fine, until part of the website code adds an IIS binding. This then causes all the servers to display the error below:
Could not load file or assembly 'EntityFramework,...etc" The parameter
is incorrect. (Image attached for full error).
The only way to resolve this error is to clear the asp.net temporary files from the C drive of all the servers and run IISRESET on each box.
Any ideas?
So this was a mystery but the following changes have resolved the issue. I'm not sure which combination has fixed it, but this might help someone who has a similar issue.
Recreate website in IIS using new App pool.
Removed individual IIS bindings and replaced with wildcard (we had a really old-school system before where we had 100s of binding, maybe one of these was corrupted).
Thanks for your help!

How to transfer live WordPress site to Wamp?

I've got a wordpress site that I have been using for a year now and it is hosted with HostGator. I have got a few tests i would like to run on the site, but I would like to test it offline using wamp first before making it LIVE.
The problem is previously I was always making changes to the LIVE site, usually at hours when I get little to no traffic. However, that has changed now and I do get traffic most hours through out a 24hr day.
So my problem is:
How do i download my existing website to laptop (wamp) and make those changes with new theme? (total newbie, sorry!)
I use Windows 7, so not sure what I need to be doing to get the site working like a live site offline.
Once I have implemented the new changes, what is the best way to upload the updated site back to the HostGator server without having any downtime or errors for site visitors?
Is there anything else I need to install or do inorder for this to work? I hope you can give me as much information as possible or any links to any guides or articles that explain how to do this.
Thanks so much for any help you can offer!!!
If you're using Hostgator, the process is simple:
Install XAMPP or WAMPP on your computer;
Go to your cPanel, backup and download your website;
Extract the backup to your computer, specially the homedir and the sql;
Go to your local environment, access http://localhost/phpmyadmin
Create a new database, doesn't matter the name but for the example let's call it "database";
Inside that database, import the one taken from the backup;
create a new folder inside your htdocs with the name of your website, "example.com";
Extract the content of the homedir there;
edit wp-config with the following data:
Host: 'localhost'
Username: 'root'
Password: blank
access http://localhost/example.com
You can check a good tutorial about the subject here.
About putting the site live, I recommend you to use a GIT repository, however it's understandable that might be a little complicated and perhaps too much work for what you're trying to achieve.
Try to move your files directly from your local to live environment using Filezilla or WinSCP, the drag and drop should replace the files live and the downtime should be minimal.
Instead of WAMP, you can always use VirtualBox to install CentOS or Ubuntu/Debian.
You can go one further and install either CentminMod to automate creating a LAMP, or a full panel like ISPConfig or Virtualmin.
That take care of create the environment.
Create a new account on the LAMP, using the same domain name.
You can FTP with Windows to get the files, but networking Windows and Linux is a pain. The better option is to use the command line (CLI) in the Linux VM to ftp the files from Hostgator to the VM. This guide will help with that process: http://www.tldp.org/HOWTO/FTP-3.html
Then your only concern is the MySQL database. And for this, you have several options.
For me, the easiest is to buy (or try!) SQLyog on Windows, and then copy the database from the Hostgator source to the localhost destination. Some mild networking is needed for Windows to see the Linux VM, but nothing as complex as file sharing (the FTP issue). SQLyog is far quicker than backing up the database, then restoring it -- especially since you can run into memory issues doing it this way. It fully depends on the size of the database.
The cheap/free backup>restore method is to use phpMyAdmin.
WordPress also has plugins, of varying cost, but you still have the possible backup>restore memory issue there as well.
When done, just copy it the other way, again using SQLyog and CLI ftp. You'll still have some downtime, but it will hopefully be minimal.
As a newbie, this probably seems like rocket science, but at least it gives you a good place to start. Welcome to the world of locally dev'ing sites!

Syncing a site with a local machine?

I do my web development and testing on my laptop running an installation of xampp - I upload things to my host, but I always go through cpanel's file manager to do it. I realize that there's definitely a better way to go about it, but I need to be pointed in the right direction to do so, also other tips on how to manage stuff would be appreciated.
FTP - can I keep my site's stuff synched to a local directory on htdocs so I can keep my site backed up on my computer yet update the site with whatever changes I make locally? Can anyone recommend a good client (preferably free) that I can use to do this?
Database stuff - how do I backup / sync databases in the same way? Ideally I'd like to do the same thing as with my files. Merge / upload whatever I've developed with a click or two. Is this possible? Is this wise?
Any help and advice would be appreciated. :)
I do my development in Eclipse which allows me to combine development and sync via FTP in one environment. It will also tell you if a file changed on the server and allow you to decide whether to override it or not. You can also disable the syncing of certain types of files with pattern matching and use other technologies like WebDAV or SSH to sync (if supported by your host of course).

What's the benefit of deploying a war file instead of an exploded directory?

I'm configuring an installer for our product which, up until now, was distributed as a war file, usually on tomcat. Once tomcat has exploded the directory, the user has to open a properties file and set their database connection information. I'd like the installer to do this (we're using install4j) but there doesn't seem to be a built-in way to modify a text file inside a war file. I could just have the installer deploy the app as an exploded directory, which would save me the trouble here, but what do I lose by deploying like that instead of deploying the war?
It might work better to set up the database connection as a JNDI Datasource, rather than hand-editing a properties file inside the webapp/ directory. This is especially important if you want to allow users to re-deploy the application from the .WAR archive without overwriting their local configuration changes.
Of course, the JNDI setup isn't going to be trivially accomplished through the installer, either, since the mechanism used varies from app server to app server. However, any competent Java application server administrator should know how to configure a named datasource. Furthermore, by delegating responsibility to the app server, you allow your users to take advantage of connection pooling, clustering, and any other features provided by the datasource implementation bundled with their application server of choice.
Not much I would think - perhaps a bit of disk space, but if that's not a problem you'd be fine. Have you thought of having the installer generate the properties file and using a ZIP library (.WAR is really a .ZIP - rename it to a .ZIP and see what you get :) ) to replace or add it in?

Resources