Jira recover user and password - jira

Hi I installed JIRA on a ubuntu box, but I forgot to write down my user/password (I know :/).
Mails are not working because the mail server isn't configured, and I can't access the admin panel.
The DB is a hsqldb db and I only have command line which seems impossible to run query's against.
How can I recover my user/password ?

You can run the HSQL Database Manager by shutting down JIRA, then running the following command:
java -cp /path/to/WEB-INF/lib/hsqldb-1.8.0.5.jar org.hsqldb.util.DatabaseManager \
-user sa \
-url jdbc:hsqldb:/path/to/jira-home/database
...depending on the actual filename of the HSQL jar. The actual JDBC string should be available in JIRA admin somewhere.
This will then allow you to look in the cwd_user table for the user and reset the password as described here:
https://confluence.atlassian.com/display/JIRA/Retrieving+the+JIRA+Administrator
You'll be able to see the users with this:
select u.user_name, d.directory_name
from cwd_user u inner join cwd_directory d on u.directory_id = d.id
order by directory_name, user_name;
Then reset the password like this:
update cwd_user
set credential='uQieO/1CGMUIXXftw3ynrsaYLShI+GTcPS4LdUGWbIusFvHPfUzD7CZvms6yMMvA8I7FViHVEqr6Mj4pCLKAFQ=='
where user_name='some-user-name';
-- new password is 'sphere'
More details on HSQL Database Manager & Atlassian products:
How to access the HSQL Database Manager during Atlassian Confluence add-on development
Accessing HSQL Database Manager

Related

Jenkins LDAP authentication does a unindexed search

I'm installing a new Jenkins server (let's name it "A") and my LDAP authentication runs into the error
"[LDAP: error code 50 - You do not have sufficient privileges to perform an unindexed search"
The LDAP configration is identically to another Jenkins installation (version 1.642.2, let's name it "B") in the same network where LDAP works fine (Due to security reasons, I can't give exact names below)
- Server: ldaps://server.domain:port
- root DN: dc=XXX,dc=com
- User search base: ou=people
- User search filter: uid={0}
- Manager DN: uid=XYZ,ou=people,dc=XXX,dc=com
- Manager Password: ****
Group search base and Group search filte are not defined
The server "A" has currently no openldap2-client package installed. So I can't test on the command line on server "A".
When testing on server "B", the following query returns successfully:
ldapsearch -x -D "uid=XYZ,ou=people,dc=XXX,dc=com" -W -H ldaps://server.domain:port 'uid=myAccount'
Without giving the account to search for
ldapsearch -x -D "uid=XYZ,ou=people,dc=XXX,dc=com" -W -H ldaps://server.domain:port
returns the same error as I get in Jenkins on "A": "[LDAP: error code 50 - You do not have sufficient privileges to perform an unindexed search".
This works as expected, indeed.
So I assume, that somehow the User search filter uid={0} in Jenkins "A" isn't interpreted correctly.
I created a new log recorder in Jenkins for the "hudson.security.LDAPSecurityRealm" with priority "All", but it doesn't give more information about the LDAP query.
Any hints what could be wrong here?
Adding the Group Search Base "ou=groups" did the trick!
This is not necessary in Jenkins Vers. 1.642.2 - the Jenkins Version, which is installed on my question's server "B". There everything works fine without this option.
When using the LTS Version 2.263.1 (I forgot to mention the version in my question) it's necessary (in my case) to add the Group Search Base.
Thanks to all the people, who spend some time for reading my post!
Regards!

SQL Server Agent Job called a Stored Procedure that used Linked Server did not work

I have a stored procedure that uses linked server:
The linked server was created pointing to the Source Database server and Security is "Be made using the login's current security context"
The credential was created using an AD service account
The proxy was created with a check on the "Operating system (CmdExec) "
The stored procedure used the linked server bame in the insert/select command. The stored procedure worked well when I executed it within SSMS.
However when I run the stored procedure from SQL Server Agent Job step, using SQLCMD, it did not work.
Here is the example of my stored procedure:
USE [MyDatabaseName]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[TEST_LINKED_SERVER]
AS
BEGIN
INSERT INTO MyDatabaseName.dbo.MyTableName
SELECT *
FROM [linkedservername].SourceDatabaseName.dbo.SourceTableName
END
GO
After creating the stored procedure, I executed it from SSMS - stored procedure. I worked well.
MyTableName had data inserted from the SourceTableName.
I then created a SQL Server Agent job with two steps:
Step #1: Run a stored procedure, truncate data from MytableName
Step #2: Run the "TEST_LINKED_SERVER" stored procedure, update data to Mytablename, by insert data from the linked server/database/table on another server using the linked server.
Step #2 was setup as follows:
Type: Operating system (CmdExec)
Run as: ProxyName
Command: SQLCMD -Q "EXEC dbo.TEST_LINKED_SERVER"
The job completed successfully. However MytableName did not have any data. It is empty. Data was not inserted to MyTableName.
Would you have any idea? Do I need to update my SQLCMD? And how?
Your help is much appreciated.
I found the solution and it worked:
SQLCMD -E -S MyServerName -D MyDatabaseName -Q "EXEC dbo.TEST_LINKED_SERVER"

