Viewsource

From CDOT Wiki
Revision as of 23:46, 14 April 2010 by JonathanDeni (talk | contribs)
Jump to: navigation, search

Viewsource New Release

Wednesday, February 3, 2010

Hello fellow community!

Well if you have been following my blogs you probably know that I was working on fixing some issues with Viewsource.

Well, the good news is I found out what the problem was! The bad news is you might have to fix it yourself, haha. (I will explain in a bit)

Firstly, I had to change my viewsource.conf up a bit so that it looked like this:


Addhandler cgi-script .cgi .py .pyc .pyo Options Indexes FollowSymLinks ExecCGI


That is to give the viewsource directory handlers for cgi and python and give it the Execute cgi option. I tested this out on a fedora 12 machine (india) and it worked, even with SeLinux. I thought it would probably work on the HongKong machine which I believe still has fedora 11 on it, sadly it did not.

I then had to turn on AVC denial messages because they were currently being suppressed due to saving space, I did this with the command: "semodule -DB"

I then issued the command: "ausearch -m avc -ts recent" to view the recent messages so I didn't waste time searching for them. To be honest, looking at AVC denial messages is like looking at the matrix, NO idea what it meant until I talked to Chris Tyler who helped me out a little. After frustrating myself, I eventually found out that the boolean "httpd_enable_cgi" had to be turned on (which it was in india), and since this is not my personal machine I left it alone. Which is what I was talking about before when I mentioned you might have to fix it for yourself, if you have errors simply use the command: "setsebool -P httpd_enable_cgi on" and you are set. I also placed a README in my package for this.

I put a DXRDROP directory in my home so that my good friend Alex Vlahopoulos, who is in charge of the repo, to come and pick it up when he is ready for it.

I suppose I should probably suppress the AVC messages again so I don't cause hongkong to eat up too much memory : semodule -B.

Now, assuming there are no more issues with the package, (which we will find out soon when dehydra and jshydra are ready), I just have to clean up my spec file to comply with fedora regulations and I will be set!

Until next time, friends! :P



Wednesday, January 27, 2010

Progress Report (Viewsource)

From my last post many of you might remember that the web application of viewsource was only displaying the python script code rather than executing it, this issue has been resolved.

CHANGES

httpd.conf

--- httpd1.conf 2010-01-25 23:07:00.000000000 -0500 +++ httpd.conf 2010-01-21 19:06:51.000000000 -0500 @@ -193,6 +193,8 @@ LoadModule cache_module modules/mod_cache.so LoadModule suexec_module modules/mod_suexec.so LoadModule disk_cache_module modules/mod_disk_cache.so +#LoadModule file_cache_module modules/mod_file_cache.so (Had to comment out, errors) +#LoadModule mem_cache_module modules/mod_mem_cache.so (errors, commented out) LoadModule cgi_module modules/mod_cgi.so

@@ -314,7 +316,7 @@

  1. http://httpd.apache.org/docs/2.2/mod/core.html#options
  2. for more information.

- Options Indexes FollowSymLinks + Options Indexes FollowSymLinks ExecCGI

  1. AllowOverride controls what directives may be placed in .htaccess files.

@@ -558,7 +560,7 @@

  1. The same rules about trailing "/" apply to ScriptAlias directives as to
  2. Alias.

-ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" +#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

  1. "/var/www/cgi-bin" should be changed to whatever your ScriptAliased

@@ -755,8 +757,8 @@

  1. Despite the name similarity, the following Add* directives have nothing
  2. to do with the FancyIndexing customization directives above.

-#AddEncoding x-compress .Z -#AddEncoding x-gzip .gz .tgz +AddEncoding x-compress .Z +AddEncoding x-gzip .gz .tgz

  1. If the AddEncoding directives above are commented-out, then you
  2. probably should define those extensions to indicate media types:

@@ -778,7 +780,7 @@

  1. To use CGI scripts outside of ScriptAliased directories:
  2. (You will also need to add "ExecCGI" to the "Options" directive.)

-#AddHandler cgi-script .cgi +AddHandler cgi-script .cgi (probably the issue, however viewsource.conf should have handled this and it wasn't)

  1. For files that include their own HTTP headers:

@@ -992,3 +994,24 @@

  1. ErrorLog logs/dummy-host.example.com-error_log
  2. CustomLog logs/dummy-host.example.com-access_log common

