error while using maven for password encryption - maven-3

I am trying to encrypt the password using maven by following this link- Generate settings-security.xml file for maven password encryption. But, in the step after creating master password and creating the file settings-security.xml, but while trying to run the command- mvn --encrypt-password '!12345', I am getting the following error:
[ERROR] Error executing Maven.
[ERROR] org.codehaus.plexus.util.xml.pull.XmlPullParserException: start tag unexpected character { (position: TEXT seen <settingsSecurity>\n<master{... #2:9)
[ERROR] Caused by: start tag unexpected character { (position: TEXT seen <settingsSecurity>\n<master{... #2:9)
abhinashkumarjha#C02DP5F7MD6R ~ % mvn --encrypt-password '!Abhi#090342'
[ERROR] Error executing Maven.
[ERROR] org.codehaus.plexus.util.xml.pull.XmlPullParserException: start tag unexpected character { (position: START_TAG seen <settingsSecurity><master{... #1:26)
[ERROR] Caused by: start tag unexpected character { (position: START_TAG seen <settingsSecurity><master{... #1:26)
My settings-security.xml looks like this:
<settingsSecurity>
<master{42xI34HcwGIH/t9Bhr5P4ctsVIjOtvPO81b2eb9uYWY=}</master>
</settingsSecurity>
Thanks in Advance!!

Related

RabbitMQ cant start due to an error on log fomatter config

I'm using RabbitMQ 3.8.5-management with the following config:
log.file = rabbit.log
log.dir = /var/log/rabbitmq
log.file.level = info
log.file.formatter = json
log.file.rotation.date = $D0
I get the following error:
12:45:12.131 [error] You've tried to set log.file.formatter, but there is no setting with that name.
12:45:12.134 [error] Did you mean one of these?
12:45:12.182 [error] log.file.level
12:45:12.182 [error] log.file
12:45:12.182 [error] log.file.rotation.date
12:45:12.182 [error] Error preparing configuration in phase transform_datatypes:
12:45:12.183 [error] - Conf file attempted to set unknown variable: log.file.formatter
According to the documentation log.file.formatter should work - what is wrong?
checked documentation on RabbitMQ.
checked other SO posts.
entered the container and remove the config - it works without it.
Looks like JSON logging and the log.file.formatter setting was added with RabbitMQ 3.9.0 release.
Try upgrading if possible.

Liquibase checksum validation failed when running via Jenkins but not from terminal

I am running below command from Linux(Centos) terminal,
mvn --settings /home/centos/.m2/jenkins/liquibase-settings.xml -e resources:resources -Pdev -Dliquibase.promptOnNonLocalDatabase=false -Dliquibase.defaultSchemaName=MYDEV_SCHEMA liquibase:updateSQL liquibase:update -Dsettings.security=/home/centos/.m2/jenkins/liquibase-security-settings.xml -Dfile.encoding=UTF-8
Everything went fine.
Same thing when I run via Jenkins, getting below,
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.2.0:updateSQL (default-cli) on project project-db:
[ERROR] Error setting up or running Liquibase:
[ERROR] Validation Failed:
[ERROR] 16 change sets check sum
[ERROR] db/changelog/ABCD.xml::1234-23::User1 was: 8:67913d9505606eeaaa4998fd594a8ccf but is now: 8:9d985650b579319df50f30732d66909c
[ERROR] db/changelog/ABCD.xml::1234-78::User1 was: 8:3b3babd5d0712f846402af13ede528f7 but is now: 8:0214bf10acfd160fc6f7d709edab2f2e
[ERROR] db/changelog/ABCD.xml::1234-142::User1 was: 8:5e3c8fc77fc87f0e9740c0bff717f579 but is now: 8:53094dd8c32ec71b8d76fdd71009c548
[ERROR] db/changelog/ABCD.xml::1234-200::User1 was: 8:c40ec5c77f7b10961ee550edd756f51f but is now: 8:9bef09eb0681f7ea7bf827b6ac136433
[ERROR] db/changelog/ABCD.xml::1234-923::User1 was: 8:747cbcbda155679dd2fc1bfcc40991c4 but is now: 8:68c8046c220b8d2eb46ed3ac07ebc2a2
[ERROR] db/changelog/ABCD.xml::1234-952::User1 was: 8:ecaad2afacf6c61f18e08cb3e235292a but is now: 8:0f7f9087de5cc2e62a96a86988d07a9d
[ERROR] db/changelog/ABCD.xml::1234-955::User1 was: 8:3ddd6fd25fb4a68accf50190b3ab6738 but is now: 8:8ebed2810bad45ace402f99a957a2c5a
[ERROR] db/changelog/ABCD.xml::1234-957::User1 was: 8:cc6144775a784d10bc4523dccae02c2e but is now: 8:f0fb84fb3a677e760b5bbad3149e8a17
[ERROR] db/changelog/ABCD.xml::1234-958::User1 was: 8:b0c71a212949df4863ce622e61315cee but is now: 8:9c6ea7b8f8cb3f6e65871085527fa4c5
[ERROR] db/changelog/ABCD.xml::1234-960::User1 was: 8:b0966c55100b0a2daae7dd34b7d1849f but is now: 8:5db8b313d34612e1a0035caa73bfae2d
[ERROR] db/changelog/ABCD.xml::1234-961::User1 was: 8:3e3b96c656362b5bed959428772efbdf but is now: 8:622c3530660fa51cfb806cc454736a8e
[ERROR] db/changelog/ABCD.xml::1234-964::User1 was: 8:50e079098e7d2be9e1299d68717af265 but is now: 8:13ab1763f5f21e80dc5f7aa714916f01
[ERROR] db/changelog/ABCD.xml::1234-971::User1 was: 8:fe000258281e834309f9454077e4935d but is now: 8:b238dad4489c9683a3e362820a0ba715
[ERROR] db/changelog/ABCD.xml::1234-974::User1 was: 8:578a1f3510ac700373b40d83ffbfcdde but is now: 8:3eeb6e61dec24eac4148a6c66033e125
[ERROR] db/changelog/ABCD.xml::100000011::User1 was: 8:5d0882f8413b6d1063ab023e7c4ec917 but is now: 8:e019e12a40add4536a128ba7b9b06f69
[ERROR] db/changerequest/ABCD/ABCD.1_Base.xml::ABCD1-100000211::User1 was: 8:9ea4f4f4b5a2db0d1c7e439887e9129c but is now: 8:ebe390648144994233ecd6101e04380c
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:4.2.0:updateSQL (default-cli) on project project-db:
My Jenkins code,
dir("${liquibase_working_dir}"){
configFileProvider([
configFile(fileId: 'liquibase-settings.xml', variable: 'LIQUIBASE_SETTINGS'),
configFile(fileId: 'liquibase-security-settings.xml', variable: 'LIQUIBASE_SECURITY_SETTINGS'),
]) {
withMaven(maven:'maven', mavenSettingsFilePath: "${LIQUIBASE_SETTINGS}") {
sh "mvn -e resources:resources liquibase:updateSQL liquibase:update -P${env_lowercase} \"-Dsettings.security=${LIQUIBASE_SECURITY_SETTINGS}\" -Dliquibase.promptOnNonLocalDatabase=false -Dliquibase.defaultSchemaName=${schema} -Dfile.encoding=UTF-8"
}
}
sh "cp target/liquibase/migrate.sql target/liquibase/${env_lowercase}-${currentBuild.number}-${schema}-updates.sql"
}
I missed an important point, there are no commits to the liquibase repository.
When Liquibase reaches a changeset, it computes a checksum for it and stores it in the DATABASECHANGELOG table. The value of storing the checksum for Liquibase is to know if the changeset has been modified since it was run.
If the changeset has been changed since it was run, Liquibase will exit the migration with an error message like Validation failed: change set check sums <changeset identifer> was: <old checksum> but is now: <newchecksum>. This is because Liquibase cannot identify what was changed and the database may be in a state different than what the changelog is expecting.
To ignore this error on valid change made in changeset, there are below options:
1. clearCheckSums : clearCheckSums clears all checksums and nullifies the MD5SUM column of the DATABASECHANGELOG table so they will be re-computed on the next database update.Changesets that have been deployed will have their checksums re-computed, and pending changesets will be deployed. For more details about this approach, please visit this link
2. runOnChange attribute : The runOnChange attribute executes the change the first time it is seen and each time the changeset is modified. For more details about this approach, please visit this link
3. runAlways attribute : Executes the changeset on every run, even if it has been run before. To use this, set attribute runAlways = true in your changeset. Example as below:
<changeSet id="liquibase-0" author="liquibase" runAlways="true">
<sqlFile relativeToChangelogFile="true" path="db/file.sql"/>
</changeSet>
4. The <validCheckSum> attribute : Add a element to the changeset. The text contents of the element should contain the old checksum from the error message.
5. Manual update of the DATABASECHANGELOG table : The first option is to manually update the DATABASECHANGELOG table so that the row with the corresponding id/author/filepath has a null value for the checksum. You would need to do this for all environments where the changeset has been deployed. The next time you run the Liquibase update command, it will update the checksum value to the new correct value.
Cheers!!

unable to start logstash

this is my first time running logstash on container. Im running logstash on the same container elasticsearch + kibana. Its running on ubuntu.
i run my conf file by using
/usr/share/logstash/bin/logstash -f conf.d/logstash.conf
here is my logstash.conf :
input{
beats{
port=>5044
}
}
filter
{
grok {
match =>{
"message" => "%{TIMESTAMP_ISO8601:logtimestamp}\s%{DATA:S_IP}\s%{WORD:s_method}\s%{DATA:cs_uri_stem}\s%{DATA:cs_uri_query}\s%{DATA:s_port}\s%{GREEDYDATA:log_message}"
}
}
date{
match =>["logtimestamp","yyyy-MM-dd HH:mm:ss"]
target=>"#timestamp"
}
}
output{
stdout{codec=>rubydebug}
elasticsearch{
hosts=>"elastic#localhost:9200"
index=>"log_iis"
user =>"*****"
password=>"*****"
}
}
and it returning error as :
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (file:/usr/share/logstash/logstash-core/lib/jars/jruby-complete-9.2.8.0.jar) to field java.io.FileDescriptor.fd
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Thread.exclusive is deprecated, use Thread::Mutex
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
[WARN ] 2020-02-10 03:32:59.625 [LogStash::Runner] multilocal - Ignoring the 'pipelines.yml' file because modules or command line options are specified
[INFO ] 2020-02-10 03:32:59.632 [LogStash::Runner] runner - Starting Logstash {"logstash.version"=>"7.5.2"}
[INFO ] 2020-02-10 03:33:00.995 [Converge PipelineAction::Create<main>] Reflections - Reflections took 24 ms to scan 1 urls, producing 20 keys and 40 values
[ERROR] 2020-02-10 03:33:01.375 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: Illegal character in scheme name at index 7: elastic#localhost:9200", :backtrace=>["org.logstash.config.ir.CompiledPipeline.<init>(CompiledPipeline.java:119)", "org.logstash.execution.JavaBasePipelineExt.initialize(JavaBasePipelineExt.java:60)", "org.logstash.execution.JavaBasePipelineExt$INVOKER$i$1$0$initialize.call(JavaBasePipelineExt$INVOKER$i$1$0$initialize.gen)", "org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:837)", "org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1156)", "org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuperSplatArgs(IRRuntimeHelpers.java:1143)", "org.jruby.ir.targets.InstanceSuperInvokeSite.invoke(InstanceSuperInvokeSite.java:39)", "usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.RUBY$method$initialize$0(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:27)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:91)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:90)", "org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:332)", "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86)", "org.jruby.RubyClass.newInstance(RubyClass.java:915)", "org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:183)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0(/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0$__VARARGS__(/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:91)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:90)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:183)", "usr.share.logstash.logstash_minus_core.lib.logstash.agent.RUBY$block$converge_state$2(/usr/share/logstash/logstash-core/lib/logstash/agent.rb:326)", "org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:136)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:77)", "org.jruby.runtime.Block.call(Block.java:129)", "org.jruby.RubyProc.call(RubyProc.java:295)", "org.jruby.RubyProc.call(RubyProc.java:274)", "org.jruby.RubyProc.call(RubyProc.java:270)", "org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105)", "java.base/java.lang.Thread.run(Thread.java:830)"]}
warning: thread "Converge PipelineAction::Create<main>" terminated with exception (report_on_exception is true):
LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`
create at org/logstash/execution/ConvergeResultExt.java:109
add at org/logstash/execution/ConvergeResultExt.java:37
converge_state at /usr/share/logstash/logstash-core/lib/logstash/agent.rb:339
[ERROR] 2020-02-10 03:33:01.379 [Agent thread] agent - An exception happened when converging configuration {:exception=>LogStash::Error, :message=>"Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`", :backtrace=>["org/logstash/execution/ConvergeResultExt.java:109:in `create'", "org/logstash/execution/ConvergeResultExt.java:37:in `add'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:339:in `block in converge_state'"]}
[FATAL] 2020-02-10 03:33:01.403 [LogStash::Runner] runner - An unexpected error occurred! {:error=>#<LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`>, :backtrace=>["org/logstash/execution/ConvergeResultExt.java:109:in `create'", "org/logstash/execution/ConvergeResultExt.java:37:in `add'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:339:in `block in converge_state'"]}
[ERROR] 2020-02-10 03:33:01.432 [LogStash::Runner] Logstash - java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit)
and respond or explanation will be appreciated so much. thank you
The error log says that you get
Illegal character in scheme name at index 7: elastic#localhost:9200", which is the value of the hosts option.
I guess the problem is the at (#). Is that needed? Anyway, if you check the documentation of the Elasticsearch output plugin [1], it says that
Any special characters present in the URLs here MUST be URL escaped! This means # should be put in as %23 for instance.
[1] https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-hosts

Knife bootstrap failing through Jenkins execute shell

I'm trying to perform a "knife bootstrap" command through Jenkins web UI execute shell, but I keep getting this error message :
(this is the knife bootstrap command I'm using) :
"knife bootstrap [the node's IP] --ssh-user ec2-user --sudo --identity-file "[my key to the node]" --node-name My123 --run-list 'role[role1]' "
and this is the error message:
" ERROR: Errno::ENOENT: No such file or directory # rb_sysopen - /etc/chef/validation.pem "
when I run the 'knife bootstrap' command directly through the CLI it works fine.
any idea why it's not working from Jenkins execute shell?
It is due to validation.pem file is missing, this is default path for validation file. Either you can set path in /chef-repo/.chef/knife.rb file or you can use default location /etc/chef/validation.pem.
You can regenerate validation key from webUI and replace the existing one, this should resolve your issue.

Setting grails proxy username with special \ character causes error

Our firm uses a corporate proxy with a username in the following form domainName\username . When I try to add the proxy from command line using add-proxy command.
The exception I get is:
Error WARNING: Error configuring proxy settings: startup failed:
C:\Documents and Settings\username\.grails\ProxySettings.groovy: 1: unexpected cha
r: '\' # line 1, column 94.
8080", "http.proxyUser":"company\username"
What is the workaround for this? I tried manually editing the ProxySettings.groovy file, but same error is thrown on startup.
[UPDATE] I tried with Grails 2.0.0 RC3 but still unable to connect.
It looks like you have ran into a grails bug, when domain is used in the proxy configuration: http://jira.grails.org/browse/GRAILS-7387. The work-around is to configure the proxy within the BuildConfig.groovy (kind of manually). Add the following to the existing company\username:
grails.project.dependency.resolution = {
System.setProperty("http.proxyHost", "host");
System.setProperty("http.proxyPort", "port");
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("company\\username","password".toCharArray());
}
});
[rest of code]
}
This way there shouldn't be problems with the backslash.

Resources