Can't change port of composer-rest-server - rest

I want to change the port of the composer-rest-server and I'm using the -p flag as the help says
However the terminal says that I am missing a parameter
Input:
composer-rest-server -p 8919
Output:
Missing parameter. Please run composer-rest-server -h to see usage details
And when I type the -h flag:
-p, --port The port to serve the REST API on [number]
So, how do I run the composer-rest-server on a different port from 3000?

Use full format for running a business network in different port using this:
composer-rest-server -c admin#sample-network -p 8919
or you can add more parameter like authentication, multiple user support etc.
composer-rest-server -c admin#sample-network -p 8919 -a false -m true
Know all parameters meaning by using this command.
composer-rest-server --help

You must specify business network card name (required)
composer-rest-server -c businessNetworkCardName -p portNumber
For help
composer-rest-server -h

use
composer-rest-server -P portNumber
you are using -p which is use for connection profile name and
-P use for port number

Related

How do I access PostgreSQL by both socket and port?

I have started a PostgreSQL process as follows:
pg_ctl start -w -D /path/to/data -l /path/to/log -o "-F -k /path/to/unix/socket -h ''"
(alternatively -h '*' instead of -h '')
Aside, references for pg_ctl (the outer function) and postgres (the -o parameter)
and created a user (with password) and database:
createuser -P admin
createdb -O admin db
I can connect to the database via the unix socket (does not trigger a password prompt):
psql -h /path/to/unix/socket -U admin -d dbname
but connecting via the TCP port fails:
psql -h localhost -U admin -d dbname
Password for user snaprevs_admin:
psql: FATAL: password authentication failed for user "admin"
What do I need to change so that both the unix socket and TCP connections work as expected?
If you are performing a custom pg_ctl launch, you should check that there isn't a default service already running. If there is it will consume the default TCP port.
To stop the default service and prevent it from starting on next boot:
sudo systemctl disable postgresql --now
If you only want to stop it temporarily:
sudo service postgresql stop
You should now be able to stop and re-start your custom service (with -h '*'), then log in over TCP.

Set sslmode=allow with pg_dump

I need to specify sslmode=allow when using psql to connect to my PostgreSQL DB, like: psql sslmode=allow -h localhost -p 5432
otherwise I get server does not support SSL, but SSL was required
I tried specifying the same option to pg_dump but it doesn't recognize the option.
How do I specify sslmode to pg_dump?
You need to use the environment variable PGSSLMODE like this:
PGSSLMODE=allow pg_dump -h localhost -p 5432
see https://dba.stackexchange.com/a/227805
pg_dump "port=<port> host=<host> user=<user> dbname=<db> sslcert=<cert> sslkey=<key> sslrootcert=<ca.crt> sslmode=allow" -f <file>

Ncrack just do nothing after launching command

I am pentesting my host using ncrack
I use such command ncrack -U login.txt -P pass.txt -iL ipList.txt -p 3389
After launching it shows me that ncrack has started and nothing happens.
What is the problem please help
This question should be on Security Stackexchange. Anyway, try to change 3389 for rdp.
You can try too removing the list using only one ip to test:
ncrack -vv -U login.txt -P pass.txt x.x.x.x:3389 where x.x.x.x is one of the ips of your list. With -vv you will see more verbose output to find out the error.
Are you sure your ips and/or hostnames on ipList.txt are accesible by network on tcp port 3389?
If not, it is a network problem.

docker run command --publish value option ?

I wanna use docker to run a zookeeper image. The instruction command is
docker run -d -p 2181:2181 -p 2888:2888 -p 3888:3888 --name zookeeper confluent/zookeeper
I am not clear with -p option, what does these three "-p "options mean in this zookeeper example ? and why we have two same port value in a single -p options. I would expect like 2181:localhost, not 2181:2181.
The -p flag specifies which of the container you choose to expose in your container (they are all closed by default).
The purpose of using : annotation is to instruct which port of the container should be forwarded to the localhost port.
Referring to your question - mapping the port like 2181:localhost would mean nothing, because localhost is inferred automatically, but the port isn't. The reason Docker gives you the choice is because port 2181 could be occupied on your localhost, so they give you the freedom to choose a port of your choice to forward into.

Postgres in Docker; two instances clashing ports

I've created a docker container which hosts a postgres server. I'm trying to get two instances of this running which index two completely different databases, and thus rely on a different set of volumes.
I'm running the following two commands one after the other:
docker run -v ... -p 5432:9001 -P --name psql-data postgres-docker
docker run -v ... -p 5432:9002 -P --name psql-transactions postgres-docker
The first container is created and runs, but the second call throws the following error:
Error response from daemon: failed to create endpoint psql-transactions on network bridge: Bind for 0.0.0.0:5432 failed. Port already in use.
I'm finding this a little confusing, because I though the point of containers was to isolate port binding. I could understand if I'd had both containers map 5432 onto the same port on the host machine, but I'm trying to mount them to 9001 and 9002 respectively.
How do I prevent this issue?
The order of the ports should be reversed. It should be -p host_port:container_port
First of all, only publish (-p) ports if you need to access them from outside the Docker host; if the database is only used by other services running in a container, there's no need to publish the ports; containers can access the database through the docker network.
If you intend to access the database externally, you need to swap the order of the ports in your -p; -p <host-port>:<container-port>. So in your case;
docker run -v ... -p 9001:5432-P --name psql-data postgres-docker
docker run -v ... -p 9002:5432 -P --name psql-transactions postgres-docker
To avoid the port clash you need to run it like this:
docker run -v ... -p 9001:5432 -P --name psql-data postgres-docker
docker run -v ... -p 9002:5432 -P --name psql-transactions postgres-docker