Skip to content

Instantly share code, notes, and snippets.

View NewRedsquare's full-sized avatar
😴
Working from home

NewRedsquare

😴
Working from home
View GitHub Profile
@reefab
reefab / gist:3811608
Created October 1, 2012 12:50
Utiliser pfsense avec SFR Fibre
$dhclientconf = "";
if ($wanif == "rl2") {
$dhclientconf .= <<<EOD
interface "{$wanif}" {
timeout 60;
retry 1;
select-timeout 0;
send dhcp-class-identifier "neufbox5_NB5-SER-r1_NB5-MAIN-R2.2.2";
@patotoma
patotoma / ContactForm.md
Last active October 7, 2023 07:39
secure php contact form

Secured PHP Contact Form

<?php
  if(isset($_POST['submit'])){
    $name = htmlspecialchars(stripslashes(trim($_POST['name'])));
    $subject = htmlspecialchars(stripslashes(trim($_POST['subject'])));
    $email = htmlspecialchars(stripslashes(trim($_POST['email'])));
    $message = htmlspecialchars(stripslashes(trim($_POST['message'])));
    if(!preg_match("/^[A-Za-z .'-]+$/", $name)){
@jokey2k
jokey2k / sshfilter.sh
Last active April 22, 2024 14:18
Tuned version of sshfilter.sh to allow for ipv6 filtering
#!/bin/bash
# based on script from http://www.axllent.org/docs/view/ssh-geoip
# License: WTFPL
# UPPERCASE space-separated country codes to ACCEPT
ALLOW_COUNTRIES="DE EU GB"
LOGDENY_FACILITY="authpriv.notice"
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` <ip>" 1>&2
@loa
loa / README.md
Last active June 14, 2024 11:08
Dual GPG Yubikey Setup

Dual GPG Yubikey Setup

If you follow this guide you will end up with an offline and online Yubikey. Use your online Yubikey for everyday life, signing/encryption etc. Offline key for signing keys for web-of-trust and replace lost online keys.

Awesome tools with PGP keys:

  • mozilla/sops dead-simple local encryption of sensitive files
  • popass.pw password manager for you and your team stored in git

Offline Yubikey

@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@davivcgarcia
davivcgarcia / update-golang.sh
Last active April 7, 2024 18:36
Script automatically update local Golang runtime
#! /bin/bash
# Stops at the first error
set -e
# Checks if is running as root, and sudo if not
[ `whoami` = root ] || { sudo "$0" "$@"; exit $?; }
# Determines current local version
if [[ -f /usr/local/go/bin/go ]]; then
@sdiama
sdiama / althosting.txt
Last active October 13, 2023 21:00
A curated list of cheap "alternatives" to AWS, GCP, Azure hosting solutions
S3 Alternatives
---------------
- https://wasabi.com
- https://www.exoscale.com
- https://www.vultr.com
- https://www.arubacloud.com/
- https://www.digitalocean.com
- https://min.io/
- http://leo-project.net/
- https://www.backblaze.com/
@Greelan
Greelan / letsencrypt_notes.sh
Last active March 11, 2024 12:39 — forked from lachesis/letsencrypt_notes.sh
Set up Let’s Encrypt certificate using acme.sh as non-root user
# How to use acme.sh to set up Let's Encrypt, with the script being run
# mostly without root permissions
# See https://github.com/Neilpang/acme.sh for more
# These instructions use the domain "EXAMPLE.COM" as an example
# These instructions:
# - work on Ubuntu 18.04 and 20.04 with nginx
# - use CloudFlare DNS validation
@icedream
icedream / README.md
Last active March 29, 2024 20:57
Adjusting SELinux to change SSH port in Fedora CoreOS

See coreos/fedora-coreos-tracker#396 (comment) for a bit of explanation.

Warning: The script will trigger warning messages in the systemd journal log that look like this:

systemd[1]: sshd.service: Found left-over process 4270 (conmon) in control group while starting unit. Ignoring.
systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.

This is probably a side effect of the script booting up podman containers to run semanage - I don't know how to get rid of this properly if it's possible at all but I think this can be ignored for now.

SSH daemon can take quite a long while to start for the first time due to the one-time image build.

@heri16
heri16 / 90-mkinitcpio-install.hook.patch
Last active July 15, 2024 14:03
Enable Linux Secure Boot with TPM 2.0 (Manjaro / Archlinux) - rEFInd
--- /usr/share/libalpm/hooks/90-mkinitcpio-install.hook 2020-03-05 12:45:41.000000000 +0800
+++ /etc/pacman.d/hooks/90-mkinitcpio-install.hook 2020-06-13 23:08:32.861202141 +0800
@@ -8,5 +8,7 @@
[Action]
Description = Updating linux initcpios...
When = PostTransaction
-Exec = /usr/share/libalpm/scripts/mkinitcpio-install
+Exec = /usr/local/share/libalpm/scripts/mkinitcpio-install
+Depends = sbsigntools
+Depends = x11-ssh-askpass