Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Shhh...

Ryan Sechrest ryansechrest

:octocat:
Shhh...
View GitHub Profile
@ryansechrest
ryansechrest / server.md
Created Feb 19, 2014
Base server setup and configuration.
@ryansechrest
ryansechrest / httpd.conf
Created Mar 21, 2014
Default httpd configuration file.
View httpd.conf
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding
@ryansechrest
ryansechrest / sshd_config
Created Mar 21, 2014
Default sshd configuration file.
View sshd_config
# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
@ryansechrest
ryansechrest / commands.md
Last active Aug 29, 2015
Useful commands for CentOS.
View commands.md

Files

Find file

find . -name foobar.txt

-name FooBar — Filter by file name (case sensitive)

@ryansechrest
ryansechrest / programs.md
Last active Aug 29, 2015
Useful programs for CentOS 7.
View programs.md

Programs

firewall-cmd

firewalld command line client

View firewall state
firewall-cmd --state
@ryansechrest
ryansechrest / default.conf
Last active Sep 23, 2015
SSL Certificate Setup in Virtual Host
View default.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
Include vhosts.d/includes/domain.com.conf
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0
SSLCertificateChainFile /var/www/ssl/certificate-authority-default.crt
SSLCertificateFile /var/www/ssl/star.domain.com.crt
SSLCertificateKeyFile /var/www/ssl/star.domain.com.key
@ryansechrest
ryansechrest / rewritemap-sample.conf
Last active Dec 28, 2015
Virtual host file for port 80 that redirects 'www' alias to main domain, uses 'cronolog' to rotate error and access logs, redirects non-whitelisted hosts to main site, allows access to itself via URL-based cron jobs, and prompts users of permitted group for username and password via basic authentication. Also includes rewrite map to redirect dom…
View rewritemap-sample.conf
<VirtualHost *:80>
ServerName domain.com
RewriteEngine On
RewriteMap redirect_map_master txt:vhosts.d/includes/redirect_map_master
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteCond ${redirect_map_master:%2|domain.com} ^(.+)$ [NC]
RewriteRule ^/$ http://%1 [L,R=301]
</VirtualHost>
@ryansechrest
ryansechrest / vagrantfile-default
Created Dec 22, 2013
Default Vagrant box file running CentOS 6.4 x64 with Puppet.
View vagrantfile-default
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@ryansechrest
ryansechrest / post-receive.sh
Last active Feb 12, 2017
Git post-receive hook to deploy WordPress and plugins as submodules. It can also install Node.js modules with npm and vendor packages with Composer.
View post-receive.sh
#!/bin/bash
# Created on 7/17/13 by Ryan Sechrest
# Deploys pushed branch from the origin repository to the web directory
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then
# Set path to project directory
project_path="/var/www/domains/$2/$3"
@ryansechrest
ryansechrest / hello.py
Last active Oct 14, 2017
Create a Python command-line tool.
View hello.py
import click
@click.command()
def cli():
"""Example script."""
click.echo('Hello World!')