Monday, November 24, 2014

Getting Geppetto Version 4.3.0 working behind a proxy (a workaround)

Geppetto stands alone as the only Puppet IDE available as of this writing. Initially created by cloudsmith the IDE leverage Eclipse with custom components for developing modules and writing manifests. As of version 4.0 Geppetto has been maintained by Puppet Labs with one of the fixes being that it would work behind a proxy. The idea is that the Puppet components should obey proxy settings set within Eclipse and the reality is that his doesn't work. First of all there are sparse documentation on where and how to set the proxy within Eclipse. In case the next release fixes the bug that I filed regarding this issue, here is where you set the proxy setting within Eclipse;

-Click the Window tab and select Preferences which bring up a new window
-Select Network Connections in the left pane and change Action Provider drop down to Manual
-Edit the proxy info as necessary and hit apply then close window

What happens once the setting is crated is that certain functions does obey the proxy settings except for Java function calls within Eclipse. When an attempt is made to import a module from the forge the error log isn't clear on where it fails, but the log reveals a java process that is making a call to The workaround I have in place makes use of Proxifier to direct any traffic going out to to make two hops, the first through Proxifier which then redirects it to the corporate proxy address and port. Here are the steps and settings within Proxifier;

-Click the Profile tab and Select Proxy Server. Enter your corporate proxy's IP and port and select protocol and click OK.
-Click Profile tab again and this time select Proxification Rules. Create a new rule called Geppetto and under Target Hosts enter and change the Action drop down to the the Proxy Server you set up in the previous step.

Proxifier will not pipe all traffic that tries to reach to the corporate firewall. The con of this process is that it requires a second application to continuously run, but sure beats waiting for my bug to be resolved.

Wednesday, November 5, 2014

How to get proxy working for Ubuntu 14.04 without GUI (Works for all users and sudo)

By default proxy settings aren't enabled on Ubuntu servers and I've come to find that there are syntax changes in 14.04 that are drastically different compared to their last LTS (Long Term Support) release without it being very obvious. I've crawled the web and have come across various solutions, but those solutions only fix pieces like apt-get and what I wanted is something that works across all users and all calls even when using sudo. One of the things that I figured out was the when you elevate with sudo it doesn't necessarily mean that it will inherit user variables and that was a key discovery that ultimately pointed me on the right path. Without further ado here are the steps. Keep in mind that I prefer vim for a text editor and my examples will reflect that and you can use whichever editor you are comfortable with.

1.) Update your environmental variable

The first step is to create exports in your environmental variables and you can do that by editing /etc/environment

sudo vim /etc/environment

In the file you should add your exports below the PATH= line and the syntax will look like this for each type, http, https, and ftp. (In older versions of Ubuntu you could use all_proxy which I am not sure is still in use and haven't tested for). One you edit for the exports you need, save and exit.

export http_proxy=http://yourproxyserver:proxyserverport

2.) Create your proxy file

As I've mentioned that by default Ubuntu doesn't have proxy settings enabled and this means that there ins't a proxy setting file for apt-get either. You will need to create one and if you are new to Linux, the file be will automatically created when you open a text editor by the name you intend to use for the file.

sudo vim /etc/apt/apt.conf.d/30proxy

Keep in mind that the two digit number before the file name is arbitrary, it can be any number except for ones already in use. If you want to use a number and see what's there you can run this to see what other files are in that directory;

ls /etc/apt/apt.conf.d

Moving on to editing the file, the syntax is highly specific and I would suggest copying and pasting what I have written below. Short of that, pay close attention to double quotes (" ") and semicolons (;) and be sure to close every curly bracket used. Save the file once done and off to editing sudoers file next.

3.) Update sudoers file

The sudoers file needs to be edited to allow it to not only inherit, but to also keep the environmental variables being passed to it that you specified in /etc/environment. The best way to edit the sudoers file located /etc/sudoers is to use viduso. Keep in mind unlike vi or vim it doesn't require you to type "i" to input and to save you press ctrl+x, agree with "y" and take the default .tmp file that visudo wants to use to update the sudoers file. The section that you be editing is towards the top where it lists "Defaults". There you will add additional lines equal to each environmental variable and here is the syntax for adding the http_proxy example from before;

Defaults env_keep += http_proxy

Once you are done editing we will perform some tests to find out if sudo is inheriting the environmental variables. Run the following two commands and the output should be the same for both, if sudo is missing ant of the grep searches than try to reboot first and if still the same issue than double check your syntax in previous edits.

env | grep proxy

and sudo env | grep proxy

Finally, try to run sudo apt-get update or if you have ruby installed sudo gem update and see if the updates run successfully.