Skip to content

Instantly share code, notes, and snippets.

@heri16
Last active April 29, 2023 00:13
Show Gist options
  • Save heri16/1c744d4603db107b5e26fc2b167b9676 to your computer and use it in GitHub Desktop.
Save heri16/1c744d4603db107b5e26fc2b167b9676 to your computer and use it in GitHub Desktop.
Self-signed Cert for Netflix
#!/bin/bash
cat <<EOF > /usr/local/etc/Caddyfile
https://ipv4-c001-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c001-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c002-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c002-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c003-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c003-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c004-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c004-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c005-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c005-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c006-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c006-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c007-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c007-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c008-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c008-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c009-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c009-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c010-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c010-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c011-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c011-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c012-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c012-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c013-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c013-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c014-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c014-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c015-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c015-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c016-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c016-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c017-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c017-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c018-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c018-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c019-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https:/$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c019-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c020-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c020-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c021-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c021-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c022-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c022-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c023-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c023-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c024-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c024-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c025-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c025-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c026-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c026-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c027-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c027-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c028-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c028-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c029-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c029-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c030-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c030-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c031-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c031-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
https://ipv4-c032-sin001-ix.1.oca.nflxvideo.net {
tls /usr/local/etc/oca.nflxvideo.net.crt /usr/local/etc/oca.nflxvideo.net.key
proxy / https://$(dig @208.67.222.222 -p 443 +tcp +short ipv4-c032-sin001-ix.1.oca.nflxvideo.net) {
header_upstream Host {host}
insecure_skip_verify
}
}
EOF
################################
# Cloaking rules #
################################
# The following example rules force "safe" (without adult content) search
# results from Google, Bing and YouTube.
#
# This has to be enabled with the `cloaking_rules` parameter in the main
# configuration file
#www.google.* forcesafesearch.google.com
#www.bing.com strict.bing.com
#www.youtube.com restrictmoderate.youtube.com
#m.youtube.com restrictmoderate.youtube.com
#youtubei.googleapis.com restrictmoderate.youtube.com
#youtube.googleapis.com restrictmoderate.youtube.com
#www.youtube-nocookie.com restrictmoderate.youtube.com
*.oca.nflxvideo.net 127.0.0.1
################################
# Cloaking rules #
################################
*.oca.nflxvideo.net 192.168.1.2
##################################
# Forwarding rules #
##################################
## This is used to route specific domain names to specific servers.
## The general format is: <domain> <server address> [, <server address>...]
## Addresses can be IPv4 and IPv6, and include a non-standard port number.
## In order to enable this feature, the "forwarding_rules" property needs to
## be set to that file name in the main configuration file.
captive.apple.com 9.9.9.9,8.8.8.8
clients3.google.com 9.9.9.9,8.8.8.8
detectportal.firefox.com 9.9.9.9,8.8.8.8
www.google.com 9.9.9.9,8.8.8.8
#youtube.com 127.0.0.1:32000
#googlevideo.com 127.0.0.1:32000
##############################################
# #
# dnscrypt-proxy configuration #
# #
##############################################
## This is an example configuration file.
## You should adjust it to your needs, and save it as "dnscrypt-proxy.toml"
##
## Online documentation is available here: https://dnscrypt.info/doc
##################################
# Global settings #
##################################
## List of servers to use
## If this line is commented, all registered servers matching the require_* filters
## will be used
## The proxy will automatically pick the fastest, working servers from the list.
## Remove the leading # first to enable this; lines starting with # are ignored.
# server_names = ['scaleway-fr', 'google', 'yandex']
server_names = ['cloudflare', 'quad9-doh-ip4-nofilter-pri', 'quad9-doh-ip4-nofilter-alt', 'google', 'comodo-02']
## List of local addresses and ports to listen to. Can be IPv4 and/or IPv6.
## To only use systemd activation sockets, use an empty set: []
#listen_addresses = ['127.0.0.1:53', '[::1]:53']
listen_addresses = [':53']
## Maximum number of simultaneous client connections to accept
max_clients = 250
## Require servers (from static + remote sources) to satisfy specific properties
# Use servers reachable over IPv4
ipv4_servers = true
# Use servers reachable over IPv6 -- Do not enable if you don't have IPv6 connectivity
ipv6_servers = false
# Use servers implementing the DNSCrypt protocol
dnscrypt_servers = false
# Use servers implementing the DNS-over-HTTPS protocol
doh_servers = true
## Require servers defined by remote sources to satisfy specific properties
# Server must support DNS security extensions (DNSSEC)
require_dnssec = true
# Server must not log user queries (declarative)
require_nolog = false
# Server must not enforce its own blacklist (for parental control, ads blocking...)
require_nofilter = true
## Always use TCP to connect to upstream servers
force_tcp = false
## How long a DNS query will wait for a response, in milliseconds
timeout = 2500
## Load-balancing strategy: 'p2' (default), 'ph', 'fastest' or 'random'
# lb_strategy = 'p2'
## Log level (0-6, default: 2 - 0 is very verbose, 6 only contains fatal errors)
# log_level = 2
## log file for the application
# log_file = 'dnscrypt-proxy.log'
## Use the system logger (syslog on Unix, Event Log on Windows)
# use_syslog = true
## Delay, in minutes, after which certificates are reloaded
cert_refresh_delay = 240
## Fallback resolver
## This is a normal, non-encrypted DNS resolver, that will be only used
## for one-shot queries when retrieving the initial resolvers list, and
## only if the system DNS configuration doesn't work.
## No user application queries will ever be leaked through this resolver,
## and it will not be used after IP addresses of resolvers URLs have been found.
## It will never be used if lists have already been cached, and if stamps
## don't include host names without IP addresses.
## It will not be used if the configured system DNS works.
## A resolver supporting DNSSEC is recommended. This may become mandatory.
#fallback_resolver = '9.9.9.9:53'
fallback_resolver = '127.0.0.1:32000'
## Never try to use the system DNS settings; unconditionally use the
## fallback resolver.
ignore_system_dns = true
## Automatic log files rotation
# Maximum log files size in MB
log_files_max_size = 10
# Maximum log files age in days
log_files_max_age = 7
# Maximum log files backups to keep
log_files_max_backups = 1
#########################
# Filters #
#########################
## Immediately respond to IPv6-related queries with an empty response
## This makes things faster when there is no IPv6 connectivity, but can
## also cause reliability issues with some stub resolvers. In
## particular, enabling this on macOS is not recommended.
block_ipv6 = false
##################################################################################
# Route queries for specific domains to a dedicated set of servers #
##################################################################################
## Example map entries (one entry per line):
## example.com 9.9.9.9
## example.net 9.9.9.9,8.8.8.8
forwarding_rules = 'dnscrypt-forwarding-rules.txt'
###############################
# Cloaking rules #
###############################
## Cloaking returns a predefined address for a specific name.
## In addition to acting as a HOSTS file, it can also return the IP address
## of a different name. It will also do CNAME flattening.
##
## Example map entries (one entry per line)
## example.com 10.1.1.1
## www.google.com forcesafesearch.google.com
cloaking_rules = 'dnscrypt-cloaking-rules.txt'
###########################
# DNS cache #
###########################
## Enable a DNS cache to reduce latency and outgoing traffic
cache = true
## Cache size
cache_size = 256
## Minimum TTL for cached entries
cache_min_ttl = 60
## Maximum TTL for cached entries
cache_max_ttl = 86400
## TTL for negatively cached entries
cache_neg_ttl = 60
###############################
# Query logging #
###############################
## Log client queries to a file
[query_log]
## Path to the query log file (absolute, or relative to the same directory as the executable file)
# file = 'query.log'
## Query log format (currently supported: tsv and ltsv)
format = 'tsv'
## Do not log these query types, to reduce verbosity. Keep empty to log everything.
# ignored_qtypes = ['DNSKEY', 'NS']
############################################
# Suspicious queries logging #
############################################
## Log queries for nonexistent zones
## These queries can reveal the presence of malware, broken/obsolete applications,
## and devices signaling their presence to 3rd parties.
[nx_log]
## Path to the query log file (absolute, or relative to the same directory as the executable file)
# file = 'nx.log'
## Query log format (currently supported: tsv and ltsv)
format = 'tsv'
######################################################
# Pattern-based blocking (blacklists) #
######################################################
## Blacklists are made of one pattern per line. Example of valid patterns:
##
## example.com
## *sex*
## ads.*
## ads*.example.*
## ads*.example[0-9]*.com
##
## Example blacklist files can be found at https://download.dnscrypt.info/blacklists/
## A script to build blacklists from public feeds can be found in the
## `utils/generate-domains-blacklists` directory of the dnscrypt-proxy source code.
[blacklist]
## Path to the file of blocking rules (absolute, or relative to the same directory as the executable file)
# blacklist_file = 'blacklist.txt'
## Optional path to a file logging blocked queries
# log_file = 'blocked.log'
## Optional log format: tsv or ltsv (default: tsv)
# log_format = 'tsv'
###########################################################
# Pattern-based IP blocking (IP blacklists) #
###########################################################
## IP blacklists are made of one pattern per line. Example of valid patterns:
##
## 127.*
## fe80:abcd:*
## 192.168.1.4
[ip_blacklist]
## Path to the file of blocking rules (absolute, or relative to the same directory as the executable file)
# blacklist_file = 'ip-blacklist.txt'
## Optional path to a file logging blocked queries
# log_file = 'ip-blocked.log'
## Optional log format: tsv or ltsv (default: tsv)
# log_format = 'tsv'
##########################################
# Time access restrictions #
##########################################
## One or more weekly schedules can be defined here.
## Patterns in the name-based blocklist can optionally be followed with @schedule_name
## to apply the pattern 'schedule_name' only when it matches a time range of that schedule.
##
## For example, the following rule in a blacklist file:
## *.youtube.* @time-to-sleep
## would block access to Youtube only during the days, and period of the days
## define by the 'time-to-sleep' schedule.
##
## {after='21:00', before= '7:00'} matches 0:00-7:00 and 21:00-0:00
## {after= '9:00', before='18:00'} matches 9:00-18:00
[schedules]
# [schedules.'time-to-sleep']
# mon = [{after='21:00', before='7:00'}]
# tue = [{after='21:00', before='7:00'}]
# wed = [{after='21:00', before='7:00'}]
# thu = [{after='21:00', before='7:00'}]
# fri = [{after='23:00', before='7:00'}]
# sat = [{after='23:00', before='7:00'}]
# sun = [{after='21:00', before='7:00'}]
# [schedules.'work']
# mon = [{after='9:00', before='18:00'}]
# tue = [{after='9:00', before='18:00'}]
# wed = [{after='9:00', before='18:00'}]
# thu = [{after='9:00', before='18:00'}]
# fri = [{after='9:00', before='17:00'}]
#########################
# Servers #
#########################
## Remote lists of available servers
## Multiple sources can be used simultaneously, but every source
## requires a dedicated cache file.
##
## Refer to the documentation for URLs of public sources.
##
## A prefix can be prepended to server names in order to
## avoid collisions if different sources share the same for
## different servers. In that case, names listed in `server_names`
## must include the prefixes.
##
## If the `url` property is missing, cache files and valid signatures
## must be already present; This doesn't prevent these cache files from
## expiring after `refresh_delay` hours.
[sources]
## An example of a remote source
[sources.'public-resolvers']
url = 'https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md'
cache_file = 'public-resolvers.md'
minisign_key = 'RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3'
refresh_delay = 72
prefix = ''
## Another example source, with resolvers censoring some websites not appropriate for children
## This is a subset of the `public-resolvers` list, so enabling both is useless
# [sources.'parental-control']
# url = 'https://download.dnscrypt.info/resolvers-list/v2/parental-control.md'
# cache_file = 'parental-control.md'
# minisign_key = 'RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3'
## Optional, local, static list of additional servers
## Mostly useful for testing your own servers.
[static]
# [static.'google']
# stamp = 'sdns://AgUAAAAAAAAAACDyXGrcc5eNecJ8nomJCJ-q6eCLTEn6bHic0hWGUwYQaA5kbnMuZ29vZ2xlLmNvbQ0vZXhwZXJpbWVudGFs'

