-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
49 lines (40 loc) · 1.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ifplist := /Library/LaunchDaemons/ruled.io.ifconfig.plist
init := $(HOME)/.localdev
BREW_PREFIX := $(shell brew --prefix)
#.SILENT: all
.PHONY: all
all: $(init) caddyfile trust $(ifplist) restart
$(init):
echo "Setting up loopback for 127.0.0.2"
sudo ifconfig lo0 alias 127.0.0.2
echo "Setting up pf rules for 127.0.0.2:80 -> 8080 127.0.0.2:443 -> 8443 "
cat conf/pfrules.conf | sudo pfctl -a 'com.apple/localdev' -f -
echo "Reloading PF"
-sudo pfctl -F all -ef /etc/pf.conf
echo "Installing Brew Packages"
brew install caddy nss
touch $(init)
caddyfile:
echo "Setting Up Custom Caddyfile"
sudo cp conf/Caddyfile $(BREW_PREFIX)/etc/Caddyfile
$(ifplist):
echo "Setting up persistant loopback for 127.0.0.2"
sudo cp conf/ifconfig.plist $(ifplist)
logs:
tail -f $(BREW_PREFIX)/var/log/caddy.log
trust:
echo "Setting Up Caddy TLS Trust"
caddy trust
restart:
brew services restart caddy
stop:
brew services stop caddy
clean: stop
-sudo ifconfig lo0 -alias 127.0.0.2
-caddy untrust
-brew uninstall caddy nss
-sudo rm -rf $(ifplist)
-rm -rf $(init)
-rm -rf $(BREW_PREFIX)/etc/Caddyfile
-echo "" | sudo pfctl -a 'com.apple/localdev' -f -
-sudo pfctl -F all -ef /etc/pf.conf