XMLRPC - TRAC authentication in 1.9.4

Ask community to help.

Moderators: Amaradana, TurboPT, TL Developers

Locked
wberry
TestLink user
Posts: 11
Joined: Wed May 25, 2011 11:53 am

XMLRPC - TRAC authentication in 1.9.4

Post by wberry »

Hi
For v1.9.3 I used a workaround found online to use a registered user ID on TRAC as anonymous access on our TRAC BTS is forbidden.
The implementation for BTS access on v1.9.4 has changed and I'm not sure how to send username and password in the XMLRPC connection.
Please could you suggest a method I can use to add this?
Thanks,
Wayne.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by fman »

have you tried and you have found errors ?
when defining issuetracker you have a link to click that will provide a configuration example , do you have got it ?
wberry
TestLink user
Posts: 11
Joined: Wed May 25, 2011 11:53 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by wberry »

Yes that all works. The connect is made succesfully. My issue is that testlink doesn't send any user info (username and password) when accessing TRAC.
Our TRAC system doesn't allow access to the system for anonymous users.
I need to find out how to use XMLRPC from TestLink with a valid username and password for TRAC. If not my connection is forbidden.

Thanks,
Wayne.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by fman »

unfortunatelly you are not being clear on your explanation.
You need to provide:
"<issuetracker>\n" .
"<username>USERNAME</username>\n" .
"<password>PASSWORD</password>\n" .
"<uribase>'http://<YourTracServer>/<YourTracProjectName</uribase>\n" .
"</issuetracker>\n";

as you see user and password ARE REQUIRED.
wberry
TestLink user
Posts: 11
Joined: Wed May 25, 2011 11:53 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by wberry »

My set up on testlink is this:
<issuetracker>
<username>testlink</username>
<password>testlink</password>
<uribase>http://serverone/trac/tracv12.3</uribase>
</issuetracker>

The result when I try to access the database on TRAC is this:
2012-09-10 14:11:14,370 Trac[web_ui] DEBUG: RPC incoming request of content type 'text/xml' dispatched to <tracrpc.xml_rpc.XmlRpcProtocol object at 0x7f20fe2a99d0>
2012-09-10 14:11:14,370 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'anonymous' (***WB the call should be from an authenticated user "testlink"***)
2012-09-10 14:11:14,371 Trac[xml_rpc] DEBUG: RPC(xml) call by 'anonymous', method 'ticket.get' with args: ('2000',)
2012-09-10 14:11:14,371 Trac[perm] DEBUG: No policy allowed anonymous performing XML_RPC on None
2012-09-10 14:11:14,371 Trac[web_ui] ERROR: RPC(XML-RPC) Error

I cant see any authentication being sent and so the call is marked as anonymous. I want it to use the username and password but these dont seem to be being sent.

I hope this helps clarify the issue I have.

Regards,
Wayne.
wberry
TestLink user
Posts: 11
Joined: Wed May 25, 2011 11:53 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by wberry »

In tracxmlrpcInterface.class.php

The comments contain this information:
* In addition, you should add the permission of 'TICKET_VIEW' and 'XML_RPC'
* to the user 'anonymous' in Trac.

If these are added to the anonymous user in Trac then user credentials are not required. What I'm trying to get is an authenticated user on Trac to access tickets via XMLPRC. Therefore the credentials which in my case are "testlink" : "testlink" need to be sent.
Even though there is a username and password field in the configuration settings It doesn't look like these are being used.

Thanks,
Wayne.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by fman »

this start to seem an issue => open on mantis
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by fman »

If you give a look to implementation you will see this

