Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Last active January 5, 2023 16:59
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save githubutilities/361ef7e8e2060e9215d8 to your computer and use it in GitHub Desktop.
Save githubutilities/361ef7e8e2060e9215d8 to your computer and use it in GitHub Desktop.
cURL, git, ssl in Jailbreak iPhone

Change default shell

Editing /etc/passwd won't work in iOS, so in order to change default shell in iOS you need to edit /etc/master.passwd. You can change root's default shell to bash like this -- root:/smx7MYTQIi2M:0:0::0:0:System Administrator:/var/root:/bin/bash.

Reference

cURL in Jailbreak iPhone

By default, curl installed through cydia package made by Jay Freeman does not compile with default CA path which makes curl fails for HTTPS connection if not specifying ca file.

# Install curl
apt-get install curl

# Checkout your default ca path using `curl-config`
curl-config --ca

# Download certificate
curl -#o /etc/ssl/certs/cacert.pem http://curl.haxx.se/ca/cacert.pem

# Edit .curlrc
cat >> ~/.curlrc <<EOF
# Uncomment following line to disable curl's certficate verification
#insecure

cacert=/etc/ssl/certs/cacert.pem
cert-type=PEM
EOF

# Test it out
curl -fsSL https://raw.githubusercontent.com/githubutilities/dotfiles/ubuntu/.ubuntu/bootstrap.sh

Reference

git clone https repo in Jailbreak iPhone

Normally, without configuring git, we will get following error in Jailbreak iPhone.

git clone https://github.com/githubutilities/dotfiles.git
fatal: unable to access 'https://github.com/githubutilities/dotfiles.git/': SSL certificate problem: unable to get local issuer certificate

Script to fix this problem:

git config --global http.sslCAinfo /etc/ssl/certs/cacert.pem
# or you can write to system level if you want
# in which case git will write to $(prefix)/etc/gitconfig(NOTE: $(prefix) usually is /usr)
git config --system http.sslCAinfo /etc/ssl/certs/cacert.pem

# or editing .gitconfig file
cat >> ~/.gitconfig <<EOF
[http]
	sslCAinfo = /etc/ssl/certs/cacert.pem
EOF

# or in worse case, disable git's ssl verification
git config --global http.sslVerify false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment