Hudson trigger builds remotely gives a forbidden 403 error - unix

I have a shell script on the same machine that hudson is deployed on and upon executing it, it calls wget on a hudson build trigger URL. Since its the same machine, I access it as http://localhost:8080/hudson/job/jobname/build?token=sometoken
Typically, this is supposed to trigger a build on the project. But I get a 403 forbidden when I do this. Anybody has any idea why? I have tried this using a browser and it triggers the build, but via the command line it doesn't seem to work. Any ideas?

I figured it out. Apparently if Hudson is protected using a security mechanism, you need to authenticate the build requests. See this wiki link for more details http://wiki.hudson-ci.org/display/HUDSON/Authenticating+scripted+clients
Since I used the auth mechanism that was shipped with Hudson, calling the build scripts invovled. I used
wget --auth-no-challenge --http-user=user --http-password=password http://hudson.yourcompany.com/job/your_job/build?token=TOKEN
to run the build script.

If you use matrix-based security, you can set Job Read and Job Build permission to Anonymous, so you don't need a user and password in your post-commit hook.
Another tip is to turn on polling without setting a date and use this URL:
http://hudson.yourcompany.com/job/your_job/polling?token=TOKEN
Your job will be build just if there were svn changes (no need to build when changing other projects, creating tags etc.)

I got the same errors. In my case I had to add the Jenkins-Crumb header to the HttpPost object to make it work.
post.addHeader("Jenkins-Crumb","crumb value");
To find the crumb value for your Jenkins instance, install Firebug or any plugin n your browser which will help you see the request headers. Go to your job page at http://server_name:port/jenkins/job/job_name
Press F12 to activate Firebug, got to Net tab. Click Enable Auto - refresh link at top right of your page. Now every 5 seconds you should see an Ajax Request being made to fetch the buildHistory. In that request, examine the headers. There should be a header for Jenkins-Crumb, it can also be under name .crumb depending the Jenkins version you are using. You it in your Java code.

Related

Jmeter Performance test on ASP.net form losing session

Hi guys i have a very strange problem. I am tasked to conduct several performance tests on an old Webpage (2004 - something).
The module that is under test is created with ASP.net forms.
Im using Jmeter for the task.
I have used Chrome extention (Blazemeter) to generate the starting script.
But a very strange problem occurs all other pages of the form are fine and dandy... except a page for file upload where upon trying to proceed(Make a POST request) it loses its session and you are redirected to another screen with generic- Would you like to continue last session type of messages appear.
In order to try to debug the problem i wrote a simple Post request on IntelliJ and everything works fine when executed.
I then returned to Jmeter and punched in everything identical to the script and i still get the same problem.
I then decided to try the Jmeter recording proxy ( in case the blazemeter is faulty and assigns some values incorectly) And while i was manualy browsing the form the problem Appears! - when i click on proceed on that specific upload form with the jmeter proxy turned on, it loses session and it shows the "continue last session screen". And i am baffled as to how a simple proxy that records could mess up the sessions. I tried it with a normal proxy (not the Jmeter one) and everything works. So it seems that the problem is in Jmeter or some settings.
Have you guys ever encountered such a problem , or have some insight as to what might cause such behavior. Additional info:
I have worked on ASP.net form before and i am extracting __VIEWSTATE __EVENTARGUMENT and a couple of other hidden variables from the previous response and passing them to the request.
I am using the Multipart/form-data for the upload file module POST and passing the file properly.
As a standart i am using KeepAlive and Follow Redirects but i have tried Redirect Automatically or all of the above switched off.
There is a Cookie Manager set up on Test Plan level and it is working in HC4 - compatibility(tried all others too) based on the requests its working properly.
Cache Manager to 5000 elements.
Certificates seem to be properly imported (for the Jmeter proxy).
I am at this point baffled as to why Jmeter refuses to act properly and i would be very gratefull if someone could help me.
Hi guys il just post an update since i found a work around. So if i record everything with blazemeter (since jmeter proxy doesnt allow me) and after on the upload step i delete the steps and just write a manual request in the body with multipart/form tick turned off and just write the multipart stuff in the headers it seems to work. I still have no idea why it behaves this way.

plone add-on collective.sendaspdf: login required for downloading page

