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
use partial_application::partial; | |
enum Ops { | |
Add, Sub, Div, Mult | |
} | |
fn calc(op: Ops, x: i32, y: i32) -> i32 { | |
match op { | |
Ops::Add => x + y, | |
Ops::Sub => x - y, |
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
#[macro_use] | |
extern crate partial_application; | |
enum Ops { | |
Add, Sub, Div, Mult | |
} | |
fn calc(op: Ops, x: i32, y: i32) -> i32 { | |
match op { | |
Ops::Add => x + y, |
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
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: spire-server | |
namespace: spire | |
labels: | |
app: spire-server | |
spec: | |
selector: |
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
static_resources: | |
listeners: | |
- name: listener_0 | |
address: | |
socket_address: { address: 0.0.0.0, port_value: 10000 } | |
... | |
clusters: | |
- name: secrets-metrics | |
... | |
tls_context: |
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 | |
# PLEASE DON'T DO THIS | |
set -x | |
for addr in $(nmap -n -sL 192.168.1.0/24 | grep "Nmap scan report" | awk '{print $NF}') | |
do | |
curl -G --connect-timeout 1 http://${addr}/metrics > ${addr} | |
done |
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
static_resources: | |
listeners: | |
- name: fluentd | |
address: | |
socket_address: { address: 0.0.0.0, port_value: 24224 } | |
filter_chains: | |
- filters: | |
- name: envoy.tcp_proxy | |
config: | |
stat_prefix: ingress_tcp |
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
static_resources: | |
listeners: | |
- name: fluentd | |
address: | |
socket_address: { address: 127.0.0.1, port_value: 24224 } | |
filter_chains: | |
- filters: | |
- name: envoy.tcp_proxy | |
config: | |
stat_prefix: ingress_tcp |
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
// Check password | |
if !verify_password(&user_info) { | |
audit_event( | |
ServerEvents::LoginFailureInvalidPassword, | |
&format!( | |
"Login failure for user {} due to invalid password", | |
user_info.username | |
), | |
); | |
unsuccessful_login_counter.inc(); |
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
- name: simple-secrets-metrics | |
address: | |
socket_address: { address: 0.0.0.0, port_value: 10000 } | |
... | |
tls_context: | |
common_tls_context: | |
tls_params: | |
ecdh_curves: "X25519:P-256:P-521:P-384" | |
tls_certificates: | |
certificate_chain: { "filename": "/certs/svid.pem" } |
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
fn main() { | |
... | |
let mut metrics_router = Router::new(); | |
metrics_router.get("/metrics", metrics, "get_metrics"); | |
let _metrics = Iron::new(metrics_router).http("127.0.0.1:3001"); | |
audit_event( | |
ServerEvents::Start, | |
&format!("New instance of secret-server started: {}", *SPIFFE_ID), | |
); |
NewerOlder