Mac OS security command works different in different versions - macos

I have a command I try to run on Version 12.5:
/usr/bin/security add-trusted-cert -r trustAsRoot -k /Library/Keychains/System.keychain -p ssl -p basic -d './blabla.blabla...'
And it works.
Then I try the same command in version 12.3.1
But I get the following: SecTrustSettingsSetTrustSettings: One or more parameters passed to a function were not valid.
But, in this version, If was to run /usr/bin/security add-trusted-cert -r trustRoot -k /Library/Keychains/System.keychain -p ssl -p basic -d './blabla.blabla...' it works.
Could anyone please explain? I'd like to get a working command for all versions.
By the way, If I run: /usr/bin/security add-trusted-cert -r trustRoot -k /Library/Keychains/System.keychain -p ssl -p basic -d './blabla.blabla...' on version 12.5 it fails for same reason.

Related

Install CURRENT version of Gradle within CI

Gradle describes their installation in their docs:
https://docs.gradle.org/current/userguide/installation.html
However the docs requires using specific version and there is no easy way to say "get the current version".
I would like to do something like:
export GRADLE_VERSION=`curl https://services.gradle.org/current-version`
curl -sSLO https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
&& unzip -q -d /opt/gradle gradle-*.zip \
&& echo "PATH=$PATH:/opt/gradle/gradle-${GRADLE_VERSION}/bin" > ~/.bashrc
Obviously there is no such API service like /current-version. How would you achieve this?
I suggest:
curl -s 'https://services.gradle.org/versions/current' | jq -r '.version'
Output:
7.3.1
or
curl -s 'https://services.gradle.org/versions/current' | jq -r '.downloadUrl'
Output:
https://services.gradle.org/distributions/gradle-7.3.1-bin.zip

mosquitto_pub Error: '-l' mode not available threading support has not been compiled in

When trying to publish a message to a topic using the mosquitto_pub -l flag, I get the error:
Error: '-l' mode not available, threading support has not been compiled in.
How can I correct this?
For reference mosquitto_pub is version 1.5.3, running on libmosquitto 1.5.3., and the command I am trying to run is:
mosquitto_pub -h <hostname> -p <port> -t "<topic>" --cafile /usr/local/etc/openssl/cert.pem -d -P "$(cat mqtt-token-pub.txt)" -u <username> -l
Note: it works if I use -m "blah" instead of -l

Starting amqp-consume on Debian 8

I used to consume messages from amqp-consume with this command below at debian 7, but I installed debian 8 I think the amqp-tools is different and it does not recognize my command.
I noticed some changes. My web interface change the port from 55672 to 15672.
amqp-consume -d -q queue.udrive.admin.uiscsi -s 10.0.1.251 -p 5672 -e "directExchangeUdrive" --vhost "/" -r "" --username=guest --password=guest /bin/bash remoteManageUiSCSI.sh
error: both --server and --url options specify server host
I think the command expects it:
amqp-consume
consuming command not specified
Usage: amqp-consume [-dxA?] [-u|--url=amqp://...] [-s|--server=hostname] [--port=port] [--vhost=vhost] [--username=username] [--password=password] [--ssl] [--cacert=cacert.pem] [--key=key.pem] [--cert=cert.pem] [-q|--queue=queue] [-e|--exchange=exchange] [-r|--routing-key=routing key] [-d|--declare] [-x|--exclusive] [-A|--no-ack] [-c|--count=limit] [-p|--prefetch-count=limit] [-?|--help] [--usage] [OPTIONS]... <command> <args>
I tried all kinds of things on amqp:// and it dodn't work.
I got the answer at other site https://qpid.apache.org/releases/qpid-0.30/programming/book/QpidJNDI.html but I still wonder to know why this answer was not at the "man amqp-consume" or rabbitmq web site....
The command works for me is:
amqp-consume -d -u amqp://test:test#ustorageprod/%2f -q queue.udrive.admin.uiscsi -e "directExchangeUdrive" -r "" /bin/bash remoteManageUiSCSI.sh
amqp-publish -u amqp://test:test#ustorageprod/%2f -r "queue.udrive.ustorage" -e "directExchangeUdrive" -b "$msg"

Script works in the shell but not via GUI dd-wrt router

I have the following script working very well when I ssh into my dd-wrt router and issue the command
/opt/bin/curl --url "smtps://smtp.gmail.com:465" --ssl-reqd --mail-from "username#gmail.com" --mail-rcpt "username#gmail.com" --upload-file /mnt/mail.txt --user "username#gmail.com:password" --insecure
but when I issue the same commands via GUI; Administration/commands then the same script doesn't work.
any working solution will be a great help, thanks
Log in into the machine and type the command:
which sh
Put this value as a first line, preceding it with th #! characters, like
#!/bin/sh
What is your shell version? Look carefully at the first lines after you connected via ssh to your router. It's similar to:
BusyBox v1.15.3 (2011-11-24 00:44:20 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.
You may want to log the output of the command for debug purposes:
#!/bin/sh
/opt/bin/curl --url "smtps://smtp.gmail.com:465" --ssl-reqd --mail-from "username#gmail.com" --mail-rcpt "username#gmail.com" --upload-file /mnt/mail.txt --user "username#gmail.com:password" --insecure 2>&1 | logger -t $0
It will log the output using syslog facility. If it happens you have no syslog installed, you can log the output to a file:
#!/bin/sh
/opt/bin/curl --url "smtps://smtp.gmail.com:465" --ssl-reqd --mail-from "username#gmail.com" --mail-rcpt "username#gmail.com" --upload-file /mnt/mail.txt --user "username#gmail.com:password" --insecure >> /tmp/mylogfile 2>&1
Also, make sure, the script has an executable attribute set:
chmod a+rx /path/to/your/script

how to download weblinks using wget which do not end with .html?

I want to download this webpage using wget in Win7 : http://www.att.com/shop/wireless/devices/smartphones.deviceListView.xhr.flowtype-NEW.deviceGroupType-Cellphone.paymentType-postpaid.packageType-undefined.html?commitmentTerm=24&taxoStyle=SMARTPHONES&showMoreListSize=1000
I am using this command to do this :
wget -E -H -k -K -p -e robots=off -P /Downloads/AT&T_2013-01-29/ http://www.att.com/shop/wireless/devices/smartphones.deviceListView.xhr.flowtype-NEW.deviceGroupType-Cellphone.paymentType-postpaid.packageType-undefined.html?commitmentTerm=24&taxoStyle=SMARTPHONES&showMoreListSize=1000
I am getting taxostyle not defined, commitmentterm not defined or recognizble method error
Add quotes around address
wget -E -H -k -K -p -e robots=off -P "/Downloads/AT&T_2013-01-29/" "http://www.att.com/shop/wireless/devices/smartphones.deviceListView.xhr.flowtype-NEW.deviceGroupType-Cellphone.paymentType-postpaid.packageType-undefined.html?commitmentTerm=24&taxoStyle=SMARTPHONES&showMoreListSize=1000"
& is used as command separator in command window

Resources