Can't Bind for successful connection - command-line

I am trying to test a connection to AD using OpenLDAP and this is what I try on the command line:
/usr/bin/ldapsearch -h names.myorg.com \
-p 389 \
-D "cn=conapps readonly,cn=users,dc=myorg,dc=com" \
-LLL \
-x \
-b "ou=MyOrg Staff,ou=People,dc=myorg,dc=com" \
-s sub "(objectClass=*)" DN sn givenName mail userPrincipalName employeeID usertype \
-W
However, I keep getting the following error:
Operations error (1)
Additional information: 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece
Can anybody see what I am doing incorrectly?

Try port 3268 instead, see http://technet.microsoft.com/en-us/library/cc978012.aspx for more information
This command works for me:
$ ldapsearch -x -LLL -H ldap://test.com:3268 -dbc=test,dc=com -D 'DOMAIN\username' -W name=username dn

I think your password for bindDN is wrong, The bindDn which you are specifying is cn=readonly,cn=users,dc=myorg,dc=com and the password using -W is empty. It may be wrong and it is unable to authenticate you before doing a search.

Related

Why does psql only works when I pass in a string?

This fails with tlsv1 alert unknown ca
psql -h localhost -p 4566 -d dev -U root --set=sslmode=disable
This works:
psql "port=4566 host=localhost user=root dbname=dev sslmode=disable"
Why? Why does one work when the other does not? Is the --set ignored?
Is this a bug or a feature?
The --set is not ignored, it just doesn't do anything meaningful. It tells psql to set the psql variable named 'sslmode', but that variable is not in charge of anything. If you could connect and you then ran select :'sslmode';, you find that it had indeed been set, but since it isn't in charge of anything this doesn't really matter much.
TheA way to do this correctly, assuming you are using bash, is:
PGSSLMODE=disable psql -h localhost -p 4566 -d dev -U root
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
The second one works. Because (sslmode=disable) is part of the connection string key words.
psql --help returns:
-s, --single-step single-step mode (confirm each query)
-S, --single-line single-line mode (end of line terminates SQL command)
also if you psql --help | grep ssl, there is zero result. which mean you cannot use simple use
psql -h localhost -p 4566 -d dev -U root --sslmode=disable .
jjanes's answer works because: https://www.postgresql.org/docs/current/libpq-envars.html

Whats wrong with this ssh-keygen command?

I'm using ssh-keygen on Windows to create a fresh key pair of SSH keys.
But if I execute the command I get the following error:
Too many arguments.
Command:
ssh-keygen -t ed25519 -f ~/.ssh/id_local -H ~/.ssh/known_hosts_local -C "Local Hosts"
I wonder if anyone out there encountered this before or knows what's wrong with my set of command arguments.
CodingSheep
The -H option is supposed to optionnally use a known hosts file with -f
-H [-f known_hosts_file]
So you should use:
-H -f ~/.ssh/known_hosts_local
^^^
I just tested it on Windows 10, an it does work.
-H alone would update the default ~/.ssh/known_hosts.

mongoexport works on local but not on remote server

When I run this code to export my local database, it works well and a file is successfully generated:
mongoexport \
--host="localhost:27017" \
-d springDb \
-c posts \
--out social.json
But when I try to access my remote server with the similar command here:
mongoexport \
--host="mongodb+srv://clustxxx.xxx.mongodb.net/xxxx" \
-d socialDeveloper \
-c posts \
--out social.json
I get this error:
error parsing command line options: error parsing URI from mongodb:///clustxxx.xxx.mongodb.net/xxxx:27017/?replicaSet=mongodb+srv:: error parsing uri: must have at least 1 host
What am I doing wrong please?

Curl error: option-less arguments found

I'm trying to import this example into postman
curl -s --user 'api:YOUR_API_KEY' \
https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \
-F from='Excited User <mailgun#YOUR_DOMAIN_NAME>' \
-F to=YOU#YOUR_DOMAIN_NAME \
-F to=bar#example.com \
-F subject='Hello' \
-F text='Testing some Mailgun awesomness!'
Please help me understand the -s, --user, -F, what is that? And then when I try to import, I get this error: option-less arguments found. How can I fix this?
If you're trying to execute curl commands in Postman, select Import, then Paste Raw Text and then copy the command, but first remove all backslashes.

how can I programmatically get the hostname for the BIGSQL_HEAD?

I need to programmatically retrieve the BIGSQL_HEAD hostname of my BigInsihgts on Cloud enterprise cluster from a script so I can automate connecting to that host.
The BIGSQL_HEAD hostname is in Ambari - how can I retrieve this information using 'standard' unix tools?
BI_HOST=your_biginsights_mastermanager_hostname
BI_USER=your_biginsights_username
BI_PASS=your_biginsights_password
BASE_URL=https://${BI_HOST}:9443
CLUSTER_NAME=$(curl -k -s -u ${BI_USER}:${BI_PASS} -H 'X-Requested-By:ambari' \
${BASE_URL}/api/v1/clusters | python -c \
'import json,sys;print json.load(sys.stdin)["items"][0]["Clusters"]["cluster_name"]')
BIGSQL_HOST=$(curl -k -s -u ${BI_USER}:${BI_PASS} -H 'X-Requested-By:ambari' \
${BASE_URL}/api/v1/clusters/${CLUSTER_NAME}/services/BIGSQL/components/BIGSQL_HEAD | \
python -c \
'import json,sys;print json.load(sys.stdin)["host_components"][0]["HostRoles"]["host_name"]')
echo ${BIGSQL_HOST}
These commands can be run on the BigInsight cluster or your client machine.
Thanks to Pierre Regazzoni for the ambari code.