I'm using collective.sendaspdf for pdf download of plone pages, but it asks users to login whene they download a public content.
This appears strange as it happens just in the production server, not in the development server (the only difference seems that the latter is started in foreground mode).
Of course I can't assign particular permissions on objects to anonymous users, so I guess the problem is somewhere else
thanks to Jean's suggestion, i enabled the verbose security and the error is "Unauthorized: You are not allowed to access '##at_base_edit_view' in this context"
This looks strange to me as the page is the view of my content-type archetype-based, and it is published so it is visible to anonymous users. I repeat also that I have the development server with the same software installed where the authorization is correctly given, i.e. the page can be downloaded by anyone without login...what changes is the network configuration (I have an apache that performs some url rewriting in front of my zope server, but this just affects the path of the plone site to be hidden)
I wonder if I can manage to correct this just through the sendaspdf configuration. I don't know which additional info I could provide about the environment/configuration. I'm running Plone 4.0.4 + collective.sendaspdf 2.0
Ok, the problem was due to a bug in how collective.sendaspdf handles archetype-based content types, it's possible to workaround it by replacing the code:
view_name = context_type.getProperty('immediate_view')
with
view_name = context_type.getProperty('default_view')
in the method get_page_source of base.py, or by waiting the next release of the product.

Debugging with Response.Write in classic ASP

I am trying to debug some code using Response.Write, but when I run the code it skips over that statement and errors out at some point further in the code.
How can I get my Response.Write statements to show without the other errors coming up?
I quite frequently use Response.End when I have to see a status in a certain place on a page.
We utilize Visual Studio 2008 to debug classic asp pages. You can attach to the IIS process and "step through" the page. Its very sweet. Here are the steps:
Get latest of the classic ASP from source control.
Install IIS (if not already). FYI... I am using IIS 5.1.
Create a virtual directory called "classicDebug" pointing to your local directory (C:\Websites\ClassicWebSite).
View the virtual directory properties, Virtual Directory tab.
Enable the "Script source access" checkbox.
Configuration button, Options tab - check everything.
Debugging tab - check everything.
7a. In the ASP.NET tab, select 2.x
Load up (not run or debug or F5) the website in VS.NET 2008.
Edit your global.asa accordingly (data sources, and paths).
Find the .asp page you want to "step through" and set a break point at the top (or somewhere).
Open IE, and navigate to your page.
Go back to VS.NET and select Debug -> Attach to Process
Check "show processes from all users" and select the process. For me (IIS 5.1), the process name is dllhost.exe running with the IWAM_COMPUTERNAME account w/type "Script, T-SQL, Managed, x86".
Visit your page using IE... VS.NET should break.
Comment out the line which gives the error and see what the respnse.write is displaying is the only thing reasonable.
Don't use the on error resume next while you are developing your pages. You have to make sure that you building your pages correctly and that your are producing correct code. You wont see any errors if you use on error resume next.
on error resume next should only be used, in my opinion, in database actions and in delivered (non-developning) code. In that case you should use the
if Err.Number <> 0 then
construct to test any errors. You simply cannot do that after every line in asp if you have put the on error resume next statement at the top of your code, but it certainly makes sence in database handling code.
You will have to use "on error resume next" statement on top of your ASP page. This will solve your problem when an error occurs it will move to next line rather than throwing an error.
You can check this link http://www.powerasp.com/content/new/on-error-resume-next.asp for reference.
Happy Coding
Try a Response.Flush after your debugging statments, or setting Response.Buffer to false.
This might help as an alternative to response.write.
I put together this ASP include class which works with Firebug+FirePHP. It allows you to log values (including strings, multi-dimensional arrays and even objects created with json.asp) to the firebug console and view ASP's built in collection objects which can help (particularly with Ajax where you can't output debug data without breaking the json response.) Ajax script load times and errors are automatically logged for quick viewing.
https://github.com/dmeagor/ClassicASP-FirePHP
Just include the file and use log(somevalue) to send formatted variables to the firebug console.
Released under MIT open source license
Speaking of alternate options, from David Meagor post, you can also write traces to a file. Here is an example of how to write to files: https://web.archive.org/web/20210506122630/http://www.4guysfromrolla.com/webtech/040699-1.shtml
If you want, you can even put the trace subroutines in an include file and use that in all your pages when you need it.
Another solution that we are using is to put the tracing methods in a .Net assembly, register it as a COM then call it using CreateObject.
These options will let you keep your traces in a file that you can review later and share with other developers.
I personally use a mix of these approaches: I review log files, use breakpoints and even place from time to time a Response.Write.
One other thing: activate and review the IIS logs: they will often tell you on what line your page broke. You can read here how to enable or disable logs for classic ASP: https://technet.microsoft.com/en-us/library/hh831387.aspx.

