the best security conf for nginx
# @author: @ricardo090489
# works in nginx/1.13.4 - OpenSSL 1.0.1t
# don't send the nginx version number in error pages and Server header
server_tokens off;
################################################################################### | |
# THIS GIST IS UNMAINTAINED AND ITS CONTENTS HAS BEEN MOVED TO THE FOLLOWING REPO # | |
# https://github.com/rbf/dotfiles/blob/master/git/.gitconfig # | |
################################################################################### | |
# The MIT License (MIT) | |
# | |
# Copyright (c) 2012-2018 https://gist.github.com/rbf | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of |
--- | |
# | |
# Detects the cloud provider on which the VM is running and sets accordingly the | |
# following variables: | |
# cloud_platform_is_aws=true when on AWS, false otherwise | |
# cloud_platform_is_gcp=true when on GCP, false otherwise | |
# cloud_platform_is_azure=true when on Azure, false otherwise | |
# cloud_platform_name: | |
# - 'azure' when on Azure | |
# - 'aws' when on AWS |
class Rack::Attack | |
# `Rack::Attack` is configured to use the `Rails.cache` value by default, | |
# but you can override that by setting the `Rack::Attack.cache.store` value | |
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new | |
# Always allow requests from localhost | |
# (blocklist & throttles are skipped) | |
Rack::Attack.safelist('allow from localhost') do |req| | |
'127.0.0.1' == req.ip || '::1' == req.ip |
# frozen_string_literal: true | |
class Rack::Attack | |
class Request < ::Rack::Request | |
def remote_ip | |
@remote_ip ||= (env['HTTP_CF_CONNECTING_IP'] || env['action_dispatch.remote_ip'] || ip).to_s | |
end | |
def allowed_ip? |
class AppConfig | |
class << self | |
# Lookup via | |
# https://www.ultratools.com/tools/ipWhoisLookupResult | |
# https://www.whatismyip.com/ip-whois-lookup/ | |
BLOCKED_IPS = Set.new( | |
[ | |
"6.5.4.3", | |
"5.4.3.2", | |
"4.3.2.1", |
#!/usr/bin/env bash | |
# | |
#### Source: http://www.taddong.com/tools/TLSSLed_v1.3.sh | |
# | |
# | |
# Tool: | |
# TLSSLed.sh | |
# | |
# Description: | |
# Script to extract the most relevant security details from a |
# Testing connection to remote host | |
echo | openssl s_client -connect google.com:443 -showcerts | |
# Testing connection to remote host (with SNI support) | |
echo | openssl s_client -showcerts -servername google.com -connect google.com:443 | |
# Testing connection to remote host with specific ssl version | |
openssl s_client -tls1_2 -connect google.com:443 | |
# Testing connection to remote host with specific ssl cipher |
#!/bin/bash | |
# usage: $0 source_dir [source_dir] ... | |
# where source_dir args are directories containing git repositories | |
red="\033[00;31m" | |
green="\033[00;32m" | |
yellow="\033[00;33m" | |
blue="\033[00;34m" | |
purple="\033[00;35m" |
// check version | |
node -v || node --version | |
// list installed versions of node (via nvm) | |
nvm ls | |
// install specific version of node | |
nvm install 6.9.2 | |
// set default version of node |