How to update changed database password in Liferay6.06? - java

I have a setup liferay6.06 version in my ubuntu system, its working fine, I am using the mysql database,before changing database password its working fine, after that I have changed database password,i have updated the changed password in portal.properties,while starting the tomcat server it is not connecting to the database and server is started. while accessing url iam getting 404 error. what are the places i need to update the changed password in liferay 6.06?

You need to create portal-ext.properties file inside classes folder and add following lines.
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=
HTH

Related

JBoss adds user to wrong realm found in property files

I had JBoss installed a while ago so I eventually forgot the password and username used for managing it (I mean the management console on port 9990).
I tried to reset the password by running the add-user.sh script but messed it up and now every user I add is created in the admin realm:
Enter the details of the new user to add.
Using realm 'admin' as discovered from the existing property files.
I do not need this realm, I just need the admin user to manage JBoss (presumably, this is the Management realm).
I tried to do the following:
Removed the admin line from mgmt-users.properties and mgmt-groups.properties in the standalone/configuration and domain/configuration
Tried to find the 'admin' realm in standalone.xml and standalone-full.xml but to no avail.
My question is how to create/reset the password of admin in the Management at last?
Also, where can I find the existing property files that JBoss mentions and override it to make it use the Management realm instead?
Had to reinstall JBoss and the problem gone.

How to retrieve DB credentials from external file for Liquibase config

