Skip to content

Instantly share code, notes, and snippets.

View thimslugga's full-sized avatar
👋

Adam Kaminski thimslugga

👋
View GitHub Profile
@thimslugga
thimslugga / domain-join.sh
Created June 10, 2023 15:03 — forked from declon/domain-join.sh
AWS - Ubuntu 18.04 - Join Self Hosted Active Directory
DOMAIN_USR=domainjoinusername
DOMAIN_PWD=domainjoinpassword
# get instance ID
ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
# install deps
DEBIAN_FRONTEND=noninteractive apt-get -y install sssd heimdal-clients msktutil
# set hostname
@thimslugga
thimslugga / rhel8_join_domain.sh
Last active May 3, 2025 02:34 — forked from xtonousou/gist:1d1311bbe2367343dab6b0035b8ad72e
Add Centos 7, 8 Machine into AD Domain. Integrate SSH authentication with Active Directory, manage sudoers via Active Directory, automatic group id mapping and sanitization. Automatic PTR record and DNS computer name. NETBIOS 15 characters max!
#! /usr/bin/env bash
#
# Configure Linux machine, add it to domain, configure SSH authentication via Active Directory
# Enter: sudo -i for root without auth if you add the domain user to domain group "sudoers" in
# AD/SOME_DIRECTORY or in any other child group of "sudoers".
#
# NOTES:
#
# Use Proxy to forward Internet traffic to target machine. yum needs it to download packages. In this example, a squid proxy is binded to 3128 port
# ssh -p 22 -R 3128:TARGET_IP:3128 -N root@TARGET_IP # run this locally to forward the traffic to the machine that will join the domain afterwards
#!/usr/bin/env bash
# It is simple script for joining linux system to windows Active Directory domain.
# I haven't tested it after the last edit...
# Attention!!! This script can completely broken your system!
# You should not use it if you don't know what you are doing!
# Determining the system in which the script runs.
if [[ `cat /etc/centos-release | cut -d' ' -f4 | cut -d. -f1` = 7 ]]; then
os="CentOS 7"

Join Linux to Active Directory (RHEL/CentOS)

Below is what an admin would do manually. You will need to adjust the variables to work for you, obviously. These steps are similar in debian based Linux distributions, but with a twist. I didn't document that here, as I didn't see the need. They are relatively minor changes.

  1. Export some variables that we'll need.
### Set your domain
export adauth_domain=YOURDOMAIN.LAB
@thimslugga
thimslugga / centos-7-automatic-persistent-net-rules.md
Last active May 3, 2025 02:35 — forked from Sugaroverdose/README.md
Automatic creation of 70-persistent-net.rules on CentOS 7 with net.ifnames=0 and biosdevname=0

Automatic creation of 70-persistent-net.rules on CentOS 7 with net.ifnames=0 and biosdevname=0

All quoted scripts are direct copy from latest CentOS 6

  • Logon under root or sudo -s

  • Create "/lib/udev/write_net_rules" file with content:

#!/bin/sh -e
#
# Copyright (C) 2006 Marco d'Itri <[email protected]>
@thimslugga
thimslugga / cmdbuild.sh
Created May 4, 2023 14:43 — forked from sinofool/cmdbuild.sh
A script to override xcode project configurations
#!/bin/bash
set -x
USAGE() {
cat << EOF
Usage: ${0##*/} <-i ident.p12> [-p password] <-m profile.mobileprovision> [-a com.example.app] [-n NewName] [-I Info.plist]
-i ident.p12 The signing identity file.
-p password The password of signing identity file.
-m profile.mobileprovision Signing provision profile
-a com.example.app Override CFBundleIdentifier

Decode a Linux Kernel Call Trace (kernel panic or kernel oops)

Kernel Call Trace

A Linux kernel call trace, like any traceback, call stack, stacktrace or backtrace, lists a most-recent-first chain of function calls which led to a crash. For the linux kernel, a crash is a panic or oops.

Without debug symbols, a kernel stack trace may come only with a line-by-line list of function symbols, e.g.

[ 844.569701][ T7073] Call Trace:
@thimslugga
thimslugga / create_rootfs.sh
Created November 30, 2022 22:59 — forked from fjkz/create_rootfs.sh
Create a rootfs environment for chroot building.
#!/bin/sh
#
# Create a rootfs environment for chroot building.
#
# Requires
# - OS installing CDROM at the current directory,
# - the root authority.
#
# mount install cd
@thimslugga
thimslugga / Dockerfile
Last active January 25, 2023 00:14 — forked from ju2wheels/Dockerfile
Docker Dockerfile reference template
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
# Parser Directives
#
#!/usr/bin/env bash
usage()
{
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND