ssh -i "/path/to/cert.pem" [email protected]
# ...
# Traverse file directory to ~/.cloudflared
cd ~/.cloudflared
# Elevate to root permission
sudo su
# Temporarily append ec2-user PATH to root user path for duration of terminal session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
if( $found ){ | |
$remoteport = $matches[0]; | |
} else{ | |
echo "The Script Exited, the ip address of WSL 2 cannot be found"; | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Sample / prototype Worker snippet for bot management + KV + rate limiting | |
### Requires: | |
* Wrangler (https://github.com/cloudflare/wrangler) | |
* API key with Workers, and Workers KV write Permissions | |
```js | |
const CIDR = require('cidr-js') | |
const cidr = new CIDR() | |
/* |
- jq (https://stedolan.github.io/jq/)
- Cloudflare account email
- Cloudflare zone ID
- Cloudflare Global API key, which can be retrieved here:
- API documenation is available here: https://api.cloudflare.com/#waf-rules
Applies only to rules with Default mode Block or Challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cache API Docs + Example | |
- https://developers.cloudflare.com/workers/about/using-cache/ | |
- https://developers.cloudflare.com/workers/reference/apis/cache | |
```js | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
async function handleRequest(request) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- <!DOCTYPE html> Required --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- <title> Required --> | |
<title>Error Page</title> | |
<!-- The HTML file must contain at least 100 characters. An easy way to do that is to add the universal normalize.css snippet --> | |
<style> | |
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.backup | |
if [[ $# -ne 0 ]]; then | |
cat<<EOF | |
Usage: | |
$0 | |
DEV=eth0 $0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Demo: https://cloudflareworkers.com/#6168c0dbeb076f1e3ac7eb102082361f:https://www.google.com/ */ | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
function fromBinary(msg) { | |
const ui = new Uint8Array(msg.length) | |
for (let i = 0; i < msg.length; ++i) { | |
ui[i] = msg.charCodeAt(i) |
# force recursion back to root nameservers (helpful for bypassing caches)
dig www.cloudflare.com A +trace
# get the address(es) for yahoo.com
dig yahoo.com A +noall +answer
# get a list of yahoo's mail servers
dig yahoo.com MX +noall +answer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2020-11-19T17:31:19.906Z","extensionVersion":"v3.4.3"} |
NewerOlder