I have a Spring Boot application which runs in Azure Kubernetes. The application uses Liquibase (Liquibase-Core 4.4.3) to create and amend database tables for the application on start up. For security reasons the application has different DB credentials to the Liquibase user and the Liquibase user credentials are added via the application.properties file as per below using environment variables:
spring.liquibase.url=${env_db_connection_url}
spring.liquibase.user=${env_db_lb_username}
spring.liquibase.password=${env_db_lb_password}
We add the credentials using this method with environment variables as the credentials are different depending on the environment (e.g. UAT, production) the app is being deployed to and this allows the pipeline to handle the differences without any changes being necessary to the code.
Our security team want us to stop using environment variables and so we are moving to using csi drivers for any sensitive information. This effectively creates something similar to an external properties file which sits outside the application but within the same container.
However, I am now having trouble resolving the db credentials for Liquibase and I don't know the best method to achieve what I need. I need a solution where we can still tokenize the value within the code but it is able to retrieve the secret values (db password etc) from the external properties file.
As you can imagine hard-coding these values or even just encrypting them wouldn't solve the issue due to the changing values between environments. We are able to retrieve the values within the application however I feel this is done too late in the process as Liquibase will have already attempted to start (and therefore fail) before the application code is run.
Any help or suggestions would be appreciated.
I used a method like this for a similar problem.
I'm running things on Jenkins server. But it's not necessary
I do not keep database connection information in files. After I send the files to the server, I add the database connection information to these files with bash script. The DB connection information is on the server, not the version control system.
Thus, I hide some db connection information from unauthorized people (only those who have access to the server can access it).
A- File example; liquibase.prod.properties
there is no db data
changeLogFile=./master.xml
logFile: liquibase.prod.log
logLevel: INFO
liquibase.hub.mode=off
B- Example of file where I keep database connections on server
spring.liquibase.url = my_env_db_connection_url
spring.liquibase.user= my_env_db_lb_username
spring.liquibase.password= my_env_db_lb_password
C- I am adding lines to this file with Jenkins and cmd bash
type E:\file1.cfg >> file2.cfg
This was the solution we took in the end. Effectively we worked out that the spring properties file could look directly in an external properties file (the csi driver in this case) to get the value.
Added to Spring properties file spring.config.import=optional:configtree:${env_var_for_external_property_file_location:#{null}}/liquibase/
For clarity, below is the secret provider class yaml which stores the liquibase password. The object alias value matching what Liquibase config expects for db password.
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: name
spec:
provider: azure
parameters:
keyvaultName: ****
tenantId: ****
objects: |
array:
- |
objectName: lqb
objectAlias: liquibase/spring.liquibase.password
objectType: secret

Not able to Authenticate using access token generated across different Machines

I am trying to authenticate Azure SQL Database using access token, Problem is, the access token(and refresh token) is generated on the different machine and SQL server authentication java code is on another machine. My application on 2nd machine picks the refresh token from the properties file. I am able to get the access token using refresh token but not able to authenticate the Azure SQL DB using that. However, everything works fine if I do the whole process on the same machine.
Are access token generated IP bound or machine bound?
Error: Database connection failed: Error message: Login failed for user ''. ClientConnectionId:321ad51b-77d5-4681-a162-d6c8afd477aa
The issue has been resolved, it was due to wrong (pretty old) version of MSSQL JDBC jar.
Each user has a default database. When you connect to computer that's running Microsoft SQL Server, and you do not specify a login database, the default database is used. However, if the default database is unavailable at the time of the connection, you may not be able to connect

PHP in the page doesn't get parsed when I try to access the page using HTTP

PHP doesn't get parsed when I try to run the PHP page. I am using NetBeans and running Apache Tomcat as the server. I have defined the interpreter for PHP which is shown in the following snapshot:
If I try to run the PHP page from within the IDE (by using the default shift+F6), it runs, but with a URL file:///C:/Users/user/AppData/Local/Temp/php_1.php11992.html for a file named php_1.php. But when I try to test the URL localhost:8081/app/php_1.php, the PHP in the page isn't parsed, and I see only the HTML getting parsed.
What could be the reason for this? What do I do to parse PHP directly ?
Note: I have installed XAMPP, and the path I give in the above snapshot is of the PHP interpreter that comes packed with the XAMPP package.
Ensure that the tomcat webserver is stopped and the XAMPP server running, since there could be a conflict (of ports, URIs etc).
If XAMPP is running and it still doesn't work, you can try the following:
Ensure the webserver has the type set in conf.d:
AddType application/x-httpd-php .php .php5 .phtml
Also, if you are using short tags make sure it is enabled in php.ini
Make sure mod_php is enabled in XAMPP (should be by default). You can do this by navigating to httpd.exe in XAMPP and typing httpd -M which will list currently used modules.

Trying to access Lotus DB via Java application - getting error msg " XXX.nsf has not been opened yet"

I'm trying to connect to a Lotus DB from an external Java application - my code works perfectly against a database located on my test (local) server, but fails when run against the production DB (no data is returned).
Diiop is running on the production server, and I have editor access for the production DB.
I'm able to create a session with the Domino server through my Java code, but am not able to open the Lotus DB.
Session session = NotesFactory.createSession("<Server>","UserID","password");
System.out.println("connected");
Database db = session.getDatabase("Server","<DB Path>" );
System.out.println("Access level: "+ db.getCurrentAccessLevel());
View vw = db.getView("Viewname");
After creating a session with the Domino server, I attempt to open the database, at which point I get the error XXX.nsf has not been opened yet.
I have also tried utilizing the IsOpen and open methods, with no luck.
Your database will not open in Java code, if its ACL forbids Internet access (that means http task). Check advanced tab of ACL, property "Maximum internet name and password". It should be at least Depositor to open it, or Reader to read data from it.
For diiop to work, the server has to have the allow HTTP clients to browse databases setting enabled. This setting is found in Server document->Internet Protocols->HTTP->R5 Basics. Of note, this setting takes effect even in modern Domino server instances. My guess is that the current value for this setting (set to "no") is where your problem is coming from.
You should also make sure that diiop is configured properly. The first test for this is to access http://hostname.domain.com/diiop_ior.txt. Accessing this URL should show you a page containing a simple text string containing something like 32 (seemingly) random characters.
I usually refer to this page when I need to get diiop working.
First try to access the database through a browser using the name/password in your code. If that doesn't work either HTTP isn't running or there is another issue separate to your code.
With issues like this I start with the sample code in the Infocenter.
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_EXAMPLES_GETDATABASE_METHOD_JAVA.html
eg.
Database db = session.getDatabase("<SERVER>", "<DBNAME>");
if (!db.isOpen())
System.out.println("DB does not exist.");
else
System.out.println("Title of database: \"" + db.getTitle()+ "\"") ;
See if that prints out anything.
The error message normally means the database is locked by the server, or corrupted. So try another database that you know you must have access to (eg. names.nsf ).
Just out of curiosity, what does printing :
session.getUserName();
..just before getCurrentAccessLevel() show? Is there an ambiguous username and you're ending up being authenticated as someone you don't expect?
I encountered the same error
Database xxx.nsf has not been opened yet
My problem was due to using a front slash instead of backslash. This corrected it:
var db = session.getDatabase(session.getServerName(), "path/dbname.nsf");
I noticed that nowhere in the above question is the db path identified, so perhaps the wrong slashes are being used.
The irritating part is that instead of returning an error message 'file not found' the NotesException message is pathdbname.nsf has not been opened yet when in fact it can't be found...

Categories