Setup consul https with a previous certificate from tomcat - https

How can we do to set up the consul use a previous certificate created for the tomcat?
We only have server.jks file used in tomcat, and we need to use the same tomcat certification.
How can we do to extract this information below?
"ca_file": "cert/ca.pem",
"cert_file": "cert/server.pem",
"key_file": /cert/serverkey.pem",
The server.conf
{
"bootstrap": true,
"server": true,
"datacenter": "dc1",
"data_dir": "data",
"verify_incoming": true,
"verify_outgoing": true,
"verify_server_hostname": true,
"auto_encrypt": {
"allow_tls": true
},
"log_level": "INFO",
"enable_agent_tls_for_checks": true,
"enable_syslog": false,
"ui_config": {
"enabled": true
},
"ports": {
"http": -1,
"https": 8500
}
}

Related

Cypress multi reporters: using mochawesome with autoset-status-cypress-testrail-reporter

I need to use two reporters with my Cypress tests: mochawesome to generate html reports, and autoset-status-cypress-testrail-reporter to publish test results to Testrail.
The main tool I could find that would enable me to use multiple reporters is cypress-multi-reporters.
However, If I try to use cypress-multi-reporters with autoset-status-cypress-testrail-reporter, alone or in conjunction with mochawesome as below (in cypress.json), it does not work. It will not print out any errors, but it just will not publish the results to Testrail, and it will not generate the mochawesome reports.
{
"reporterEnabled": "mochawesome, autoset-status-cypress-testrail-reporter",
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports",
"overwrite": false,
"html": true,
"json": false
},
"autosetStatusCypressTestrailReporterReporterOptions": {
"host": "https://xxxxxx/",
"username": "xxxxx",
"password": "xxxx",
"projectId": 1,
"runId": 1234
}
}
Can anyone tell me why the above is not working, or suggest a similar tool that would work with both mochawesome and autoset-status-cypress-testrail-reporter?
Got this to work in the end. The solution was
OPTION 1 - to include only the below in cypress.json:
"reporter": "cypress-multi-reporters",
"reporterOptions": {
"configFile": "reporter-config.json"
}
Then to create a new file called reporter-config.json, and add the config for each reporter in there:
{
"reporterEnabled": "mochawesome, autoset-status-cypress-testrail-reporter",
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports",
"overwrite": false,
"html": true,
"json": false
},
"autosetStatusCypressTestrailReporterReporterOptions": {
"host": "https://xxxxxx/",
"username": "xxxxx",
"password": "xxxx",
"projectId": 1,
"runId": 1234
}
}
OPTION 2 - to have everything inside cypress.json, like so:
"reporter": "cypress-multi-reporters",
"reporterOptions": {
"reporterEnabled": "mochawesome, autoset-status-cypress-testrail-reporter",
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports",
"overwrite": false,
"html": true,
"json": false
},
"autosetStatusCypressTestrailReporterReporterOptions": {
"host": "https://xxxxxx/",
"username": "xxxxx",
"password": "xxxx",
"projectId": 1,
"runId": 1234
}
}

Does consul sidecars support websockets upstream?

Is it possible to configure a consul agent sidecar with a websocket upstream? I have tried the following configuration but it doesn't work:
{
"bind_addr": "172.17.0.2",
"data_dir": "/consul/data",
"datacenter": "dc1",
"node_id" : "98dc3bf4-a364-46d9-8b72-624963064ab2",
"node_name": "socket-client-agent",
"leave_on_terminate": true,
"ports": [
{
"grpc": 8502
}
],
"server": false,
"service": [
{
"address": "172.17.0.3",
"connect": [
{
"sidecar_service": [
{
"checks": [
{
"interval": "10s",
"name": "socket-client-sidecar-proxy",
"tcp": "172.17.0.3:21000"
}
],
"port": 21000,
"proxy": [
{
"config": [
{
"bind_address": "0.0.0.0",
"bind_port": 21000,
"protocol": "tcp"
}
],
"upstreams": [
{
"destination_name": "sockets-server",
"local_bind_port": 5001,
"config": {
"protocol": "tcp"
}
}
]
}
]
}
]
}
],
"id": "socket-client-0",
"name": "socket-client",
"port": 5000
}
],
"ui_config": [
{
"enabled": false
}
]
}
From the configuration I'm trying to connect to sockets-server service which uses websockets protocol. I'm using envoy as sidecar proxy.
Currently Consul does not configure Envoy correctly to support WebSocket upgrades. This GitHub issue has more detail on the issue, and potential fix – https://github.com/hashicorp/consul/issues/9473.