AS3: Security sandbox violation

I want to go live with my site.
...but I need help with a security violation I am incurring.
I've seen various threads on this forum regarding a crossdomain.xml file to include and link to, but I don't get it... no matter what I try I still end up with the same result. You'll note below that it is not recommended to use crossdomain hacks.
FWIW, this only happens when I export a release build... I can load the php data w/out an issue in my debug/developing phase locally in Flex.
What gives? When I make a PHP based request for data I always get this error popping up:
Error #2044: Unhandled securityError:.
text=Error #2048: Security sandbox
violation:
http://alubow.com/jml_testing/viewable/alubow_project.swf
cannot load data from
http://www.alubow.com/jml_testing/foldergrab.php?ipath=assets/bitmap/portrait_thumbs/&tpath=assets/bitmap/portrait_imgs/.
at utils.php::DirectoryReader() at
alubow_project/newScroller() at
alubow_project/mainClickOut()
Is there code I need to add to get this to work? Do I need to configure the server I am using?
I will need to go live with this site soon and these errors I am getting both locally and serverside (via a browser) are unacceptable.
COULD THIS BE A PROBLEM WITH THE FLASH PLAYER I HAVE INSTALLED?
I have the debugger version of flash player 10.
jml
The problem is with the www prefix. I guess you are trying to load a page with out the www subdomain and the URL you are looking for does have that prefix.
Now, what you need to do is one of the following:
change the request url
add both www.yourdomain.com And yourdomain.com to the crossdomain.xml
call the url dymanicaly. this is the best solution but needs some more work. you can get it done using ExternalInterface and connection to JS here. OR you can use the BrowserManager.
Enjoy!
It may be because your app is requesting from www.alubow.com when hosted from alubow.com, which triggers a request for http://www.alubow.com/crossdomain.xml, which doesn't exist. You could refer to your app as www.alubow.com/jml_testing/viewable/alubow_project.swf and avoid the error.
Alternately, you could add a crossdomain.xml file to www.alubow.com.
I know this is weird but for local files loaded through the flash player you probably just need to hit this page. Look near the top right for something that looks like an example image. It's actually a Flex application. Click successive tabs until you read the Global Security Settings panel (currently 3rd from the left, with an image of a globe and padlock). Select the "Edit locations" menu, and choose "Add location". You can then add your swf or your folder of swf's into the whitelist and they'll be able to access outside resources magically.

How to Test an AJAX Installation

Is there a simple and foolproof way we can test an AJAX installation? We have a problem in calling a webscript using AJAX form a JS file. The error is 'ServiceLib' is not defined. The error gets a few hits on Google.
We've added some AJAX functionality to a customer's app. This works fine here in the office on dev machines and on our IIS Server, it works fine on the customer's test web site, but when we put the app on the live site, the webscript calls fail.
The customer installed AJAX on their live server a few days ago. We've verified that the service lib files are there and in the right places.
We've already spent hours on this with no solution and still do not know for sure whether there is something wrong with our code, or something is wrong on their server, or for that matter, whether AJAX is even correctly installed. Part of our problem is that we have no access to their live server, so there is not much we can do other than change lines in our own code, give the app files to our contact there, and see what happens. The contact knows less than we do, so we are working blind. A strange situation, I know, but there is beaurocracy involved.
Many thanks
Mike Thomas
Firebug might help - if you can get someone at the far end to install it, it may be able to give you an insight into what is going on with the ajax requests via its console, which logs and gives you the ability to view the return data of all ajax requests.
I'm thinking...
There are three parts to the process:
1) The client-side javascript logic in the browser sends the HTTP request to the server.
2) The server-side ASP.NET page processes it and responds.
3) The client-side logic receives the response and updates the web page, or whatever.
Swap out each part with something simpler and diagnostic to see where in the pipeline the break is.
For example, create a diagnostic webpage that's a substitue for #1 that calls the server-side page directly.
If that seems to work, create a different server-side ASP.NET page that's very simple, just logs something, to prove that the real #1 does what your diagnostic #1 did.
Ya know, your standard debugging binary search...

Resources