You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Forwards the NeuVector console to localhost:8443 and sends the job to the background
nohup kubectl port-forward svc/neuvector-service-webui \
8443:8443 -n neuvector \
> port-forward.log 2>&1&
export USERNAME=<USERNAME>export REMOTE_SERVER_IP=<REMOTE_SERVER_IP># Create an SSH tunnel to the remote server
ssh -NfL 8443:localhost:8443 \
$USERNAME@$REMOTE_SERVER_IP
# Restaurant ID 3 (Mediteranean)
curl -X POST -H "Content-Type: application/json" -d '{ "menu": [ { "name": "Greek Salad", "price": 10 }, { "name": "Zaatar", "price": 8 }, { "name": "Couscous", "price": 5 } ]}' http://menu.$INGRESS_IP.sslip.io/menu/3
# QR code for the mediterranean Restaurant
curl http://qr.$INGRESS_IP.sslip.io/qr/3 \
-o /tmp/qr-mediteranean.png
# Update the package list
kubectl exec -it \
$(kubectl get pods -l app=menu -o jsonpath='{.items[0].metadata.name}') \
-- apt-get update
# Install iputils-ping
kubectl exec -it \
$(kubectl get pods -l app=menu -o jsonpath='{.items[0].metadata.name}') \
-- apt-get install -y iputils-ping
Security Policy as Code (SPaC): Shifting Security Left
apiVersion: v1kind: Listitems:
# API version for NeuVector CRDs
- apiVersion: neuvector.com/v1 # Kind of object representing a security rule in NeuVectorkind: NvSecurityRulemetadata:
# Name of the rule; typically matches the group namename: nv.menu.default spec:
# Data Loss Prevention (DLP) settingsdlp:
settings: []status: true# Outbound traffic rules (Egress) configurationegress:
# First egress rule allows PostgreSQL communication
- action: allowapplications:
# The application associated with this rule
- PostgreSQL # Name of the egress rulename: nv.menu-postgresql.default-egress-0 # Specifies that the rule applies to all portsports: any # Rule priority (lower number means higher priority)priority: 0selector:
# Criteria to match traffic for this rulecriteria:
- key: serviceop: =value: menu-postgresql.default
- key: domainop: =value: default# The target group for this rulename: nv.menu-postgresql.default # Second egress rule allows DNS communication[... truncated]# File access rules configuration; # empty list indicates no file rules definedfile: []# Inbound traffic rules (Ingress) configurationingress:
# First ingress rule allows HTTP traffic from the ingress workload
- action: allowapplications:
# The application associated with this rule
- HTTP # Name of the ingress rulename: nv.menu.default-ingress-0 ports: anypriority: 0selector:
comment: ""# Matches traffic coming from the ingress workloadname: Workload:ingress original_name: ""# Second ingress rule allows HTTP traffic from a specific ingress-nginx controller[... truncated]# Process rules configurationprocess:
# Allow the pause process; this is a placeholder container process used by Kubernetes
- action: allowallow_update: false # Indicates that updates to this rule are not permittedname: pausepath: /pause# Allow the python process running at the specified path
- action: allowallow_update: falsename: pythonpath: /usr/local/bin/python3.9[... truncated]
WAF: Web Application Firewall
# This request should not be blockedwhiletrue;do curl -ILkv -H "Pass: 123456" \
http://wordpress.167.99.244.81.sslip.io/wp-login.php; sleep 2;done;# This request should be blockedwhiletrue;do curl -ILkv -H "Pass: 654321" \
http://wordpress.167.99.244.81.sslip.io/wp-login.php; sleep 2;done;
# This request should not be blockedwhiletrue;do curl -ILkv -H "Pass: 123456" \
http://wordpress.$INGRESS_IP.sslip.io/wp-login.php; \
sleep 2;done;# This request should be blockedwhiletrue;do curl -ILkv \
http://wordpress.$INGRESS_IP.sslip.io/wp-login.php; \
sleep 2;done;
Response Rules: Active Defense and Incident Response
# Install ngrok if you haven't already# https://ngrok.com/downloads/
ngrok http 3000
cat<<EOF>/tmp/webhook.py# Import necessary modules from FlaskfromflaskimportFlask, request# Initialize the Flask applicationapp=Flask(__name__)
# Define a route that catches all paths and methods@app.route('/', defaults={'path': ''}, methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])defcatch_all(path):
# Print the HTTP method usedprint(f"Method: {request.method}")
# Print the requested pathprint(f"Path: /{path}")
# Print all request headersprint(f"Headers: {dict(request.headers)}")
# Print the request bodyprint(f"Body: {request.get_data()}")
# Respond to the clientreturn"Request received", 200# Run the Flask app on all available IPs on port 300if__name__=='__main__':
app.run(host='0.0.0.0', port=3000)
EOF