Sublime FTP/SFTP

I am trying to connect to my cpanel server using sublime text 3.
Server is added successfully. And remote path is also validated successfully.
But when try to Sync Remote->Local it is just not happening.
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "ftp",
"save_before_upload": true,
"upload_on_save": true,
"sync_down_on_open": false,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "XXXXXX",
"user": "XXXXX",
"password": "XXXXXXX",
"port": "21",
"remote_path": "XXXXXX",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
//"allow_config_upload": false,
}
And in the console I finally got this:
"Select via quick panel? No".
And the process got terminated by itself.
SFTP has some options for that to put on your sftp-config.json file at the root of your folder :
Set those values like this:
"confirm_downloads":false,
"confirm_sync":false,
"confirm_overwrite_newer":true

Docker Windows bridge ip conflict

I have used Docker on a Linux machine and just started using it on Windows too.
I am on a unfortunate location where they use 172.17.0.0/16 subnet that conflicts with default Docker bridge subnet.
C:\>docker network inspect bridge
[
{
"Name": "bridge",
"Id": "d6ae8949e4e098ad4443ba2cd72bed5f9f96d81f5d2d00197b9443b8a8c1d1f6"
,
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16"
}
]
},
"Internal": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
I know there is an option for Linux (https://docs.docker.com/engine/reference/commandline/dockerd/ bip) to change this. But is there also an option for Windows?
PS. I have tried adding "bip": "10.11.12.0/24" to JSON Daemon configuration but Docker crashes on startup:

Gossip encryption not working fine

I have created a master token using the below command:
$ consul keygen
G74SM8N9NUc4meaHfA7CFg==
Then, I bootstrapped the server with the following config.json:
{
"server": true,
"datacenter": "consul",
"data_dir": "/var/consul",
"log_level": "INFO",
"enable_syslog": true,
"disable_update_check": true,
"client_addr": "0.0.0.0",
"bootstrap": true,
"leave_on_terminate": true,
"encrypt": "G74SM8N9NUc4meaHfA7CFg=="
}
The output of the bootstrap server is as follows:
Node name: 'abcd'
Datacenter: 'consul'
Server: true (bootstrap: true)
Client Addr: 0.0.0.0 (HTTP: 8500, HTTPS: -1, DNS: 8600, RPC: 8400)
Cluster Addr: x.x.x.x (LAN: 8301, WAN: 8302)
Gossip encrypt: true, RPC-TLS: false, TLS-Incoming: false
Atlas: <disabled>
Then, I added a new server as a regular consul server which has the following config.json:
{
"server": true,
"datacenter": "consul",
"data_dir": "/var/consul",
"log_level": "INFO",
"enable_syslog": true,
"disable_update_check": true,
"client_addr": "0.0.0.0",
"bootstrap": false,
"leave_on_terminate": true,
"ui_dir": "/usr/local/bin/consul_ui",
"check_update_interval": "0s",
"ports": {
"dns": 8600,
"http": 8500,
"https": 8700,
"rpc": 8400,
"serf_lan": 8301,
"serf_wan": 8302,
"server": 8300
},
"dns_config": {
"allow_stale": true,
"enable_truncate": true,
"only_passing": true,
"max_stale": "02s",
"node_ttl": "30s",
"service_ttl": {
"*": "10s"
}
},
"advertise_addr": "y.y.y.y",
"encrypt": "G74SM8N9NUc4meaHfA7CFg==",
"retry_join": [
"x.x.x.x",
"y.y.y.y"
]
}
Note: Here, x.x.x.x is IP address of the bootstrap server, y.y.y.y is IP address of the regular server.
For testing purpose, I changed the encrypt key on one of the servers. And, when I do consul members, I can still see the all IPs which means that the servers are still able to communicate even with the different encrypt key. It seems that the gossip encryption is not working fine.
A Consul instance will cache the initial key and re-use it. It is stored in the serf folder in the file local.keyring.
This is counter-intuitive, but it is documented at least in one place together with the encrypt option.
You'll need to delete this file and restart Consul in order to get the expected behaviour.

Resources