Why can any user login influxdb?

I have installed influxdb. But in the server every user can login when ther type inlux.
Why is it like that? Is not it a security problem. And how can I solve it?
I want to login with spesific admin user and its admin password.
The "why"
Different databases have used reasonings with minor differences over the years, but basically, it goes like this:
In its most simple install, <insert DBMS here> should just run - for integration tests, simple evaluation purposes etc. We could generate a root/admin/superhoncho user password, but more often than not, this is not going to be changed, and that is a Bad Thing™.
And since nobody sane would run a database in production without authentication and authorisation enabled, providing easy access in the default installation is not a problem anyway, is it?
I tend to agree with this reasoning, though I am off the opinion that in the case the DBMS has authentication and authorisation disabled per default, it should bind to localhost by default, too. You make your DBMS accessible to the outside world, and be it only your company's network? You surely have thought about the implications!
The "how"
Authentication
I am going to use docker to illustrate it and it is quite obvious what you have to do in a non-docker environment.
First, we pull the influxdb docker image and create a default config file in one go:
$ docker run --rm influxdb influxd config > influxdb.conf
Unable to find image 'influxdb:latest' locally
latest: Pulling from library/influxdb
...
Digest: sha256:0aa7fea5336b5e5cc1c80e16062865821ec772e06519c138947ef5ebd9b34907
Status: Downloaded newer image for influxdb:latest
Merging with configuration at: /etc/influxdb/influxdb.conf
Now we change the authentication parameter in the [http] section of our influxdb.conf to true:
...
[http]
auth-enabled = true
...
Next, we start our InfluxDB using this modified config file:
$ docker run -d --name influxdb -p 8086:8086 \
-v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
influxdb -config /etc/influxdb/influxdb.conf
1987f962c331d2404a2564bb752d971553b13181dbbbb1e38cf50d345b3191c4
(The hash sum you get will be different.)
Now, we connect to our influxdb and create the admin user
$ docker exec -it influxdb influx
Connected to http://localhost:8086 version 1.7.8
InfluxDB shell version: 1.7.8
> create user admin with password 'secret' with all privileges;
From this point on, credentials are needed for pretty much everything
> show users
ERR: unable to parse authentication credentials
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> auth
username: admin
password:
> show users
user admin
---- -----
admin true
Authorization
Simple mnemonic: "Users are granted permissions per database." So, in order to grant something to a user, that user must first exist:
> create user berkancetin with password 'supersecret';
> create database foobar
> grant read on foobar to berkancetin
> show users
user admin
---- -----
admin true
berkancetin false
> show grants for "berkancetin"
database privilege
-------- ---------
foobar READ
Further reading (!!!)
Ignore at your own risk. You. Have. Been. Warned.
InfluxDB authentication
InfluxDB docs on Authorization

How to Configure Jenkins to insert the same data related to build of the jobs in jenkins to two different databases?

I am trying to configure Jenkins to store the data related to the status , start, end time of the jobs build into the MSSQL server database. I need to configure jenkins to insert the same data to another Database inaddition to the above database. How to configure it.
You can use the DataBasePlugin https://wiki.jenkins.io/display/JENKINS/Database+Plugin and configure it
Or
You can write a shell script command to connect and insert the data into the DB
#!bin/bash
query="insert into table_name values(....)"
mysql -u username -p password mysql -e "$query";

Programmatical register a Postgres Server with pgAdmin using Delphi

Im working on an application using Postgres 9 and Delphi 7 as the front end,
For setting up the database connection to the application we have to do the following steps
1.Register a server in postgres
(i cannot post an image because im new user)
Name:=Localhost
Host:=Localhost
Port:=5432
SSL:=
MaintenanceDB:=myDB
Username:=Admin
password:=******
.
.
Service:=Localhost
2.Create the database and the tables.
Can any one tell me if the step 1.
can be done programatically?
Like for example
"C:\Program Files\PostgreSQL\9.0\bin\psql.exe" -h localhost -p 5432 -d myDB -U Admin Service=Localhost " ?
as of now its done manually by the user.
thanks in advance:)
The registered servers in pgAdmin are stored in the Windows registry under HKEY_CURRENT_USER\Software\pgAdmin III\Servers
The number of registered servers is stored in the Count attribute.
Then each server gets its own entry according to the number. So the first one is stored in HKEY_CURRENT_USER\Software\pgAdmin III\Servers\1, the second one in HKEY_CURRENT_USER\Software\pgAdmin III\Servers\2 and so on.
Have a look into your registry and create an approriate entry from within your Delphi application.

Resources