Skip to content

Instantly share code, notes, and snippets.

@floudet
floudet / ssh-chroot-jail.sh
Created June 19, 2016 11:57
Chroot Jail for SSH Access
# Chroot Jail for SSH Access
# Tested on Ubuntu 14.04.2 LTS and Debian GNU/Linux 8 (jessie)
# Reference : http://allanfeid.com/content/creating-chroot-jail-ssh-access
#
# Had to add/change several things to make it work, including:
# - create lib64 folder
# - copy whoami dependencies that ldd doesn't show to fix 'I have no name!'
# in the customized prompt + create passwd file
#
@floudet
floudet / telnet-rfc-5322-email.sh
Created July 17, 2016 14:45
Send a RFC 5322 compliant email using telnet
$ telnet mail.example.org 25
Trying XXX.XXX.XXX.XXX...
Connected to XXX.XXX.XXX.XXX.
Escape character is '^]'.
220 *********************************
ehlo server.example.org
250-mail.example.com
250-PIPELINING
250-SIZE 20480000
250-ETRN
@floudet
floudet / ssh-security-best-practices.md
Last active January 15, 2023 15:48
SSH Security Best Practices

SSH Security Best Practices

On /etc/ssh/sshd_config:

  1. Disable Root Logins

Best: PermitRootLogin no
Good: PermitRootLogin without-password (requires PubkeyAuthentication yes)

  1. Limit user Logins
@floudet
floudet / kitchen-docker-install-debian.sh
Created September 1, 2017 13:25
Installs kitchen with the docker provider on Debian
#!/bin/bash
#
# This script installs kitchen with the docker provider
# Using the docker provider allows to run this in a VM or an EC2 instance, which is not possible with Vagrant.
#
# Only tested on Debian GNU/Linux 8.8 (jessie)
#
# Resources:
# https://github.com/test-kitchen/test-kitchen
# https://github.com/test-kitchen/kitchen-docker
@floudet
floudet / box-token-requester.sh
Created September 28, 2017 03:19
Request OAuth2.0 Access tokens for Box.com using JWT
#!/bin/bash
#
# Request OAuth2.0 Access tokens for Box.com using JWT
#
# Thanks:
# https://developer.box.com/v2.0/docs/construct-jwt-claim-manually
# https://developer.box.com/v2.0/blog/box-tokener-a-nodejs-command-line-tool-to-generate-box-api-tokens
# http://willhaley.com/blog/generate-jwt-with-bash/
PRIVATE_KEY=""
@floudet
floudet / ss-deploy.sh
Created September 4, 2018 04:21
Deploys ShadowSocks on an Amazon EC2 instance
#!/bin/bash
#
# Deploys ShadowSocks on an Amazon EC2 instance
# Probably works on other cloud providers (not tested)
#
# Only tested on Ubuntu 16.04 LTS
#
## Note : To allow multiple clients, duplicate the configuration,
# specify different server_port (and password if required),
# and launch the new processes in the background
#!/bin/bash
#ls -1 /etc/shadowsocks/
#config_8082.json
#config_8083.json
#ss_process_manager.sh
#
#cat /etc/cron.d/shadowsocks
#* * * * * root /etc/shadowsocks/ss_process_manager.sh >/dev/null 2>&1
@floudet
floudet / ss_addconfig.sh
Created November 23, 2018 08:34
Interactive helper script to build a new config file for Shadowsocks
#!/bin/bash
#
# Interactive helper script to build a new config file for Shadowsocks
# Modifiable vars/defaults
SERVER="0.0.0.0"
LOCAL_PORT=1080
TIMEOUT=600
METHOD="chacha20"
PORTMIN=8000
@floudet
floudet / duckdns-letsencrypt-cherrypy.md
Last active April 29, 2020 05:46
Setup Letsencrypt and DuckDNS for a CherryPy web application

Setup DuckDNS and Letsencrypt for a CherryPy web application

Disclaimer: only tested on Ubuntu 18.04, with a single domain.

Set the DUCKDNS_TOKEN environment variable. For example create a /etc/profile.d/duckdns.sh file like :

export DUCKDNS_TOKEN='ab0cd123-4567-8ef9-012g-h345ij6k78lm'