Skip to content

Instantly share code, notes, and snippets.

View estelsmith's full-sized avatar

Estel Smith estelsmith

View GitHub Profile
@estelsmith
estelsmith / README.md
Last active July 4, 2022 13:57
Attempting to do name-based FTP proxying with Traefik

This is an attempt at using TLS-SNI to provide name-based routing to independent FTP servers.

Currently it fails because, while Traefik connects to the FTP server and passes data, TLS is terminated in Traefik and the FTP server requests TLS again using 421 TLS is required, confusing the client because it's already made a TLS connection.

Not requiring TLS on the FTP server causes data-transfer connections to fail when receiving the PASV command, because the FTP server expects an unencrypted data connection, whereas the client thinks it's connected via TLS and attempts to use TLS for both the control and data connections.

Attempting to switch from TLS-termination to TLS-passthrough in Traefik results in the FTP server failing because it wasn't expecting TLS to already be set up. FTP has protocol-specific requirements for upgrading from a plaintext to TLS connection.

@estelsmith
estelsmith / defer-js-snippets.php
Last active February 3, 2020 19:54
Helpful Code Snippets!
<?php
/**
* Plugin Name: CM Defer Inline JavaScript
* Description: Wraps all inline javascript to fire when document.readyState becomes interactive
*/
function cm_defer_js_script_wrapper()
{
$wrapper = <<<EOF
document.addEventListener('readystatechange', function () {
@estelsmith
estelsmith / emulator.games.user.js
Last active March 29, 2021 11:22
Updates the download button on emulator.games to ROM pages to link directly to the file download
// ==UserScript==
// @name emulator.games download
// @version 0.0.2
// @description Fixes the download button on emulator.games to actually download ROMs
// @author estelsmith
// @match https://emulator.games/roms/*/*/
// @grant none
// ==/UserScript==
(function($, romId) {