+ +# David Humphrey - enable gzip compression + + AddOutputFilterByType DEFLATE text/plain + AddOutputFilterByType DEFLATE text/html + AddOutputFilterByType DEFLATE text/xml + AddOutputFilterByType DEFLATE text/css + AddOutputFilterByType DEFLATE application/xml + AddOutputFilterByType DEFLATE application/xhtml+xml + AddOutputFilterByType DEFLATE application/rss+xml + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE application/x-javascript + + DeflateCompressionLevel 9 + + DeflateFilterNote Input instream + DeflateFilterNote Output outstream + DeflateFilterNote Ratio ratio + + LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate +

__

If anyone knows if I can simply add this stuff to viewsource.conf so that I don't have to deal with making a patch for httpd.conf and deal with permission it would be greatly appreciated.

CHANGES 2

Viewsource.conf

Addhandler cgi-script .cgi .py .pyc .pyo (bold added)

ISSUES LEFT

Web application only displays errors when "setenforce 0" if "setenforce 1" then a pop up comes up saying error but does not describe the error. I need to figure out how to fix the permissions within my spec file so that it will work while in "setenforce 1" mode. Any suggestions would be greatly appreciated.

Stay tuned for the soon to come release...



Thursday, December 3, 2009

Viewsource Modifications

viewsource-1.1-1.fc11.noarch.rpm

The first release of viewsource had a lot of bugs, I accidentally installed the files in the wrong directory, /usr/bin because I never really grasped the macros until recently. I realized that these files needed to be built in /var/www/html directory because they had to be accessed by the web browser. Another issue was we did not have a working version of dojo.

viewsource-1.2-1.fc11.noarch.rpm

Issues from the first release were addressed and the install directory looked like so:

%install rm -rf %{buildroot} install -d %{buildroot}/var/www/html/viewsource install -p viewsource.py %{buildroot}/var/www/html/viewsource install -p viewsource.config %{buildroot}/var/www/html/viewsource install -p index.html %{buildroot}/var/www/html/viewsource

likewise with the files section looking like:

%files /var/www/html/viewsource/viewsource.py /var/www/html/viewsource/viewsource.config /var/www/html/viewsource/index.html /var/www/html/viewsource/viewsource.pyo /var/www/html/viewsource/viewsource.pyc /etc/httpd/conf.d/viewsource.conf %defattr(-,root,root,-) %doc LICENSE

Notice viewsource.pyo and .pcy those are just results of the compiler. Next we needed to fix the dojo issue, so a patch was made which would add the dojo that google uses and has made available to the public. This fixed the dojo issue.

Other issues arose, now that we have the viewsource html doctument and can view it through a url we tried hitting the buttons at the bottom to see if they worked, all they did was grab python code and bring it to the screen it didnt actually run it.

Viewsource-1.3-1.fc11.noarch.rpm

We thought that we had to make a config file in httpd.conf to Addhandler cgi-script .cgi. It looked like so:

%install rm -rf %{buildroot} install -d %{buildroot}/var/www/html/viewsource install -p viewsource.py %{buildroot}/var/www/html/viewsource install -p viewsource.config %{buildroot}/var/www/html/viewsource install -p index.html %{buildroot}/var/www/html/viewsource install -d %{buildroot}/etc/httpd/conf.d install -p %{SOURCE1} %{buildroot}/etc/httpd/conf.d (this is the added apache conf file)

We thought this would work but for some reason the same thing happened, we still need to work this out. To be continued.



Tuesday, November 17, 2009

Packaging Viewsource

For this project each member of the class was assigned something to do. Boris Chao and Adam Hilts were to package Dehydra and Jshydra, I was to package Viewsource, and Alex was to make the repo. At the moment the other classmates tasks elude me.

I started out wondering where I even get a tar file for viewsource so I was told I had to go to the viewsource directory. Downloading all these files and then putting them into a tarfile would have been a lot of work and time but I decided to do it UNTIL I found that there was a viewsource.tgz in scotland. In the interest of time and work I decided to use this. I made my spec file, with a certain difficulty I might add.

Chris Tyler, my professor, told me through IRC "So you could tar these up and use that as Source0, have an empty %build section, and then custom-install files in the %install section (see the nled spec file if you need to see how to do that)."

So I used this tip to help make my spec file. I

My specfile can be found here.

The real issue I had was that my setup section looked like %setup -c -T when it should have looked like what I have there now. After this I had an issue that said certain files were installed but not unpackaged so all I had to do was add those files to the %files section.

After I finished this, I put my RPM into hongkong's /var/www/http directory and can be accessed here for the repo master to get.

Viewsource Rpm

That's all for now, cya later.