function createAPIClient()
{
try
{
// Create a new connection with the TRAC-server.
$this->APIClient = new xmlrpc_client($this->cfg->urixmlrpc);

// Set the credentials to use to log in.
$this->APIClient->setCredentials($this->cfg->user, $this->cfg->password);

I have to digged to deep by IMHO this means we are using authentication.
Do you have tried to connect using user='NONO' password='ITHASTOFAIL' and everything worked anyway ?
wberry
TestLink user
Posts: 11
Joined: Wed May 25, 2011 11:53 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by wberry »

I appreciate your help on this issue. If you remove permissions on Trac for anonymous for TICKET_VIEW and XML_RPC its not possible to access the database.

If TICKET_VIEW and XML_RPC are enabled for anonymous on Trac any combination of USERNAME and PASSWORD can be used in the config and it will work.

For Testlink v1.9.3 I implemented the change suggested here: http://51elliot.blogspot.co.uk/2009/01/ ... l-rpc.html
Which worked.

I've tried changing the USERNAME and PASSWORD and the Trac log shows this:
2012-09-11 10:43:56,833 Trac[web_ui] DEBUG: RPC incoming request of content type 'text/xml' dispatched to <tracrpc.xml_rpc.XmlRpcProtocol object at 0x7f7767ee6a50>
2012-09-11 10:43:56,834 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'anonymous'
2012-09-11 10:43:56,834 Trac[xml_rpc] DEBUG: RPC(xml) call by 'anonymous', method 'ticket.get' with args: ('2001',)
2012-09-11 10:43:56,834 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'anonymous' ticket.get
2012-09-11 10:43:56,843 Trac[blackmagic] DEBUG: Ticket permissions GROUP_SOFTWARE type core_defect
2012-09-11 10:43:56,844 Trac[perm] DEBUG: No policy allowed anonymous performing GROUP_SOFTWARE on <Resource u'ticket:2001'>
2012-09-11 10:43:56,844 Trac[blackmagic] DEBUG: User anonymous doesn't have permission GROUP_SOFTWARE
2012-09-11 10:43:56,844 Trac[perm] DEBUG: BlackMagicTicketTweaks denies anonymous performing TICKET_VIEW on <Resource u'ticket:2001'>
2012-09-11 10:43:56,844 Trac[web_ui] ERROR: RPC(XML-RPC) Error

It appears that all RPC calls are made as anonymous.

On my modified v1.9.3 I get this in the Trac log:

2012-09-11 10:53:09,657 Trac[main] DEBUG: Dispatching <Request "POST '/login/xmlrpc'">
2012-09-11 10:53:09,659 Trac[api] WARNING: Unable to find repository '(default)' for synchronization
2012-09-11 10:53:09,659 Trac[session] DEBUG: Retrieving session for ID 'testlink'
2012-09-11 10:53:09,661 Trac[perm] DEBUG: No policy allowed testlink performing TICKET_ADMIN on None
2012-09-11 10:53:09,661 Trac[web_ui] DEBUG: RPC incoming request of content type 'text/xml' dispatched to <tracrpc.xml_rpc.XmlRpcProtocol object at 0x7f0c2e95acd0>
2012-09-11 10:53:09,661 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'testlink'
2012-09-11 10:53:09,662 Trac[xml_rpc] DEBUG: RPC(xml) call by 'testlink', method 'ticket.get' with args: ('2000',)
2012-09-11 10:53:09,662 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'testlink' ticket.get
2012-09-11 10:53:09,667 Trac[blackmagic] DEBUG: Ticket permissions None type test_request
2012-09-11 10:53:09,668 Trac[blackmagic] DEBUG: Perm isn't set for ticket type test_request
2012-09-11 10:53:09,668 Trac[xml_rpc] DEBUG: RPC(xml) 'ticket.get' result: [2000, datetime.datetime(2012, 7, 27, 12, 17, 39, 993887, tzinfo=<FixedOffset "UTC" 0:00:00>), datetime.datetime(2012, 8, 2, 23, 19, 26, 168744, tzinfo=<FixedOffset "UTC" 0:00:00>), {'changetime': datetime.datetime(2012, 8, 2, 23, 19, 26, 168744, tzinfo=<FixedOffset "UTC" 0:00:00>)

It looks like the suggested mod for v1.9.3 I applied is running a login step.

Thanks,
Wayne.
seajays
TestLink user
Posts: 2
Joined: Thu Sep 06, 2012 5:36 pm

Re: XMLRPC - TRAC authentication in 1.9.4

Post by seajays »

We can't get TRAC integration to work with 1.9.4 at all just now.

We have configured the new Issue Tracker Management, and included the correct rights (XML_RPC and TICKET_VIEW - even tried with admin rights) - tried it with a specific username and password, and also with anonymous like this:

Code: Select all

<issuetracker>
<username>anonymous</username>
<password></password>
<uribase>http://servername:81/iws2</uribase>
</issuetracker>
We simply get BugID does not exist error and the following is logged in the TRAC logs:

Code: Select all

2012-09-13 10:17:16,562 Trac[main] DEBUG: Dispatching <Request "POST u'/xmlrpc'">
2012-09-13 10:17:16,562 Trac[filter] INFO: HTTPAuthFilter: No/bad authentication data given, returing 403
Anyone any ideas on how to get this working (was OK on 1.9.3 in the "old" way).
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by fman »

I'm going to try to provide help, but using the ticket:
http://mantis.testlink.org/view.php?id=5219

please stop posting here, OK ?
brannonp
TestLink user
Posts: 1
Joined: Sat Apr 06, 2013 10:07 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by brannonp »

I'm sorry if this is not the right place to post this question; but I'm new to all this and just need help. I'm able to connect to the TRAC as anonymous and submit a ticket; but when trying to Add bug report I get the following message "Bug ID does not exist on BTS!" and also receiving "POST /xmlrpc HTTP/1.0" 401 49 " " "XML-RPC for PHP2.2. in my TRAC access_log
my Issue Tracker information is below. I left out my URL.
"<issuetracker>\n" .
"<username>anonymous</username>\n" .
"<password></password>\n" .
"<uribase>'http://<YourTracServer>/<YourTracProjectName</uribase>\n" .
"</issuetracker>\n";


Thanks,

Pam
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: XMLRPC - TRAC authentication in 1.9.4

Post by fman »

why to start a thing knowing that is wrong ?
IMHO is only wasted time.
Check for similar posts on forum
Check on mantis
post will be locked
Locked