Copy the default template of openssl.cnf to a writable location.

cd /usr/local/etc
cp /System/Library/OpenSSL/openssl.cnf oca.nflxvideo.net.cnf

Uncomment the req_extensions = v3_req

req_extensions = v3_req # The extensions to add to a certificate request

Add subjectAltName to v3_req section

[ v3_req ]
 
# Extensions to add to a certificate request
 
basicConstraints = CA:TRUE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

Add the main hostname and the wildcard to a new [alt_names] section

[alt_names]
DNS.1 = *.oca.nflxvideo.net
DNS.2 = *.1.oca.nflxvideo.net

Run the following and fill all the essential information, especially the CN (Common Name):

openssl genrsa -des3 -out oca.nflxvideo.net.key 2048
openssl rsa -in oca.nflxvideo.net.key -out oca.nflxvideo.net.key
openssl req -new -key oca.nflxvideo.net.key -out oca.nflxvideo.net.csr
openssl x509 -req -extensions v3_req -days 365 -sha256 -in oca.nflxvideo.net.csr -signkey oca.nflxvideo.net.key -out oca.nflxvideo.net.crt -extfile oca.nflxvideo.net.cnf
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
# Extra OBJECT IDENTIFIER info:
#oid_file = $ENV::HOME/.oid
oid_section = new_oids
# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions =
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)
[ new_oids ]
# We can add new OIDs in here for use by 'ca' and 'req'.
# Add a simple OID like this:
# testoid1=1.2.3.4
# Or use config file substitution like this:
# testoid2=${testoid1}.5.6
####################################################################
[ ca ]
default_ca = CA_default # The default ca section
####################################################################
[ CA_default ]
dir = ./demoCA # Where everything is kept
certs = $dir/certs # Where the issued certs are kept
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
#unique_subject = no # Set to 'no' to allow creation of
# several ctificates with same subject.
new_certs_dir = $dir/newcerts # default place for new certs.
certificate = $dir/cacert.pem # The CA certificate
serial = $dir/serial # The current serial number
crlnumber = $dir/crlnumber # the current crl number
# must be commented out to leave a V1 CRL
crl = $dir/crl.pem # The current CRL
private_key = $dir/private/cakey.pem# The private key
RANDFILE = $dir/private/.rand # private random number file
x509_extensions = usr_cert # The extentions to add to the cert
# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt = ca_default # Subject Name options
cert_opt = ca_default # Certificate field options
# Extension copying option: use with caution.
# copy_extensions = copy
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions = crl_ext
default_days = 365 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = sha256 # which md to use.
preserve = no # keep passed DN ordering
# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
policy = policy_match
# For the CA policy
[ policy_match ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
####################################################################
[ req ]
default_bits = 1024
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
x509_extensions = v3_ca # The extentions to add to the self signed cert
# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret
# This sets a mask for permitted string types. There are several options.
# default: PrintableString, T61String, BMPString.
# pkix : PrintableString, BMPString.
# utf8only: only UTF8Strings.
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
# so use this option with caution!
string_mask = nombstr
req_extensions = v3_req # The extensions to add to a certificate request
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = AU
countryName_min = 2
countryName_max = 2
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = Some-State
localityName = Locality Name (eg, city)
0.organizationName = Organization Name (eg, company)
0.organizationName_default = Internet Widgits Pty Ltd
# we can do this but it is not needed normally :-)
#1.organizationName = Second Organization Name (eg, company)
#1.organizationName_default = World Wide Web Pty Ltd
organizationalUnitName = Organizational Unit Name (eg, section)
#organizationalUnitName_default =
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_max = 64
emailAddress = Email Address
emailAddress_max = 64
# SET-ex3 = SET extension number 3
[ req_attributes ]
challengePassword = A challenge password
challengePassword_min = 4
challengePassword_max = 20
unstructuredName = An optional company name
[ usr_cert ]
# These extensions are added when 'ca' signs a request.
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints=CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "OpenSSL Generated Certificate"
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
# Copy subject details
# issuerAltName=issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:TRUE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.oca.nflxvideo.net
DNS.2 = *.1.oca.nflxvideo.net
[ v3_ca ]
# Extensions for a typical CA
# PKIX recommendation.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer:always
# This is what PKIX recommends but some broken software chokes on critical
# extensions.
#basicConstraints = critical,CA:true
# So we do this instead.
basicConstraints = CA:true
# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign
# Some might want this also
# nsCertType = sslCA, emailCA
# Include email address in subject alt name: another PKIX recommendation
# subjectAltName=email:copy
# Copy issuer details
# issuerAltName=issuer:copy
# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, DER:30:03:01:01:FF
[ crl_ext ]
# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always,issuer:always
[ proxy_cert_ext ]
# These extensions should be added when creating a proxy certificate
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints=CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "OpenSSL Generated Certificate"
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
# Copy subject details
# issuerAltName=issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
# This really needs to be in place for it to be a proxy certificate.
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
-----BEGIN CERTIFICATE-----
MIIDDzCCAfegAwIBAgIJAL+TvpQCGGucMA0GCSqGSIb3DQEBCwUAMBwxGjAYBgNV
BAMMEW9jYS5uZmx4dmlkZW8ubmV0MB4XDTE4MTIxNjEwNDg0MFoXDTE5MTIxNjEw
NDg0MFowHDEaMBgGA1UEAwwRb2NhLm5mbHh2aWRlby5uZXQwggEiMA0GCSqGSIb3
DQEBAQUAA4IBDwAwggEKAoIBAQC+YB4C8NW5NUhICdtSLjsowpevbPtGMLXfry2L
UX4r8WEfinfy7HRvwaEM6NldcFWxiSFY/XSo8PH/Ss5PwD20YReKz5cWL4zdcht8
n8ScpGy7RpX6GbAnLmPyok9enLbO5/uz61FPIhS4wAsofiqIj7l6ED/9BSsan7vr
UiKJH+tnk/ZXAnMNxlhdLrRxdTTW8OtItqHOcw1ds+Ae8rjK4WW3O8P5ix1NDGew
P1adBm5vk+AhxM/GIZZsbDruBNpuCQSnBS7R6/ssg3AImlaPBPorWJckO3n0v1SP
4L9Hg/Gp7N6G099wF5a0IMvCCM0O5BYF+1tADFhZAkCUdtBdAgMBAAGjVDBSMAwG
A1UdEwQFMAMBAf8wCwYDVR0PBAQDAgXgMDUGA1UdEQQuMCyCEyoub2NhLm5mbHh2
aWRlby5uZXSCFSouMS5vY2EubmZseHZpZGVvLm5ldDANBgkqhkiG9w0BAQsFAAOC
AQEAf2l+ZbsP5ljjkbNvhdD8FXoxtwsxls1LrO33AVmmJx5C90M1exX2w2JvtKix
4KWfe2GkOIXBXARf4Up5cBnzX/91RMTFNB6trjdFLA4ixE2l3XCG59LU5B53fALZ
TM0851qMoyrwWlAYj53/ED7830tk0kHfdSbXuDbUQ3veiYDdd+9ugas1yZWlWbMA
tv4KIiFuwjuD/bOvGfm0p8O/aB3Zfm3drI8hdiQK44tMMgIgY2yFGlDunSgVkM4B
uFIWtssiEvRwwRaltWkbi6iWyPdhErDcC2GMqs5+5nSlTRM6EWOBpZQlVZPswfnD
XI8ORFcrLl6Mil++/J2m1bDmSA==
-----END CERTIFICATE-----
@heri16
Copy link
Author

heri16 commented Dec 16, 2018

Install Profile on iOS

  1. Open in Safari, and Install: oca.nflxvideo.net.crt

  2. Turn on SSL trust for that certificate, go to Settings > General > About > Certificate Trust Settings. Under "Enable full trust for root certificates," turn on trust for the certificate. See: https://support.apple.com/en-us/HT204477

Setup DNS resolver on iOS

  1. Open in Safari, and save this file locally or to iCloud Drive: dnscrypt-cloaking-rules2.txt (Select-All text -> Touch & hold -> Share -> Save to Files)

  2. Install DnsCloak from the iOS App Store, and go to DnsCrypt Settings -> Advanced options. Enable Cloaking & pick the rules file you saved in the previous step. This will route nflxvideo.net to 192.168.1.2

@heri16
Copy link
Author

heri16 commented Dec 16, 2018

Install Proxy on Linux

To setup Netflix reverse proxy 192.168.1.2 on your local network...

cd /usr/local/etc
wget https://gist.github.com/heri16/1c744d4603db107b5e26fc2b167b9676/raw/oca.nflxvideo.net.crt
wget https://gist.github.com/heri16/1c744d4603db107b5e26fc2b167b9676/raw/oca.nflxvideo.net.key
wget https://gist.github.com/heri16/1c744d4603db107b5e26fc2b167b9676/raw/Caddyfile.sh
bash ./Caddyfile.sh

brew install caddy
sudo brew services start caddy

Setup DNS resolver on Linux

To use Netflix from your Linux Google Chrome Browser...

cd /usr/local/etc
wget https://gist.github.com/heri16/1c744d4603db107b5e26fc2b167b9676/raw/dnscrypt-proxy.toml
wget https://gist.github.com/heri16/1c744d4603db107b5e26fc2b167b9676/raw/dnscrypt-cloaking-rules.txt
wget https://gist.github.com/heri16/1c744d4603db107b5e26fc2b167b9676/raw/dnscrypt-forwarding-rules.txt

brew install dnscrypt-proxy
sudo brew services start dnscrypt-proxy

cat <<EOF > /etc/resolv.conf
nameserver 127.0.0.1
nameserver ::1
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment