Skip to content

Instantly share code, notes, and snippets.

View UlasSAYGINIM's full-sized avatar

Ulaş SAYGIN UlasSAYGINIM

View GitHub Profile
alias sw=etherswitchcfg
sw port0 striptag
sw port1 striptag
sw port1 pvid 2
sw port3 addtag
sw port4 addtag
sw vlangroup0 members 0,2,3,4
Result:
@RoyZhang7
RoyZhang7 / $TCP-notes.md
Last active March 8, 2022 13:37
TCP-notes

TCP notes

This gist contains all my note related to TCP.

But this file itself is only a placeholer. Nothing here.

@mizhka
mizhka / sysctl-tunables
Created June 4, 2019 09:40
FreeBSD 13-GENERIC-CURRENT tunables
kern.maxproc: Maximum number of processes
kern.ngroups: Maximum number of supplemental groups a user can belong to
kern.ipc.shm_allow_removed: Enable/Disable attachment to attached segments marked for removal
kern.ipc.shm_use_phys: Enable/Disable locking of shared memory pages in core
kern.ipc.shmall: Maximum number of pages available for shared memory
kern.ipc.shmseg: Number of segments per process
kern.ipc.shmmni: Number of shared memory identifiers
kern.ipc.shmmin: Minimum shared memory segment size
kern.ipc.shmmax: Maximum shared memory segment size
kern.ipc.semaem: Adjust on exit max value
[dan@slocum:~] $ sudo /usr/local/etc/periodic/security/405.pkg-base-audit
Checking for security vulnerabilities in base (userland & kernel):
Host system:
Database fetched: Sun Mar 17 14:29:28 UTC 2019
0 problem(s) in the installed packages found.
0 problem(s) in the installed packages found.
jail: test_nginx01
vulnxml file up-to-date
@kekru
kekru / 01nginx-tls-sni.md
Last active December 29, 2024 15:37
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@apptects
apptects / Receipt.swift
Created February 5, 2019 09:43
Send receipt validation request to server
struct ReceiptData: Codable {
let receipt: String
let sandbox: Bool
}
struct AppStoreValidationResult: Codable {
let status: Int
let environment: String
}

Enable macOS Server Performance Mode

Performance mode changes the system parameters of your Mac. These changes take better advantage of your hardware for demanding server applications.

A Mac with macOS Server that needs to run high-performance services can turn on performance mode to dedicate additional system resources for server applications. Note, however, that performance mode can be enabled even without macOS Server being installed to achieve similar benifits for other high-performance services.

sudo nvram boot-args="serverperfmode=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"
sudo reboot

Reference: https://support.apple.com/en-us/HT202528.

@allanjos
allanjos / ids-stream-freebsd.md
Last active August 5, 2020 16:46
IDS on FreeBSD

IDS

Flow of communication

snort -> syslog -> kafka

SYSLOG

Add to /etc/rc.conf:

#!/bin/sh
pkg install -y poudriere ccache git-lite
mkdir /var/cache/ccache
# edit poudriere.conf
echo "cache_dir = /var/cache/ccache" >>/usr/local/etc/ccache.conf
echo "CCACHE_DIR=/var/cache/ccache" >> /usr/local/etc/poudriere.conf
echo "ZPOOL=zroot" >> /usr/local/etc/poudriere.conf
# add your poudriere.conf options below
@cdcme
cdcme / sysctl.conf
Last active March 1, 2022 08:02
Some sysctl settings for performance and hardening on FreeBSD
# $FreeBSD: releng/11.1/etc/sysctl.conf 112200 2003-03-13 18:43:50Z mux $
#
# see https://calomel.org/freebsd_network_tuning.html
# https://www.c0ffee.net/blog/freebsd-server-guide
# https://en.wikipedia.org/wiki/TCP_tuning
# https://en.wikipedia.org/wiki/TCP_window_scale_option
# https://en.wikipedia.org/wiki/Bandwidth-delay_product
# https://www.freebsd.org/doc/handbook/configtuning-sysctl.html
# https://www.freebsd.org/cgi/man.cgi?query=sysctl&sektion=8&manpath=freebsd-release-ports
#