Forticlient VPN from mac CLI - macos

I'd like to make a script to connect to different SSL VPN's from MAC OS X. I cannot find any info as to how to connect VPN's via command line? Can anyone please help me with this?
Thanks!

There is actually a way. First, install openfortivpn via brew:
brew install openfortivpn
Then, connect as such:
sudo openfortivpn <server_ip>:<server_port> -u <username> -p <password>

After some research I have come to conclusion there is no FortiClient CLI for MAC OS. In other words there is no commands for FortiClient in terminal. Still you can use terminal for Backup/Restore/Export for FortiClient VPN configuration. You can use this link for reference:
FortiClient XML Reference Guide

Related

ntpdate command not found in MacOS Mojave

I have a Bash script who update the time of my mac but since the update of Mojave the command isn't found:
ntpdate -u time.apple.com
return :
ntpdate: command not found
Where am I going wrong?
It's a duplicate. Please check this stackoverflow question.
TL;DR use sudo sntp -sS time.apple.com instead.
For anyone trying to do this because their vm cannot connect to the update server while trying to install macos on a virtual machine, I switched my network adapter from NAT to bridged and the issue was resolved.

Service command on Mac OS X

I used to be able to execute on the Mac OS X (10.10.5) command line:
$ sudo service tomcat7 status
However, I must have accidentally deleted the package associated with service command and I am unable to find the name of the service package to reinstall. Any pointers would be greatly helpful.
I can't find service in either /sbin/ or /bin/ or /usr/sbin/
I think you need launchctl.
sudo launchctl load /Library/LaunchDaemons/org.apache.tomcat.plist
See https://www.joel.lopes-da-silva.com/2008/05/13/installing-tomcat-on-mac-os-x/
If you want to start mysql on OSX which is installed through brew, please use this command:
brew services start mysql#5.6
Update the mysql version based on the system mysql version.

Homebrew installation on Mac OS X Failed to connect to raw.githubusercontent.com port 443

When I try to install Homebrew, I am getting following connection refused error. Please help me to solve this problem.
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Works for me. Unless its a real problem with github, which it may be but I'm going to guess that its not, its probably a problem with your connection.
Can you get to the same URL via a browser?
https://raw.githubusercontent.com/Homebrew/install/master/install
If you get an error there too, you know what your problem is. (Talk to your network admin)
If that works...maybe try doing just the "curl" command in your terminal to see if curl gives a more specific error?
Also, if that does work, save that file to a file on your computer (brew_install.rb) and then run it via
ruby brew_install.rb
If you are behind a proxy, try this:
sudo vim /etc/hosts
#add the line below and :wq
199.232.28.133 raw.githubusercontent.com
The accepted Answer is outdated now. But based on the answer I solved the problem by:
open the home page of brew https://brew.sh/
copy the URL from the install cmd and open it on your browser https://raw.githubusercontent.com/Homebrew/install/master/install.sh
right-click and save it to your computer
open a terminal and run it with: /bin/bash path-to/install.sh
It was a company proxy problem for me and the solution as mentioned here worked for me.
export HTTPS_PROXY=https://<proxy.mycompany>:<port>
git config --global https.proxy $HTTPS_PROXY
git config --global --get https.proxy
I had the same error,
- Disabled VPN
tried again installing without VPN
It worked for me.
There are several situations here, you can do following things :
reinstall the xcode command line tool by removing the old tools ($ rm -rf /Library/Developer/CommandLineTools) and xcode-select --install
request web page
https://raw.githubusercontent.com/Homebrew/install/master/install
then save it's content to shell file then run it.
change your DNS server to 8.8.8.8 (This is worked for me : ] )
Finally you should run /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
First try to open the link in the browser if it doesn't open then changing the DNS is the answer.
For me changing the DNS to 8.8.8.8 worked for me.
DNS settings can be searched for in the system setting which can be launched through spotlight in Mac OS and then changed.
This solved the pertinent issue for me.
I've seen this a few times on other people's machines and it seems to be fixed after you install xcode, i.e. xcode-select --install
The method of using ruby is probably outdated, as shown below:
As a better alternative, please set your computer's DNS server to 8.8.8.8
These steps solved the problem:
xcode-select --install
restart the Mac
Execute this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and it should work.
Check is https proxy is set
env|grep -I proxy
Then if it is set, remove the env variable
unset HTTPS_PROXY
I solved this problem by the following steps:
removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
Although saving the shell file locally and then running it can solve this problem, but you'll meet it again when you do something similar(e.g. install oh-my-zsh, vim-plug, etc.)
At last, I find the 3rd item of this answer(https://stackoverflow.com/a/61787208/5458745) works best for me, as it can also solve the problem I meet when installing other tools using curl. However instead of changing the DNS, I add 8.8.8.8 to my original DNS server list, which works fine for me.
Change your DNS server to 8.8.8.8 (This is worked for me)
I solved it.
You can visit https://github.com/Homebrew/install/blob/master/install.sh to get this install.sh by copy the whole contents.
Then paste it into install.sh and run sh install.sh.
A combination of what #blueskin mentioned first and then what #Ferenc Yim mentioned is what worked for me.
The script also requires sudo access (not necessarily run with a sudo prefix just need admin access)
sudo vim /etc/hosts
Once the vim code editor is open add the following line at end of the file
199.232.68.133 raw.githubusercontent.com

RabbitMmq on Mac can't start

I've installed rabbitmq on Mac OS X via homebrew, just a simple command:
$ brew install rabbitmq
but, when I start the server via rabbitmq-server, it occurs:
ERROR: distribution port 25672 in use on localhost (by non-Erlang process?)
I want to find some process that uses port 25672, but I can't find that really strange
anyone knows the reason, thx a lot :)
Use sudo lsof -i :25672 to find the process. sudo may or may not be needed depending on user permissions.

Setup local LDAP server in mac OSX

I've followed this (https://github.com/IntersectAustralia/acdata/wiki/Setting-up-OpenLDAP) tutorial for set up LDAP server in my local machine.
I've done all these steps
Installed Homebrew
Installed openldap using brew command, including berkeley db
Updated the slapd.conf file
Started the server using command "sudo /usr/local/libexec/slapd"
Now how do i know the LDAP server is running?
I tried a lot but i could'nt succeed,later i deiced to go with ADS (http://directory.apache.org/studio/). Its easy to set up. Believe me i made the installation and configuration in 5 mins. Thank you apache.
Use -d3 suffix.
Run sudo /usr/libexec/slapd -d3, it will show you the details.

Resources