From bb078eb6dcd67616e4e57b8df7cf8bc0dbd8ffa9 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sat, 18 Feb 2017 06:59:21 +0000 Subject: install update to crux 3.3 --- core/ports.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/ports.html') diff --git a/core/ports.html b/core/ports.html index 1d06877..230e284 100644 --- a/core/ports.html +++ b/core/ports.html @@ -20,7 +20,7 @@ Add a user that will be used by ports tools, this example pkgmk;

-        # useradd -U -m -d /usr/ports -s /bin/false pkgmk
+        # useradd -U -M -d /usr/ports -s /bin/false pkgmk
         

You can add your self to group pkgmk,

@@ -67,7 +67,7 @@

1.3.3. Configure pkgmk

-

Read 4.5. Adjust/Configure the Package Build Process +

Read 4.5. Adjust/Configure the Package Build Process to take advantage of your specific hardware. Packages build with native flag will not run on different hardware. This is the best choice if you want gcc to find the best settings based on your hardware.

-- cgit From 2a21a4806c13aa5d3c53c47d4754ebc9f0e58016 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sun, 19 Feb 2017 20:50:32 +0000 Subject: fix core install and ports --- core/conf/prt-get.conf | 2 +- core/ports.html | 2 +- core/scripts/setup-install.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core/ports.html') diff --git a/core/conf/prt-get.conf b/core/conf/prt-get.conf index 1a5d841..f6b6d16 100644 --- a/core/conf/prt-get.conf +++ b/core/conf/prt-get.conf @@ -38,7 +38,7 @@ logfile /usr/ports/pkgbuild/%n-%v-%r.log readme verbose # (verbose|compact|disabled) ### prefer higher versions in sysup / diff -preferhigher yes # (yes|no) +preferhigher no # (yes|no) ### use regexp search # useregex no # (yes|no) diff --git a/core/ports.html b/core/ports.html index 230e284..489e728 100644 --- a/core/ports.html +++ b/core/ports.html @@ -185,7 +185,7 @@ readme verbose # (verbose|compact|disabled) ### prefer higher versions in sysup / diff - preferhigher yes # (yes|no) + preferhigher no # (yes|no) ### use regexp search # useregex no # (yes|no) diff --git a/core/scripts/setup-install.sh b/core/scripts/setup-install.sh index ad5e76a..01e3bd1 100644 --- a/core/scripts/setup-install.sh +++ b/core/scripts/setup-install.sh @@ -237,7 +237,7 @@ setup_ports() { chroot $CHROOT /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ - /bin/bash -c "useradd -U -m -d /usr/ports -s /bin/false pkgmk" + /bin/bash -c "useradd -U -M -d /usr/ports -s /bin/false pkgmk" chroot $CHROOT /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ -- cgit From 0e7880313b3a3e016c0d2e287802cc6ddff9edd1 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Mon, 20 Feb 2017 09:06:21 +0000 Subject: core revision --- core/conf/fstab | 13 +- core/conf/pkgmk.conf | 4 +- core/conf/prt-get.conf | 4 +- core/conf/rc.d/wlan | 7 +- core/conf/sysctl.conf | 538 ++++++++++++++-- core/configure.html | 45 +- core/dash.html | 2 +- core/exim.html | 2 +- core/index.html | 38 +- core/linux.html | 676 +++++++++++++++++++-- core/network.html | 141 +---- core/package.html | 18 +- core/ports.html | 16 +- core/ports/linux-blob/.footprint | 107 ++-- core/ports/linux-blob/.md5sum | 10 +- core/ports/linux-blob/Pkgfile | 11 +- core/ports/linux-blob/config-c9 | 49 +- core/ports/linux-blob/port-blob-grsecurity.patch | 8 +- core/ports/linux-blob/port-blob-make.patch | 2 +- core/ports/linux-libre/.footprint | 107 ++-- core/ports/linux-libre/.md5sum | 10 +- core/ports/linux-libre/Pkgfile | 10 +- core/ports/linux-libre/config-c9 | 49 +- core/ports/linux-libre/port-libre-grsecurity.patch | 4 +- core/ports/linux-libre/port-libre-make.patch | 2 +- core/reboot.html | 106 +--- 26 files changed, 1417 insertions(+), 562 deletions(-) (limited to 'core/ports.html') diff --git a/core/conf/fstab b/core/conf/fstab index da3c9dd..d3fc878 100644 --- a/core/conf/fstab +++ b/core/conf/fstab @@ -13,9 +13,20 @@ #/dev/cdrom /cdrom iso9660 ro,user,noauto,unhide 0 0 #/dev/dvd /dvd udf ro,user,noauto,unhide 0 0 #/dev/floppy/0 /floppy vfat user,noauto,unhide 0 0 -devpts /dev/pts devpts noexec,nosuid,gid=tty,mode=0620 0 0 #tmp /tmp tmpfs defaults 0 0 #shm /dev/shm tmpfs defaults 0 0 #usb /proc/bus/usb usbfs defaults 0 0 # End of file +#/dev/sda3 on / type ext4 (rw,relatime,data=ordered) +#UUID=3bab76f8-e714-45f1-8e30-04cc8a09c3d1 / ext4 ro,relatime,data=ordered 0 1 +/dev/sda3 / ext4 defaults,noatime,ro 0 1 +devpts /dev/pts devpts noexec,nosuid,gid=tty,mode=0620 0 0 +UUID=3b408790-65e1-4638-9591-7ba61f266913 /boot ext4 defaults,ro,noatime 0 0 +UUID=962D-0DE1 /boot/efi vfat ro,noauto,umask=0077 0 0 +UUID=f2336a56-fbe6-444c-bdbf-f0e6c209c237 /var ext4 defaults,nodev,noexec,nosuid,errors=remount-ro 0 0 +UUID=20bd3948-0877-4192-af52-ad87d6f96db0 /usr ext4 defaults,ro,nodev,errors=remount-ro 0 0 +UUID=66c083d6-b8f2-4a98-ae55-9412f98cc089 /usr/ports ext4 defaults,ro,nodev,errors=remount-ro 0 0 +pkgmk /usr/ports/work tmpfs size=30G,gid=101,uid=100,defaults 0 0 +UUID=36e9e1d5-8356-451e-a301-81098b9a15ea /srv ext4 defaults,nodev,errors=remount-ro 0 0 +UUID=cd15196a-69f1-4fb4-9730-a384c62add91 /home ext4 defaults,nodev,nosuid,errors=remount-ro 0 0 diff --git a/core/conf/pkgmk.conf b/core/conf/pkgmk.conf index 3533ba7..4ef372e 100644 --- a/core/conf/pkgmk.conf +++ b/core/conf/pkgmk.conf @@ -2,7 +2,7 @@ # /etc/pkgmk.conf: pkgmk(8) configuration # -export CFLAGS="-O2 -march=x86-64" +export CFLAGS="-O2 -march=native -mtune=native" export CXXFLAGS="${CFLAGS}" export MAKEFLAGS="-j4" @@ -22,7 +22,7 @@ case ${PKGMK_ARCH} in ;; esac -PKGMK_SOURCE_MIRRORS=(http://crux.nu/distfiles/) +#PKGMK_SOURCE_MIRRORS=(http://crux.nu/distfiles/) PKGMK_SOURCE_DIR="/usr/ports/distfiles" PKGMK_PACKAGE_DIR="/usr/ports/packages" PKGMK_WORK_DIR="/usr/ports/work/$name" diff --git a/core/conf/prt-get.conf b/core/conf/prt-get.conf index f6b6d16..0504d3e 100644 --- a/core/conf/prt-get.conf +++ b/core/conf/prt-get.conf @@ -38,7 +38,7 @@ logfile /usr/ports/pkgbuild/%n-%v-%r.log readme verbose # (verbose|compact|disabled) ### prefer higher versions in sysup / diff -preferhigher no # (yes|no) +#preferhigher yes # (yes|no) ### use regexp search # useregex no # (yes|no) @@ -51,7 +51,7 @@ runscripts yes # (no|yes) ### EXPERT SECTION ### ### alternative commands -makecommand sudo -H -u pkgmk fakeroot pkgmk +makecommand sudo -H -u pkgmk -g pkgmk fakeroot pkgmk addcommand sudo pkgadd removecommand sudo pkgrm runscriptcommand sudo sh diff --git a/core/conf/rc.d/wlan b/core/conf/rc.d/wlan index 8800148..86910bc 100755 --- a/core/conf/rc.d/wlan +++ b/core/conf/rc.d/wlan @@ -15,7 +15,6 @@ PID_WIFI=/var/run/wpa_supplicant.pid OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV" OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV" - print_status() { $SSD --status --pidfile $2 case $? in @@ -35,7 +34,13 @@ case $1 in stop) ( $SSD --stop --retry 10 --pidfile $PID_DHCP $SSD --stop --retry 10 --pidfile $PID_WIFI ) + RETVAL=$? + /sbin/ip route del default dev ${DEV} + /sbin/ip route flush dev ${DEV} + /sbin/ip link set ${DEV} down + /sbin/ip addr flush dev ${DEV} + ;; restart) $0 stop diff --git a/core/conf/sysctl.conf b/core/conf/sysctl.conf index b419628..b60d3e6 100644 --- a/core/conf/sysctl.conf +++ b/core/conf/sysctl.conf @@ -3,20 +3,420 @@ # kernel.printk = 15 1 1 4 +kernel.randomize_va_space = 1 +kernel.shmmax = 500000000 +# Allow for more PIDs (to reduce rollover problems); may break some programs 32768 +kernel.pid_max = 65536 + +# +# Memory Protections +# + +# If you say Y here, all ioperm and iopl calls will return an error. +# Ioperm and iopl can be used to modify the running kernel. +# Unfortunately, some programs need this access to operate properly, +# the most notable of which are XFree86 and hwclock. hwclock can be +# remedied by having RTC support in the kernel, so real-time +# clock support is enabled if this option is enabled, to ensure +# that hwclock operates correctly. +# +# If you're using XFree86 or a version of Xorg from 2012 or earlier, +# you may not be able to boot into a graphical environment with this +# option enabled. In this case, you should use the RBAC system instead. +#kernel.grsecurity.disable_priv_io = 1 +kernel.grsecurity.disable_priv_io = 0 + +# If you say Y here, attempts to bruteforce exploits against forking +# daemons such as apache or sshd, as well as against suid/sgid binaries +# will be deterred. When a child of a forking daemon is killed by PaX +# or crashes due to an illegal instruction or other suspicious signal, +# the parent process will be delayed 30 seconds upon every subsequent +# fork until the administrator is able to assess the situation and +# restart the daemon. +# In the suid/sgid case, the attempt is logged, the user has all their +# existing instances of the suid/sgid binary terminated and will +# be unable to execute any suid/sgid binaries for 15 minutes. +# +# It is recommended that you also enable signal logging in the auditing +# section so that logs are generated when a process triggers a suspicious +# signal. +# If the sysctl option is enabled, a sysctl option with name +# "deter_bruteforce" is created. +#kernel.grsecurity.deter_bruteforce = 1 + +# +# Filesystem Protections +# + +# Optimization for port usefor LBs +# Increase system file descriptor limit +fs.file-max = 65535 + +# If you say Y here, /tmp race exploits will be prevented, since users +# will no longer be able to follow symlinks owned by other users in +# world-writable +t directories (e.g. /tmp), unless the owner of the +# symlink is the owner of the directory. users will also not be +# able to hardlink to files they do not own. If the sysctl option is +# enabled, a sysctl option with name "linking_restrictions" is created. +kernel.grsecurity.linking_restrictions = 1 + + +# Apache's SymlinksIfOwnerMatch option has an inherent race condition +# that prevents it from being used as a security feature. As Apache +# verifies the symlink by performing a stat() against the target of +# the symlink before it is followed, an attacker can setup a symlink +# to point to a same-owned file, then replace the symlink with one +# that targets another user's file just after Apache "validates" the +# symlink -- a classic TOCTOU race. If you say Y here, a complete, +# race-free replacement for Apache's "SymlinksIfOwnerMatch" option +# will be in place for the group you specify. If the sysctl option +# is enabled, a sysctl option with name "enforce_symlinksifowner" is +# created. +#kernel.grsecurity.enforce_symlinksifowner = 1 +#kernel.grsecurity.symlinkown_gid = 33 + +# if you say Y here, users will not be able to write to FIFOs they don't +# own in world-writable +t directories (e.g. /tmp), unless the owner of +# the FIFO is the same owner of the directory it's held in. If the sysctl +# option is enabled, a sysctl option with name "fifo_restrictions" is +# created. +#kernel.grsecurity.fifo_restrictions = 1 + +# If you say Y here, a sysctl option with name "romount_protect" will +# be created. By setting this option to 1 at runtime, filesystems +# will be protected in the following ways: +# * No new writable mounts will be allowed +# * Existing read-only mounts won't be able to be remounted read/write +# * Write operations will be denied on all block devices +# This option acts independently of grsec_lock: once it is set to 1, +# it cannot be turned off. Therefore, please be mindful of the resulting +# behavior if this option is enabled in an init script on a read-only +# filesystem. +# Also be aware that as with other root-focused features, GRKERNSEC_KMEM +# and GRKERNSEC_IO should be enabled and module loading disabled via +# config or at runtime. +# This feature is mainly intended for secure embedded systems. +#kernel.grsecurity.romount_protect = 0 + +# if you say Y here, the capabilities on all processes within a +# chroot jail will be lowered to stop module insertion, raw i/o, +# system and net admin tasks, rebooting the system, modifying immutable +# files, modifying IPC owned by another, and changing the system time. +# This is left an option because it can break some apps. Disable this +# if your chrooted apps are having problems performing those kinds of +# tasks. If the sysctl option is enabled, a sysctl option with +# name "chroot_caps" is created. +kernel.grsecurity.chroot_caps = 1 + +#kernel.grsecurity.chroot_deny_bad_rename = 1 + +# If you say Y here, processes inside a chroot will not be able to chmod +# or fchmod files to make them have suid or sgid bits. This protects +# against another published method of breaking a chroot. If the sysctl +# option is enabled, a sysctl option with name "chroot_deny_chmod" is +# created. +kernel.grsecurity.chroot_deny_chmod = 1 + +# If you say Y here, processes inside a chroot will not be able to chroot +# again outside the chroot. This is a widely used method of breaking +# out of a chroot jail and should not be allowed. If the sysctl +# option is enabled, a sysctl option with name +# "chroot_deny_chroot" is created. +kernel.grsecurity.chroot_deny_chroot = 1 + +# If you say Y here, a well-known method of breaking chroots by fchdir'ing +# to a file descriptor of the chrooting process that points to a directory +# outside the filesystem will be stopped. If the sysctl option +# is enabled, a sysctl option with name "chroot_deny_fchdir" is created. +kernel.grsecurity.chroot_deny_fchdir = 1 + +# If you say Y here, processes inside a chroot will not be allowed to +# mknod. The problem with using mknod inside a chroot is that it +# would allow an attacker to create a device entry that is the same +# as one on the physical root of your system, which could range from +# anything from the console device to a device for your harddrive (which +# they could then use to wipe the drive or steal data). It is recommended +# that you say Y here, unless you run into software incompatibilities. +# If the sysctl option is enabled, a sysctl option with name +# "chroot_deny_mknod" is created. +kernel.grsecurity.chroot_deny_mknod = 1 + +# If you say Y here, processes inside a chroot will not be able to +# mount or remount filesystems. If the sysctl option is enabled, a +# sysctl option with name "chroot_deny_mount" is created. +kernel.grsecurity.chroot_deny_mount = 1 + +# If you say Y here, processes inside a chroot will not be able to use +# a function called pivot_root() that was introduced in Linux 2.3.41. It +# works similar to chroot in that it changes the root filesystem. This +# function could be misused in a chrooted process to attempt to break out +# of the chroot, and therefore should not be allowed. If the sysctl +# option is enabled, a sysctl option with name "chroot_deny_pivot" is +# created. +kernel.grsecurity.chroot_deny_pivot = 1 + +# If you say Y here, processes inside a chroot will not be able to attach +# to shared memory segments that were created outside of the chroot jail. +# It is recommended that you say Y here. If the sysctl option is enabled, +# a sysctl option with name "chroot_deny_shmat" is created. +kernel.grsecurity.chroot_deny_shmat = 1 + +# If you say Y here, an attacker in a chroot will not be able to +# write to sysctl entries, either by sysctl(2) or through a /proc +# interface. It is strongly recommended that you say Y here. If the +# sysctl option is enabled, a sysctl option with name +# "chroot_deny_sysctl" is created. +kernel.grsecurity.chroot_deny_sysctl = 1 + +# If you say Y here, processes inside a chroot will not be able to +# connect to abstract (meaning not belonging to a filesystem) Unix +# domain sockets that were bound outside of a chroot. It is recommended +# that you say Y here. If the sysctl option is enabled, a sysctl option +# with name "chroot_deny_unix" is created. +kernel.grsecurity.chroot_deny_unix = 1 + +# If you say Y here, the current working directory of all newly-chrooted +# applications will be set to the the root directory of the chroot. +# The man page on chroot(2) states: +# Note that usually chhroot does not change the current working +# directory, so that `.' can be outside the tree rooted at +# `/'. In particular, the super-user can escape from a +# `chroot jail' by doing `mkdir foo; chroot foo; cd ..'. +# +# It is recommended that you say Y here, since it's not known to break +# any software. If the sysctl option is enabled, a sysctl option with +# name "chroot_enforce_chdir" is created. +kernel.grsecurity.chroot_enforce_chdir = 1 + +# If you say Y here, processes inside a chroot will not be able to +# kill, send signals with fcntl, ptrace, capget, getpgid, setpgid, +# getsid, or view any process outside of the chroot. If the sysctl +# option is enabled, a sysctl option with name "chroot_findtask" is +# created. +kernel.grsecurity.chroot_findtask = 1 + +# If you say Y here, processes inside a chroot will not be able to raise +# the priority of processes in the chroot, or alter the priority of +# processes outside the chroot. This provides more security than simply +# removing CAP_SYS_NICE from the process' capability set. If the +# sysctl option is enabled, a sysctl option with name "chroot_restrict_nice" +# is created. +kernel.grsecurity.chroot_restrict_nice = 1 + +# +# Kernel Auditing +# + +# If you say Y here, the exec and chdir logging features will only operate +# on a group you specify. This option is recommended if you only want to +# watch certain users instead of having a large amount of logs from the +# entire system. If the sysctl option is enabled, a sysctl option with +# name "audit_group" is created. +kernel.grsecurity.audit_group = 0 + +# If you say Y here, the exec and chdir logging features will only operate +# on a group you specify. This option is recommended if you only want to +# watch certain users instead of having a large amount of logs from the +# entire system. If the sysctl option is enabled, a sysctl option with +# name "audit_group" is created. +#kernel.grsecurity.audit_gid = 201 + +# If you say Y here, all execve() calls will be logged (since the +# other exec*() calls are frontends to execve(), all execution +# will be logged). Useful for shell-servers that like to keep track +# of their users. If the sysctl option is enabled, a sysctl option with +# name "exec_logging" is created. +# WARNING: This option when enabled will produce a LOT of logs, especially +# on an active system. +kernel.grsecurity.exec_logging = 0 + +# If you say Y here, all attempts to overstep resource limits will +# be logged with the resource name, the requested size, and the current +# limit. It is highly recommended that you say Y here. If the sysctl +# option is enabled, a sysctl option with name "resource_logging" is +# created. If the RBAC system is enabled, the sysctl value is ignored. +#kernel.grsecurity.resource_logging = 1 +kernel.grsecurity.resource_logging = 0 + +# If you say Y here, all executions inside a chroot jail will be logged +# to syslog. This can cause a large amount of logs if certain +# applications (eg. djb's daemontools) are installed on the system, and +# is therefore left as an option. If the sysctl option is enabled, a +# sysctl option with name "chroot_execlog" is created. +kernel.grsecurity.chroot_execlog = 0 + +# If you say Y here, all attempts to attach to a process via ptrace +# will be logged. If the sysctl option is enabled, a sysctl option +# with name "audit_ptrace" is created. +#kernel.grsecurity.audit_ptrace = 1 +kernel.grsecurity.audit_ptrace = 0 + +# If you say Y here, all attempts to attach to a process via ptrace +# will be logged. If the sysctl option is enabled, a sysctl option +# with name "audit_ptrace" is created. +kernel.grsecurity.audit_chdir = 0 + +# If you say Y here, all mounts and unmounts will be logged. If the +# sysctl option is enabled, a sysctl option with name "audit_mount" is +# created. +#kernel.grsecurity.audit_mount = 1 +kernel.grsecurity.audit_mount = 0 + +# If you say Y here, certain important signals will be logged, such as +# SIGSEGV, which will as a result inform you of when a error in a program +# occurred, which in some cases could mean a possible exploit attempt. +# If the sysctl option is enabled, a sysctl option with name +# "signal_logging" is created. +kernel.grsecurity.signal_logging = 0 + +# If you say Y here, all failed fork() attempts will be logged. +# This could suggest a fork bomb, or someone attempting to overstep +# their process limit. If the sysctl option is enabled, a sysctl option +# with name "forkfail_logging" is created. +#kernel.grsecurity.forkfail_logging = 1 +kernel.grsecurity.forkfail_logging = 0 + +# If you say Y here, any changes of the system clock will be logged. +# If the sysctl option is enabled, a sysctl option with name +# "timechange_logging" is created. +#kernel.grsecurity.timechange_logging = 1 + +# if you say Y here, calls to mmap() and mprotect() with explicit +# usage of PROT_WRITE and PROT_EXEC together will be logged when +# denied by the PAX_MPROTECT feature. This feature will also +# log other problematic scenarios that can occur when PAX_MPROTECT +# is enabled on a binary, like textrels and PT_GNU_STACK. If the +# sysctl option is enabled, a sysctl option with name "rwxmap_logging" +# is created. +#kernel.grsecurity.rwxmap_logging = 1 + +# +# Executable Protections +# + +# if you say Y here, non-root users will not be able to use dmesg(8) +# to view the contents of the kernel's circular log buffer. +# The kernel's log buffer often contains kernel addresses and other +# identifying information useful to an attacker in fingerprinting a +# system for a targeted exploit. +# If the sysctl option is enabled, a sysctl option with name "dmesg" is +# created. +kernel.grsecurity.dmesg = 1 + +# Hide symbol addresses in /proc/kallsyms +kernel.kptr_restrict = 1 + +# If you say Y here, TTY sniffers and other malicious monitoring +# programs implemented through ptrace will be defeated. If you +# have been using the RBAC system, this option has already been +# enabled for several years for all users, with the ability to make +# fine-grained exceptions. +# +# This option only affects the ability of non-root users to ptrace +# processes that are not a descendent of the ptracing process. +# This means that strace ./binary and gdb ./binary will still work, +# but attaching to arbitrary processes will not. If the sysctl +# option is enabled, a sysctl option with name "harden_ptrace" is +# created. +kernel.grsecurity.harden_ptrace = 1 + +# If you say Y here, unprivileged users will not be able to ptrace unreadable +# binaries. This option is useful in environments that +# remove the read bits (e.g. file mode 4711) from suid binaries to +# prevent infoleaking of their contents. This option adds +# consistency to the use of that file mode, as the binary could normally +# be read out when run without privileges while ptracing. +# +# If the sysctl option is enabled, a sysctl option with name "ptrace_readexec" +# is created. +kernel.grsecurity.ptrace_readexec = 1 + +# If you say Y here, a change from a root uid to a non-root uid +# in a multithreaded application will cause the resulting uids, +# gids, supplementary groups, and capabilities in that thread +# to be propagated to the other threads of the process. In most +# cases this is unnecessary, as glibc will emulate this behavior +# on behalf of the application. Other libcs do not act in the +# same way, allowing the other threads of the process to continue +# running with root privileges. If the sysctl option is enabled, +# a sysctl option with name "consistent_setxid" is created. +#kernel.grsecurity.consistent_setxid = 1 + +# If you say Y here, access to overly-permissive IPC objects (shared +# memory, message queues, and semaphores) will be denied for processes +# given the following criteria beyond normal permission checks: +# 1) If the IPC object is world-accessible and the euid doesn't match +# that of the creator or current uid for the IPC object +# 2) If the IPC object is group-accessible and the egid doesn't +# match that of the creator or current gid for the IPC object +# It's a common error to grant too much permission to these objects, +# with impact ranging from denial of service and information leaking to +# privilege escalation. This feature was developed in response to +# research by Tim Brown: +# http://labs.portcullis.co.uk/whitepapers/memory-squatting-attacks-on-system-v-shared-memory/ +# who found hundreds of such insecure usages. Processes with +# CAP_IPC_OWNER are still permitted to access these IPC objects. +# If the sysctl option is enabled, a sysctl option with name +# "harden_ipc" is created. +kernel.grsecurity.harden_ipc = 1 + +# If you say Y here, you will be able to choose a gid to add to the +# supplementary groups of users you want to mark as "untrusted." +# These users will not be able to execute any files that are not in +# root-owned directories writable only by root. If the sysctl option +# is enabled, a sysctl option with name "tpe" is created. +kernel.grsecurity.tpe = 1 +kernel.grsecurity.tpe_gid = 101 + +# If you say Y here, the group you specify in the TPE configuration will +# decide what group TPE restrictions will be *disabled* for. This +# option is useful if you want TPE restrictions to be applied to most +# users on the system. If the sysctl option is enabled, a sysctl option +# with name "tpe_invert" is created. Unlike other sysctl options, this +# entry will default to on for backward-compatibility. +kernel.grsecurity.tpe_invert = 1 + +# If you say Y here, all non-root users will be covered under +# a weaker TPE restriction. This is separate from, and in addition to, +# the main TPE options that you have selected elsewhere. Thus, if a +# "trusted" GID is chosen, this restriction applies to even that GID. +# Under this restriction, all non-root users will only be allowed to +# execute files in directories they own that are not group or +# world-writable, or in directories owned by root and writable only by +# root. If the sysctl option is enabled, a sysctl option with name +# "tpe_restrict_all" is created. +kernel.grsecurity.tpe_restrict_all = 0 + + +#kernel.grsecurity.harden_tty = 1 +# +# Network Protections +# + +# Increase Linux auto tuning TCP buffer limits +# min, default, and max number of bytes to use +# set max to at least 4MB, or higher if you use very high BDP paths +# Tcp Windows etc +net.core.rmem_max = 8388608 +net.core.wmem_max = 8388608 +net.core.netdev_max_backlog = 5000 +net.ipv4.tcp_window_scaling = 1 + +# Both ports linux-blob and linux-libre don't build with ipv6 # Disable ipv6 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 # Tuen IPv6 -net.ipv6.conf.default.router_solicitations = 0 -net.ipv6.conf.default.accept_ra_rtr_pref = 0 -net.ipv6.conf.default.accept_ra_pinfo = 0 -net.ipv6.conf.default.accept_ra_defrtr = 0 -net.ipv6.conf.default.autoconf = 0 -net.ipv6.conf.default.dad_transmits = 0 -net.ipv6.conf.default.max_addresses = 0 +#net.ipv6.conf.default.router_solicitations = 0 +#net.ipv6.conf.default.accept_ra_rtr_pref = 0 +#net.ipv6.conf.default.accept_ra_pinfo = 0 +#net.ipv6.conf.default.accept_ra_defrtr = 0 +#net.ipv6.conf.default.autoconf = 0 +#net.ipv6.conf.default.dad_transmits = 0 +#net.ipv6.conf.default.max_addresses = 0 # Avoid a smurf attack net.ipv4.icmp_echo_ignore_broadcasts = 1 @@ -56,8 +456,8 @@ net.ipv4.conf.default.accept_source_route = 0 ## protects from attackers that are using ip spoofing methods to do harm net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 -net.ipv6.conf.default.rp_filter = 1 -net.ipv6.conf.all.rp_filter = 1 +#net.ipv6.conf.default.rp_filter = 1 +#net.ipv6.conf.all.rp_filter = 1 # Make sure no one can alter the routing tables net.ipv4.conf.all.accept_redirects = 0 @@ -70,18 +470,6 @@ net.ipv4.ip_forward = 1 net.ipv4.conf.all.send_redirects = 1 net.ipv4.conf.default.send_redirects = 1 -kernel.shmmax = 500000000 -# Turn on execshild -kernel.exec-shield = 1 -kernel.randomize_va_space = 1 - -# Optimization for port usefor LBs -# Increase system file descriptor limit -fs.file-max = 65535 - -# Allow for more PIDs (to reduce rollover problems); may break some programs 32768 -kernel.pid_max = 65536 - # Increase system IP port limits net.ipv4.ip_local_port_range = 2000 65000 @@ -89,25 +477,99 @@ net.ipv4.ip_local_port_range = 2000 65000 net.ipv4.tcp_rmem = 4096 87380 8388608 net.ipv4.tcp_wmem = 4096 87380 8388608 -# Increase Linux auto tuning TCP buffer limits -# min, default, and max number of bytes to use -# set max to at least 4MB, or higher if you use very high BDP paths -# Tcp Windows etc -net.core.rmem_max = 8388608 -net.core.wmem_max = 8388608 -net.core.netdev_max_backlog = 5000 -net.ipv4.tcp_window_scaling = 1 -# Grsecurity stuff +# If you say Y here, neither TCP resets nor ICMP +# destination-unreachable packets will be sent in response to packets +# sent to ports for which no associated listening process exists. +# This feature supports both IPV4 and IPV6 and exempts the +# loopback interface from blackholing. Enabling this feature +# makes a host more resilient to DoS attacks and reduces network +# visibility against scanners. +# +# The blackhole feature as-implemented is equivalent to the FreeBSD +# blackhole feature, as it prevents RST responses to all packets, not +# just SYNs. Under most application behavior this causes no +# problems, but applications (like haproxy) may not close certain +# connections in a way that cleanly terminates them on the remote +# end, leaving the remote host in LAST_ACK state. Because of this +# side-effect and to prevent intentional LAST_ACK DoSes, this +# feature also adds automatic mitigation against such attacks. +# The mitigation drastically reduces the amount of time a socket +# can spend in LAST_ACK state. If you're using haproxy and not +# all servers it connects to have this option enabled, consider +# disabling this feature on the haproxy host. +# +# If the sysctl option is enabled, two sysctl options with names +# "ip_blackhole" and "lastack_retries" will be created. +# While "ip_blackhole" takes the standard zero/non-zero on/off +# toggle, "lastack_retries" uses the same kinds of values as +# "tcp_retries1" and "tcp_retries2". The default value of 4 +# prevents a socket from lasting more than 45 seconds in LAST_ACK +# state. +#kernel.grsecurity.ip_blackhole = 1 +#kernel.grsecurity.lastack_retries = 4 + +# If you say Y here, you will be able to choose a GID of whose users will +# be unable to connect to other hosts from your machine or run server +# applications from your machine. If the sysctl option is enabled, a +# sysctl option with name "socket_all" is created. +#kernel.grsecurity.socket_all = 1 + +# Here you can choose the GID to disable socket access for. Remember to +# add the users you want socket access disabled for to the GID +# specified here. If the sysctl option is enabled, a sysctl option +# with name "socket_all_gid" is created. +#kernel.grsecurity.socket_all_gid = 202 + +# If you say Y here, you will be able to choose a GID of whose users will +# be unable to connect to other hosts from your machine, but will be +# able to run servers. If this option is enabled, all users in the group +# you specify will have to use passive mode when initiating ftp transfers +# from the shell on your machine. If the sysctl option is enabled, a +# sysctl option with name "socket_client" is created. +#kernel.grsecurity.socket_client = 1 + +# Here you can choose the GID to disable client socket access for. +# Remember to add the users you want client socket access disabled for to +# the GID specified here. If the sysctl option is enabled, a sysctl +# option with name "socket_client_gid" is created. +#kernel.grsecurity.socket_client_gid = 203 + +# If you say Y here, you will be able to choose a GID of whose users will +# be unable to connect to other hosts from your machine, but will be +# able to run servers. If this option is enabled, all users in the group +# you specify will have to use passive mode when initiating ftp transfers +# from the shell on your machine. If the sysctl option is enabled, a +# sysctl option with name "socket_client" is created. +#kernel.grsecurity.socket_server = 1 + +# Here you can choose the GID to disable server socket access for. +# Remember to add the users you want server socket access disabled for to +# the GID specified here. If the sysctl option is enabled, a sysctl +# option with name "socket_server_gid" is created. +#kernel.grsecurity.socket_server_gid = 204 + +# +# Physical Protections +# + +# If you say Y here, a new sysctl option with name "deny_new_usb" +# will be created. Setting its value to 1 will prevent any new +# USB devices from being recognized by the OS. Any attempted USB +# device insertion will be logged. This option is intended to be +# used against custom USB devices designed to exploit vulnerabilities +# in various USB device drivers. +# +# For greatest effectiveness, this sysctl should be set after any +# relevant init scripts. This option is safe to enable in distros +# as each user can choose whether or not to toggle the sysctl. +#kernel.grsecurity.deny_new_usb = 0 + +# +# Restrict grsec sysctl changes after this was set +# +#kernel.grsecurity.grsec_lock = 1 -# cant chroot to outside chroot used to break chroot -kernel.grsecurity.chroot_deny_chroot = 1 -# function related to filesystems used to exploit -kernel.grsecurity.chroot_deny_pivot = 1 -# enforce current directory to chroot -kernel.grsecurity.chroot_enforce_chdir = 1 -# cant chmod inside chroot used to break chroot -kernel.grsecurity.chroot_deny_chmod = 0 # End of file diff --git a/core/configure.html b/core/configure.html index ffcb0f7..1ca655f 100644 --- a/core/configure.html +++ b/core/configure.html @@ -215,7 +215,7 @@ target partition, blkid list all while vol_id --uuid /dev/sdb1 returns only uuid. Add all block ids to the end of file - /etc/fstab + /etc/fstab;

@@ -223,27 +223,40 @@
         

Read Securing mount points, - and edit /etc/fstab according to your disk layout.

+ and edit /etc/fstab according to your disk layout. Blocks with uuid will later be created at lvm

         #
         # /etc/fstab: static file system information
         #
         # <file system>        <dir>     <type>    <options>                        <dump> <pass>
-        /dev/sda4 on / type ext4 (rw,relatime,data=ordered)
-        /dev/sda3 on /boot type ext4 (rw,relatime,data=ordered)
-        /dev/sda2 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
-        /dev/sda5 on /var type ext4 (rw,relatime,data=ordered)
-        /dev/sda6 on /usr type ext4 (rw,relatime,data=ordered)
-        /dev/sda8 on /home type ext4 (rw,relatime,data=ordered)
-
-        devtmpfs on /dev type devtmpfs (rw,nosuid,noatime,size=8192k,nr_inodes=16384,mode=755)
-        devpts on /dev/pts type devpts (rw,relatime,mode=600)
-        shm on /dev/shm type tmpfs (rw,relatime)
-        proc on /proc type proc (rw,relatime)
-        sysfs on /sys type sysfs (rw,relatime)
-
-        pkgmk                                           /usr/ports/work tmpfs size=30G,gid=102,uid=101,defaults 0    0
+
+        #/dev/#EXT4FS_ROOT#    /         ext4      defaults                         0      1
+        #/dev/#BTRFS_ROOT#     /         btrfs     defaults                         0      0
+        #/dev/#XFS_ROOT#       /         xfs       defaults                         0      0
+        #/dev/#SWAP#           swap      swap      defaults                         0      0
+        #/dev/#EXT4FS_HOME#    /home     ext4      defaults                         0      2
+        #/dev/#BTRFS_HOME#     /home     btrfs     defaults                         0      0
+        #/dev/#XFS_HOME#       /home     xfs       defaults                         0      0
+        #/dev/cdrom            /cdrom    iso9660   ro,user,noauto,unhide            0      0
+        #/dev/dvd              /dvd      udf       ro,user,noauto,unhide            0      0
+        #/dev/floppy/0         /floppy   vfat      user,noauto,unhide               0      0
+        #tmp                   /tmp      tmpfs     defaults                         0      0
+        #shm                   /dev/shm  tmpfs     defaults                         0      0
+        #usb                   /proc/bus/usb usbfs defaults                         0      0
+
+        /dev/sda3               / 		ext4	defaults,noatime,ro				0	1
+        devpts                  /dev/pts	devpts	noexec,nosuid,gid=tty,mode=0620			0	0
+        /dev/sda2               /boot	ext4	defaults,ro,noatime     		  		0	0
+        /dev/sda1               /boot/efi	vfat	ro,noauto,umask=0077      			0	0
+        /dev/sda4               /var		ext4	defaults,nodev,noexec,nosuid,errors=remount-ro  0	0
+        /dev/sda5               /usr		ext4	defaults,ro,nodev,errors=remount-ro		0	0
+
+        UUID=66c083d6-b8f2-4a98-ae55-9412f98cc089  /usr/ports	ext4	        defaults,ro,nodev,errors=remount-ro     0	0
+        pkgmk                                      /usr/ports/work tmpfs        size=30G,gid=101,uid=100,defaults       0       0
+        UUID=36e9e1d5-8356-451e-a301-81098b9a15ea  /srv		ext4	        defaults,nodev,errors=remount-ro	0	0
+        UUID=cd15196a-69f1-4fb4-9730-a384c62add91  /home        ext4            defaults,nodev,nosuid,errors=remount-ro	0	0
+
         # End of file
         
diff --git a/core/dash.html b/core/dash.html index 18045e5..ed6dbab 100644 --- a/core/dash.html +++ b/core/dash.html @@ -20,7 +20,7 @@ Core OS Index

This is part of the c9 Manual. - Copyright (C) 2016 + Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.

diff --git a/core/exim.html b/core/exim.html index c4b3c95..c1fd494 100644 --- a/core/exim.html +++ b/core/exim.html @@ -216,7 +216,7 @@ Core OS Index

This is part of the c9 Manual. - Copyright (C) 2016 + Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.

diff --git a/core/index.html b/core/index.html index bc8dad5..abff93d 100644 --- a/core/index.html +++ b/core/index.html @@ -59,8 +59,7 @@
  • 1.4. Prepare for reboot @@ -70,32 +69,33 @@

    2. System Administration

      -
    • 2.1. Network + +
    • 2.1. Linux Kernel
    • -
    • 2.2. Package Management +
    • 2.2. Network
    • -
    • 2.3. Linux Kernel +
    • 2.3. Package Management
    • diff --git a/core/linux.html b/core/linux.html index 53fc304..0304884 100644 --- a/core/linux.html +++ b/core/linux.html @@ -2,12 +2,12 @@ - 2.3. Kernel Linux + 2.1. Kernel Linux Core OS Index -

      2.3. Kernel Linux

      +

      2.1. Kernel Linux

      Linux is a monolith kernel, a big one ! Visit Linux Libre @@ -15,58 +15,41 @@ Linux Non-Libre pages for more links and information.

      -

      2.3.1. Port Linux Libre

      +

      2.1.1. Port Linux Libre

      -

      Collection c9-ports have linux-libre port with default crux - configuration, this port depends on dracut and grub but is not - required to install them. To build and install this port using - prt-get;

      +

      Default crux configuration can be obtained from iso, this port depends + on dracut and grub but is not required to install them. To build and install + this port using prt-get;

               $ prt-get depinst linux-libre
               
      -

      2.3.2. Manual Install

      +

      2.1.2. Manual Install

      Download Linux Source from linux libre, or using the port system;

      -
      -        $ cd /usr/ports/c9-ports/linux-libre
      -        $ sudo -u pkgmk pkgmk -do
      -        
      - -

      Crux iso comes with config that is used in this port, is - a good starting point to personalize according to your needs;

      +

      Crux iso comes with config that is more generic than used on linux-libre + port, crux default is a good starting point to personalize according to your + needs (build default, detect modules needed);

               $ mkdir ~/kernel
               $ cd ~/kernel
      -        $ cp /usr/ports/c9-ports/linux-libre/linux-4.1.32.defconfig .
      -        $ cp /usr/ports/distfiles/linux-libre-4.1.32-gnu.tar.xz .
      -        $ tar xf linux-libre-4.1.32-gnu.tar.xz
      -        $ cp linux-4.1.32.defconfig linux-4.1.32/.config
      +        $ cp /usr/ports/distfiles/linux-libre-4.9.11-gnu.tar.xz .
      +        $ tar xf linux-libre-4.9.11-gnu.tar.xz
      +        $ cd linux-4.9.11/
               
      -

      If you like graysky2 kernel_gcc_patch (download master) that adds more cpu options (FLAGS native)

      - -
      -        $ cp /usr/ports/distfiles/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch cpu_optimizations.patch
      -        
      - -
      -        $ cd ~/linux-4.1.32/
      -        $ patch -p1 < ../cpu_optimizations.patch
      -        patching file arch/x86/include/asm/module.h
      -        patching file arch/x86/Kconfig.cpu
      -        patching file arch/x86/Makefile
      -        Hunk #1 succeeded at 85 with fuzz 1 (offset -9 lines).
      -        patching file arch/x86/Makefile_32.cpu
      -        $
      -        
      - -

      Read Gresecurity.

      +

      Grsecurity patch for + 4.9.11. + Gcc graysky2 kernel_gcc_patch (master.zip) + that adds more cpu options (FLAGS native). + Check Pkgfile for instructions and + more patches used on linux-libre port. Read patching your kernel with + gresecurity.

      Configure kernel according to your current kernel hardware support;

      @@ -77,11 +60,10 @@

      This will disable all unloaded modules, you can use localyesconfig mark all loaded - to be built in the kernel.

      - -

      To get information about your hardware, - for example information about which graphic - module (driver) is in use as root run;

      + to be built in the kernel. To get information + about your hardware, for example information + about which graphic module (driver) is in use + as root run;

               # lspci -nnk | grep -i vga -A3 | grep 'in use'
      @@ -95,16 +77,16 @@
               
      -        $ make -j $(nproc) all
      +        $ make -j $(nproc) bzImage modules
               $ sudo make modules_install
      -        $ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.1.32-gnu_crux
      -        $ sudo cp System.map /boot/System.map-4.1.32-gnu_crux
      +        $ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.9.11-gnu
      +        $ sudo cp System.map /boot/System.map-4.9.11-gnu
               

      Create dracut initramfs;

      -        $sudo dracut --fstab /boot/initramfs-4.1.32-gnu_crux.img 4.1.32-gnu_crux
      +        $sudo dracut --fstab /boot/initramfs-4.9.11-gnu.img 4.9.11-gnu
               

      Update grub;

      @@ -113,17 +95,609 @@ # grub-mkconfig -o /boot/grub/grub.cfg -

      2.3.3. Manual Remove

      +

      2.1.3. Manual Remove

      -        $ sudo rm -r /lib/modules/4.1.12-gnu_crux
      -        $ sudo rm /boot/vmlinuz-4.1.12-gnu_crux
      -        $ sudo rm /boot/System.map-4.1.12-gnu_crux
      +        $ sudo rm -r /lib/modules/4.9.11-gnu
      +        $ sudo rm /boot/vmlinuz-4.9.11-gnu
      +        $ sudo rm /boot/System.map-4.9.11-gnu
               
      +

      2.1.4. Sysctl

      + +

      Sysctl references + Arch TCP/IP stack hardening, + Cyberciti Nginx Hardning, + Cyberciti Security Hardening, + Grsecurity and PaX Configuration.

      + +

      Since kernels on c9-ports have PaX + and grsecurity, + /etc/sysctl.conf can have follow + values;

      + +
      +        #
      +        # /etc/sysctl.conf: configuration for system variables, see sysctl.conf(5)
      +        #
      +
      +        kernel.printk = 15 1 1 4
      +        kernel.randomize_va_space = 1
      +        kernel.shmmax = 500000000
      +        # Allow for more PIDs (to reduce rollover problems); may break some programs 32768
      +        kernel.pid_max = 65536
      +
      +        #
      +        # Memory Protections
      +        #
      +
      +        #  If you say Y here, all ioperm and iopl calls will return an error.
      +        #  Ioperm and iopl can be used to modify the running kernel.
      +        #  Unfortunately, some programs need this access to operate properly,
      +        #  the most notable of which are XFree86 and hwclock.  hwclock can be
      +        #  remedied by having RTC support in the kernel, so real-time
      +        #  clock support is enabled if this option is enabled, to ensure
      +        #  that hwclock operates correctly.
      +        #
      +        #  If you're using XFree86 or a version of Xorg from 2012 or earlier,
      +        #  you may not be able to boot into a graphical environment with this
      +        #  option enabled.  In this case, you should use the RBAC system instead.
      +        #kernel.grsecurity.disable_priv_io = 1
      +        kernel.grsecurity.disable_priv_io = 0
      +
      +        #  If you say Y here, attempts to bruteforce exploits against forking
      +        #  daemons such as apache or sshd, as well as against suid/sgid binaries
      +        #  will be deterred.  When a child of a forking daemon is killed by PaX
      +        #  or crashes due to an illegal instruction or other suspicious signal,
      +        #  the parent process will be delayed 30 seconds upon every subsequent
      +        #  fork until the administrator is able to assess the situation and
      +        #  restart the daemon.
      +        #  In the suid/sgid case, the attempt is logged, the user has all their
      +        #  existing instances of the suid/sgid binary terminated and will
      +        #  be unable to execute any suid/sgid binaries for 15 minutes.
      +        #
      +        #  It is recommended that you also enable signal logging in the auditing
      +        #  section so that logs are generated when a process triggers a suspicious
      +        #  signal.
      +        #  If the sysctl option is enabled, a sysctl option with name
      +        #  "deter_bruteforce" is created.
      +        #kernel.grsecurity.deter_bruteforce = 1
      +
      +        #
      +        # Filesystem Protections
      +        #
      +
      +        # Optimization for port usefor LBs
      +        # Increase system file descriptor limit
      +        fs.file-max = 65535
      +
      +        #  If you say Y here, /tmp race exploits will be prevented, since users
      +        #  will no longer be able to follow symlinks owned by other users in
      +        #  world-writable +t directories (e.g. /tmp), unless the owner of the
      +        #  symlink is the owner of the directory. users will also not be
      +        #  able to hardlink to files they do not own.  If the sysctl option is
      +        #  enabled, a sysctl option with name "linking_restrictions" is created.
      +        kernel.grsecurity.linking_restrictions = 1
      +
      +
      +        #  Apache's SymlinksIfOwnerMatch option has an inherent race condition
      +        #  that prevents it from being used as a security feature.  As Apache
      +        #  verifies the symlink by performing a stat() against the target of
      +        #  the symlink before it is followed, an attacker can setup a symlink
      +        #  to point to a same-owned file, then replace the symlink with one
      +        #  that targets another user's file just after Apache "validates" the
      +        #  symlink -- a classic TOCTOU race.  If you say Y here, a complete,
      +        #  race-free replacement for Apache's "SymlinksIfOwnerMatch" option
      +        #  will be in place for the group you specify. If the sysctl option
      +        #  is enabled, a sysctl option with name "enforce_symlinksifowner" is
      +        #  created.
      +        #kernel.grsecurity.enforce_symlinksifowner = 1
      +        #kernel.grsecurity.symlinkown_gid = 33
      +
      +        #  if you say Y here, users will not be able to write to FIFOs they don't
      +        #  own in world-writable +t directories (e.g. /tmp), unless the owner of
      +        #  the FIFO is the same owner of the directory it's held in.  If the sysctl
      +        #  option is enabled, a sysctl option with name "fifo_restrictions" is
      +        #  created.
      +        #kernel.grsecurity.fifo_restrictions = 1
      +
      +        #  If you say Y here, a sysctl option with name "romount_protect" will
      +        #  be created.  By setting this option to 1 at runtime, filesystems
      +        #  will be protected in the following ways:
      +        #  * No new writable mounts will be allowed
      +        #  * Existing read-only mounts won't be able to be remounted read/write
      +        #  * Write operations will be denied on all block devices
      +        #  This option acts independently of grsec_lock: once it is set to 1,
      +        #  it cannot be turned off.  Therefore, please be mindful of the resulting
      +        #  behavior if this option is enabled in an init script on a read-only
      +        #  filesystem.
      +        #  Also be aware that as with other root-focused features, GRKERNSEC_KMEM
      +        #  and GRKERNSEC_IO should be enabled and module loading disabled via
      +        #  config or at runtime.
      +        #  This feature is mainly intended for secure embedded systems.
      +        #kernel.grsecurity.romount_protect = 0
      +
      +        #  if you say Y here, the capabilities on all processes within a
      +        #  chroot jail will be lowered to stop module insertion, raw i/o,
      +        #  system and net admin tasks, rebooting the system, modifying immutable
      +        #  files, modifying IPC owned by another, and changing the system time.
      +        #  This is left an option because it can break some apps.  Disable this
      +        #  if your chrooted apps are having problems performing those kinds of
      +        #  tasks.  If the sysctl option is enabled, a sysctl option with
      +        #  name "chroot_caps" is created.
      +        kernel.grsecurity.chroot_caps = 1
      +
      +        #kernel.grsecurity.chroot_deny_bad_rename = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to chmod
      +        #  or fchmod files to make them have suid or sgid bits.  This protects
      +        #  against another published method of breaking a chroot.  If the sysctl
      +        #  option is enabled, a sysctl option with name "chroot_deny_chmod" is
      +        #  created.
      +        kernel.grsecurity.chroot_deny_chmod     = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to chroot
      +        #  again outside the chroot.  This is a widely used method of breaking
      +        #  out of a chroot jail and should not be allowed.  If the sysctl
      +        #  option is enabled, a sysctl option with name
      +        #  "chroot_deny_chroot" is created.
      +        kernel.grsecurity.chroot_deny_chroot    = 1
      +
      +        #  If you say Y here, a well-known method of breaking chroots by fchdir'ing
      +        #  to a file descriptor of the chrooting process that points to a directory
      +        #  outside the filesystem will be stopped.  If the sysctl option
      +        #  is enabled, a sysctl option with name "chroot_deny_fchdir" is created.
      +        kernel.grsecurity.chroot_deny_fchdir = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be allowed to
      +        #  mknod.  The problem with using mknod inside a chroot is that it
      +        #  would allow an attacker to create a device entry that is the same
      +        #  as one on the physical root of your system, which could range from
      +        #  anything from the console device to a device for your harddrive (which
      +        #  they could then use to wipe the drive or steal data).  It is recommended
      +        #  that you say Y here, unless you run into software incompatibilities.
      +        #  If the sysctl option is enabled, a sysctl option with name
      +        #  "chroot_deny_mknod" is created.
      +        kernel.grsecurity.chroot_deny_mknod = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to
      +        #  mount or remount filesystems.  If the sysctl option is enabled, a
      +        #  sysctl option with name "chroot_deny_mount" is created.
      +        kernel.grsecurity.chroot_deny_mount = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to use
      +        #  a function called pivot_root() that was introduced in Linux 2.3.41.  It
      +        #  works similar to chroot in that it changes the root filesystem.  This
      +        #  function could be misused in a chrooted process to attempt to break out
      +        #  of the chroot, and therefore should not be allowed.  If the sysctl
      +        #  option is enabled, a sysctl option with name "chroot_deny_pivot" is
      +        #  created.
      +        kernel.grsecurity.chroot_deny_pivot     = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to attach
      +        #  to shared memory segments that were created outside of the chroot jail.
      +        #  It is recommended that you say Y here.  If the sysctl option is enabled,
      +        #  a sysctl option with name "chroot_deny_shmat" is created.
      +        kernel.grsecurity.chroot_deny_shmat = 1
      +
      +        #  If you say Y here, an attacker in a chroot will not be able to
      +        #  write to sysctl entries, either by sysctl(2) or through a /proc
      +        #  interface.  It is strongly recommended that you say Y here. If the
      +        #  sysctl option is enabled, a sysctl option with name
      +        #  "chroot_deny_sysctl" is created.
      +        kernel.grsecurity.chroot_deny_sysctl = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to
      +        #  connect to abstract (meaning not belonging to a filesystem) Unix
      +        #  domain sockets that were bound outside of a chroot.  It is recommended
      +        #  that you say Y here.  If the sysctl option is enabled, a sysctl option
      +        #  with name "chroot_deny_unix" is created.
      +        kernel.grsecurity.chroot_deny_unix = 1
      +
      +        #  If you say Y here, the current working directory of all newly-chrooted
      +        #  applications will be set to the the root directory of the chroot.
      +        #  The man page on chroot(2) states:
      +        #  Note that usually chhroot does not change  the  current  working
      +        #  directory,  so  that `.' can be outside the tree rooted at
      +        #  `/'.  In particular, the  super-user  can  escape  from  a
      +        #  `chroot jail' by doing `mkdir foo; chroot foo; cd ..'.
      +        #
      +        #  It is recommended that you say Y here, since it's not known to break
      +        #  any software.  If the sysctl option is enabled, a sysctl option with
      +        #  name "chroot_enforce_chdir" is created.
      +        kernel.grsecurity.chroot_enforce_chdir  = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to
      +        #  kill, send signals with fcntl, ptrace, capget, getpgid, setpgid,
      +        #  getsid, or view any process outside of the chroot.  If the sysctl
      +        #  option is enabled, a sysctl option with name "chroot_findtask" is
      +        #  created.
      +        kernel.grsecurity.chroot_findtask = 1
      +
      +        #  If you say Y here, processes inside a chroot will not be able to raise
      +        #  the priority of processes in the chroot, or alter the priority of
      +        #  processes outside the chroot.  This provides more security than simply
      +        #  removing CAP_SYS_NICE from the process' capability set.  If the
      +        #  sysctl option is enabled, a sysctl option with name "chroot_restrict_nice"
      +        #  is created.
      +        kernel.grsecurity.chroot_restrict_nice = 1
      +
      +        #
      +        # Kernel Auditing
      +        #
      +
      +        #  If you say Y here, the exec and chdir logging features will only operate
      +        #  on a group you specify.  This option is recommended if you only want to
      +        #  watch certain users instead of having a large amount of logs from the
      +        #  entire system.  If the sysctl option is enabled, a sysctl option with
      +        #  name "audit_group" is created.
      +        kernel.grsecurity.audit_group = 0
      +
      +        #  If you say Y here, the exec and chdir logging features will only operate
      +        #  on a group you specify.  This option is recommended if you only want to
      +        #  watch certain users instead of having a large amount of logs from the
      +        #  entire system.  If the sysctl option is enabled, a sysctl option with
      +        #  name "audit_group" is created.
      +        #kernel.grsecurity.audit_gid = 201
      +
      +        #  If you say Y here, all execve() calls will be logged (since the
      +        #  other exec*() calls are frontends to execve(), all execution
      +        #  will be logged).  Useful for shell-servers that like to keep track
      +        #  of their users.  If the sysctl option is enabled, a sysctl option with
      +        #  name "exec_logging" is created.
      +        #  WARNING: This option when enabled will produce a LOT of logs, especially
      +        #  on an active system.
      +        kernel.grsecurity.exec_logging = 0
      +
      +        #  If you say Y here, all attempts to overstep resource limits will
      +        #  be logged with the resource name, the requested size, and the current
      +        #  limit.  It is highly recommended that you say Y here.  If the sysctl
      +        #  option is enabled, a sysctl option with name "resource_logging" is
      +        #  created.  If the RBAC system is enabled, the sysctl value is ignored.
      +        #kernel.grsecurity.resource_logging = 1
      +        kernel.grsecurity.resource_logging = 0
      +
      +        #  If you say Y here, all executions inside a chroot jail will be logged
      +        #  to syslog.  This can cause a large amount of logs if certain
      +        #  applications (eg. djb's daemontools) are installed on the system, and
      +        #  is therefore left as an option.  If the sysctl option is enabled, a
      +        #  sysctl option with name "chroot_execlog" is created.
      +        kernel.grsecurity.chroot_execlog = 0
      +
      +        #  If you say Y here, all attempts to attach to a process via ptrace
      +        #  will be logged.  If the sysctl option is enabled, a sysctl option
      +        #  with name "audit_ptrace" is created.
      +        #kernel.grsecurity.audit_ptrace = 1
      +        kernel.grsecurity.audit_ptrace = 0
      +
      +        #  If you say Y here, all attempts to attach to a process via ptrace
      +        #  will be logged.  If the sysctl option is enabled, a sysctl option
      +        #  with name "audit_ptrace" is created.
      +        kernel.grsecurity.audit_chdir = 0
      +
      +        #  If you say Y here, all mounts and unmounts will be logged.  If the
      +        #  sysctl option is enabled, a sysctl option with name "audit_mount" is
      +        #  created.
      +        #kernel.grsecurity.audit_mount = 1
      +        kernel.grsecurity.audit_mount = 0
      +
      +        #  If you say Y here, certain important signals will be logged, such as
      +        #  SIGSEGV, which will as a result inform you of when a error in a program
      +        #  occurred, which in some cases could mean a possible exploit attempt.
      +        #  If the sysctl option is enabled, a sysctl option with name
      +        #  "signal_logging" is created.
      +        kernel.grsecurity.signal_logging = 0
      +
      +        #  If you say Y here, all failed fork() attempts will be logged.
      +        #  This could suggest a fork bomb, or someone attempting to overstep
      +        #  their process limit.  If the sysctl option is enabled, a sysctl option
      +        #  with name "forkfail_logging" is created.
      +        #kernel.grsecurity.forkfail_logging = 1
      +        kernel.grsecurity.forkfail_logging = 0
      +
      +        #  If you say Y here, any changes of the system clock will be logged.
      +        #  If the sysctl option is enabled, a sysctl option with name
      +        #  "timechange_logging" is created.
      +        #kernel.grsecurity.timechange_logging = 1
      +
      +        #  if you say Y here, calls to mmap() and mprotect() with explicit
      +        #  usage of PROT_WRITE and PROT_EXEC together will be logged when
      +        #  denied by the PAX_MPROTECT feature.  This feature will also
      +        #  log other problematic scenarios that can occur when PAX_MPROTECT
      +        #  is enabled on a binary, like textrels and PT_GNU_STACK.  If the
      +        #  sysctl option is enabled, a sysctl option with name "rwxmap_logging"
      +        #  is created.
      +        #kernel.grsecurity.rwxmap_logging = 1
      +
      +        #
      +        # Executable Protections
      +        #
      +
      +
      +        #  if you say Y here, non-root users will not be able to use dmesg(8)
      +        #  to view the contents of the kernel's circular log buffer.
      +        #  The kernel's log buffer often contains kernel addresses and other
      +        #  identifying information useful to an attacker in fingerprinting a
      +        #  system for a targeted exploit.
      +        #  If the sysctl option is enabled, a sysctl option with name "dmesg" is
      +        #  created.
      +        kernel.grsecurity.dmesg = 1
      +
      +        # Hide symbol addresses in /proc/kallsyms
      +        kernel.kptr_restrict = 1
      +
      +        #  If you say Y here, TTY sniffers and other malicious monitoring
      +        #  programs implemented through ptrace will be defeated.  If you
      +        #  have been using the RBAC system, this option has already been
      +        #  enabled for several years for all users, with the ability to make
      +        #  fine-grained exceptions.
      +        #
      +        #  This option only affects the ability of non-root users to ptrace
      +        #  processes that are not a descendent of the ptracing process.
      +        #  This means that strace ./binary and gdb ./binary will still work,
      +        #  but attaching to arbitrary processes will not.  If the sysctl
      +        #  option is enabled, a sysctl option with name "harden_ptrace" is
      +        #  created.
      +        kernel.grsecurity.harden_ptrace = 1
      +
      +        #  If you say Y here, unprivileged users will not be able to ptrace unreadable
      +        #  binaries.  This option is useful in environments that
      +        #  remove the read bits (e.g. file mode 4711) from suid binaries to
      +        #  prevent infoleaking of their contents.  This option adds
      +        #  consistency to the use of that file mode, as the binary could normally
      +        #  be read out when run without privileges while ptracing.
      +        #
      +        #  If the sysctl option is enabled, a sysctl option with name "ptrace_readexec"
      +        #  is created.
      +        kernel.grsecurity.ptrace_readexec = 1
      +
      +        #  If you say Y here, a change from a root uid to a non-root uid
      +        #  in a multithreaded application will cause the resulting uids,
      +        #  gids, supplementary groups, and capabilities in that thread
      +        #  to be propagated to the other threads of the process.  In most
      +        #  cases this is unnecessary, as glibc will emulate this behavior
      +        #  on behalf of the application.  Other libcs do not act in the
      +        #  same way, allowing the other threads of the process to continue
      +        #  running with root privileges.  If the sysctl option is enabled,
      +        #  a sysctl option with name "consistent_setxid" is created.
      +        #kernel.grsecurity.consistent_setxid = 1
      +
      +        #  If you say Y here, access to overly-permissive IPC objects (shared
      +        #  memory, message queues, and semaphores) will be denied for processes
      +        #  given the following criteria beyond normal permission checks:
      +        #  1) If the IPC object is world-accessible and the euid doesn't match
      +        #     that of the creator or current uid for the IPC object
      +        #  2) If the IPC object is group-accessible and the egid doesn't
      +        #     match that of the creator or current gid for the IPC object
      +        #  It's a common error to grant too much permission to these objects,
      +        #  with impact ranging from denial of service and information leaking to
      +        #  privilege escalation.  This feature was developed in response to
      +        #  research by Tim Brown:
      +        #  http://labs.portcullis.co.uk/whitepapers/memory-squatting-attacks-on-system-v-shared-memory/
      +        #  who found hundreds of such insecure usages.  Processes with
      +        #  CAP_IPC_OWNER are still permitted to access these IPC objects.
      +        #  If the sysctl option is enabled, a sysctl option with name
      +        #  "harden_ipc" is created.
      +        kernel.grsecurity.harden_ipc = 1
      +
      +        #  If you say Y here, you will be able to choose a gid to add to the
      +        #  supplementary groups of users you want to mark as "untrusted."
      +        #  These users will not be able to execute any files that are not in
      +        #  root-owned directories writable only by root.  If the sysctl option
      +        #  is enabled, a sysctl option with name "tpe" is created.
      +        kernel.grsecurity.tpe = 1
      +        kernel.grsecurity.tpe_gid = 101
      +
      +        #  If you say Y here, the group you specify in the TPE configuration will
      +        #  decide what group TPE restrictions will be *disabled* for.  This
      +        #  option is useful if you want TPE restrictions to be applied to most
      +        #  users on the system.  If the sysctl option is enabled, a sysctl option
      +        #  with name "tpe_invert" is created.  Unlike other sysctl options, this
      +        #  entry will default to on for backward-compatibility.
      +        kernel.grsecurity.tpe_invert = 1
      +
      +        #  If you say Y here, all non-root users will be covered under
      +        #  a weaker TPE restriction.  This is separate from, and in addition to,
      +        #  the main TPE options that you have selected elsewhere.  Thus, if a
      +        #  "trusted" GID is chosen, this restriction applies to even that GID.
      +        #  Under this restriction, all non-root users will only be allowed to
      +        #  execute files in directories they own that are not group or
      +        #  world-writable, or in directories owned by root and writable only by
      +        #  root.  If the sysctl option is enabled, a sysctl option with name
      +        #  "tpe_restrict_all" is created.
      +        kernel.grsecurity.tpe_restrict_all = 0
      +
      +
      +        #kernel.grsecurity.harden_tty = 1
      +        #
      +        # Network Protections
      +        #
      +
      +        # Increase Linux auto tuning TCP buffer limits
      +        # min, default, and max number of bytes to use
      +        # set max to at least 4MB, or higher if you use very high BDP paths
      +        # Tcp Windows etc
      +        net.core.rmem_max = 8388608
      +        net.core.wmem_max = 8388608
      +        net.core.netdev_max_backlog = 5000
      +        net.ipv4.tcp_window_scaling = 1
      +
      +        # Both ports linux-blob and linux-libre don't build with ipv6
      +        # Disable ipv6
      +        net.ipv6.conf.all.disable_ipv6 = 1
      +        net.ipv6.conf.default.disable_ipv6 = 1
      +        net.ipv6.conf.lo.disable_ipv6 = 1
      +
      +        # Tuen IPv6
      +        #net.ipv6.conf.default.router_solicitations = 0
      +        #net.ipv6.conf.default.accept_ra_rtr_pref = 0
      +        #net.ipv6.conf.default.accept_ra_pinfo = 0
      +        #net.ipv6.conf.default.accept_ra_defrtr = 0
      +        #net.ipv6.conf.default.autoconf = 0
      +        #net.ipv6.conf.default.dad_transmits = 0
      +        #net.ipv6.conf.default.max_addresses = 0
      +
      +        # Avoid a smurf attack
      +        net.ipv4.icmp_echo_ignore_broadcasts = 1
      +
      +        # Turn on protection for bad icmp error messages
      +        net.ipv4.icmp_ignore_bogus_error_responses = 1
      +
      +        # Turn on syncookies for SYN flood attack protection
      +        net.ipv4.tcp_syncookies = 1
      +
      +        ## protect against tcp time-wait assassination hazards
      +        ## drop RST packets for sockets in the time-wait state
      +        ## (not widely supported outside of linux, but conforms to RFC)
      +        net.ipv4.tcp_rfc1337 = 1
      +
      +        ## tcp timestamps
      +        ## + protect against wrapping sequence numbers (at gigabit speeds)
      +        ## + round trip time calculation implemented in TCP
      +        ## - causes extra overhead and allows uptime detection by scanners like nmap
      +        ## enable @ gigabit speeds
      +        net.ipv4.tcp_timestamps = 0
      +        #net.ipv4.tcp_timestamps = 1
      +
      +        # Turn on and log spoofed, source routed, and redirect packets
      +        net.ipv4.conf.all.log_martians = 1
      +        net.ipv4.conf.default.log_martians = 1
      +
      +        ## ignore echo broadcast requests to prevent being part of smurf attacks (default)
      +        net.ipv4.icmp_echo_ignore_broadcasts = 1
      +
      +        # No source routed packets here
      +        net.ipv4.conf.all.accept_source_route = 0
      +        net.ipv4.conf.default.accept_source_route = 0
      +
      +        ## sets the kernels reverse path filtering mechanism to value 1(on)
      +        ## will do source validation of the packet's recieved from all the interfaces on the machine
      +        ## protects from attackers that are using ip spoofing methods to do harm
      +        net.ipv4.conf.all.rp_filter = 1
      +        net.ipv4.conf.default.rp_filter = 1
      +        #net.ipv6.conf.default.rp_filter = 1
      +        #net.ipv6.conf.all.rp_filter = 1
      +
      +        # Make sure no one can alter the routing tables
      +        net.ipv4.conf.all.accept_redirects = 0
      +        net.ipv4.conf.default.accept_redirects = 0
      +        net.ipv4.conf.all.secure_redirects = 0
      +        net.ipv4.conf.default.secure_redirects = 0
      +
      +        # Act as a router, necessary for Access Point
      +        net.ipv4.ip_forward = 1
      +        net.ipv4.conf.all.send_redirects = 1
      +        net.ipv4.conf.default.send_redirects = 1
      +
      +        # Increase system IP port limits
      +        net.ipv4.ip_local_port_range = 2000 65000
      +
      +        # Increase TCP max buffer size setable using setsockopt()
      +        net.ipv4.tcp_rmem = 4096 87380 8388608
      +        net.ipv4.tcp_wmem = 4096 87380 8388608
      +
      +
      +        #  If you say Y here, neither TCP resets nor ICMP
      +        #  destination-unreachable packets will be sent in response to packets
      +        #  sent to ports for which no associated listening process exists.
      +        #  This feature supports both IPV4 and IPV6 and exempts the
      +        #  loopback interface from blackholing.  Enabling this feature
      +        #  makes a host more resilient to DoS attacks and reduces network
      +        #  visibility against scanners.
      +        #
      +        #  The blackhole feature as-implemented is equivalent to the FreeBSD
      +        #  blackhole feature, as it prevents RST responses to all packets, not
      +        #  just SYNs.  Under most application behavior this causes no
      +        #  problems, but applications (like haproxy) may not close certain
      +        #  connections in a way that cleanly terminates them on the remote
      +        #  end, leaving the remote host in LAST_ACK state.  Because of this
      +        #  side-effect and to prevent intentional LAST_ACK DoSes, this
      +        #  feature also adds automatic mitigation against such attacks.
      +        #  The mitigation drastically reduces the amount of time a socket
      +        #  can spend in LAST_ACK state.  If you're using haproxy and not
      +        #  all servers it connects to have this option enabled, consider
      +        #  disabling this feature on the haproxy host.
      +        #
      +        #  If the sysctl option is enabled, two sysctl options with names
      +        #  "ip_blackhole" and "lastack_retries" will be created.
      +        #  While "ip_blackhole" takes the standard zero/non-zero on/off
      +        #  toggle, "lastack_retries" uses the same kinds of values as
      +        #  "tcp_retries1" and "tcp_retries2".  The default value of 4
      +        #  prevents a socket from lasting more than 45 seconds in LAST_ACK
      +        #  state.
      +        #kernel.grsecurity.ip_blackhole = 1
      +        #kernel.grsecurity.lastack_retries = 4
      +
      +        #  If you say Y here, you will be able to choose a GID of whose users will
      +        #  be unable to connect to other hosts from your machine or run server
      +        #  applications from your machine.  If the sysctl option is enabled, a
      +        #  sysctl option with name "socket_all" is created.
      +        #kernel.grsecurity.socket_all = 1
      +
      +        #  Here you can choose the GID to disable socket access for. Remember to
      +        #  add the users you want socket access disabled for to the GID
      +        #  specified here.  If the sysctl option is enabled, a sysctl option
      +        #  with name "socket_all_gid" is created.
      +        #kernel.grsecurity.socket_all_gid = 202
      +
      +        #  If you say Y here, you will be able to choose a GID of whose users will
      +        #  be unable to connect to other hosts from your machine, but will be
      +        #  able to run servers.  If this option is enabled, all users in the group
      +        #  you specify will have to use passive mode when initiating ftp transfers
      +        #  from the shell on your machine.  If the sysctl option is enabled, a
      +        #  sysctl option with name "socket_client" is created.
      +        #kernel.grsecurity.socket_client = 1
      +
      +        #  Here you can choose the GID to disable client socket access for.
      +        #  Remember to add the users you want client socket access disabled for to
      +        #  the GID specified here.  If the sysctl option is enabled, a sysctl
      +        #  option with name "socket_client_gid" is created.
      +        #kernel.grsecurity.socket_client_gid = 203
      +
      +        #  If you say Y here, you will be able to choose a GID of whose users will
      +        #  be unable to connect to other hosts from your machine, but will be
      +        #  able to run servers.  If this option is enabled, all users in the group
      +        #  you specify will have to use passive mode when initiating ftp transfers
      +        #  from the shell on your machine.  If the sysctl option is enabled, a
      +        #  sysctl option with name "socket_client" is created.
      +        #kernel.grsecurity.socket_server = 1
      +
      +        #  Here you can choose the GID to disable server socket access for.
      +        #  Remember to add the users you want server socket access disabled for to
      +        #  the GID specified here.  If the sysctl option is enabled, a sysctl
      +        #  option with name "socket_server_gid" is created.
      +        #kernel.grsecurity.socket_server_gid = 204
      +
      +        #
      +        # Physical Protections
      +        #
      +
      +        #  If you say Y here, a new sysctl option with name "deny_new_usb"
      +        #  will be created.  Setting its value to 1 will prevent any new
      +        #  USB devices from being recognized by the OS.  Any attempted USB
      +        #  device insertion will be logged.  This option is intended to be
      +        #  used against custom USB devices designed to exploit vulnerabilities
      +        #  in various USB device drivers.
      +        #
      +        #  For greatest effectiveness, this sysctl should be set after any
      +        #  relevant init scripts.  This option is safe to enable in distros
      +        #  as each user can choose whether or not to toggle the sysctl.
      +        #kernel.grsecurity.deny_new_usb = 0
      +
      +        #
      +        # Restrict grsec sysctl changes after this was set
      +        #
      +        #kernel.grsecurity.grsec_lock = 1
      +
      +
      +
      +        # End of file
      +        
      + + Core OS Index

      This is part of the c9-doc Manual. -Copyright (C) 2016 +Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.

      diff --git a/core/network.html b/core/network.html index c14f3db..ebea495 100644 --- a/core/network.html +++ b/core/network.html @@ -49,7 +49,7 @@ described scripts then proceed to update system.

      -

      2.1.1. Resolver

      +

      2.2.1. Resolver

      This example will use Chaos Computer Club @@ -65,7 +65,7 @@ # chattr +i /etc/resolv.conf -

      2.1.2. Static IP

      +

      2.2.2. Static IP

      Current example of /etc/rc.d/net;

      @@ -112,7 +112,7 @@ # ip route add default via ${GW} -

      2.1.3. Iptables

      +

      2.2.3. Iptables

      For more information about iptables read arch wiki. @@ -147,7 +147,7 @@

      -

      2.1.4. Wpa and dhcpd

      +

      2.2.4. Wpa and dhcpd

      There is more information on Wiki Wifi Start Scripts and @@ -165,7 +165,7 @@ # iwconfig wlp2s0 essid NAME key s:ABCDE12345 -

      2.1.4.1. Wpa Supplicant

      +

      2.2.4.1. Wpa Supplicant

      Configure wpa supplicant edit;

      @@ -195,7 +195,7 @@ init script to auto load wpa configuration and dhcp client.

      -

      2.1.4.2. Wpa Cli

      +

      2.2.4.2. Wpa Cli

               # wpa_cli
      @@ -235,137 +235,10 @@
               
      -

      2.1.5. Sysctl

      - -

      Sysctl references - Arch TCP/IP stack hardening, - Cyberciti Nginx Hardning, - Cyberciti Security Hardening, - edit /etc/sysctl.conf;

      - -
      -        #
      -        # /etc/sysctl.conf: configuration for system variables, see sysctl.conf(5)
      -        #
      -
      -        kernel.printk = 1 4 1 7
      -
      -        # Disable ipv6
      -        net.ipv6.conf.all.disable_ipv6 = 1
      -        net.ipv6.conf.default.disable_ipv6 = 1
      -        net.ipv6.conf.lo.disable_ipv6 = 1
      -
      -        # Tuen IPv6
      -        # net.ipv6.conf.default.router_solicitations = 0
      -        # net.ipv6.conf.default.accept_ra_rtr_pref = 0
      -        # net.ipv6.conf.default.accept_ra_pinfo = 0
      -        # net.ipv6.conf.default.accept_ra_defrtr = 0
      -        # net.ipv6.conf.default.autoconf = 0
      -        # net.ipv6.conf.default.dad_transmits = 0
      -        # net.ipv6.conf.default.max_addresses = 0
      -
      -        # Avoid a smurf attack
      -        net.ipv4.icmp_echo_ignore_broadcasts = 1
      -
      -        # Turn on protection for bad icmp error messages
      -        net.ipv4.icmp_ignore_bogus_error_responses = 1
      -
      -        # Turn on syncookies for SYN flood attack protection
      -        net.ipv4.tcp_syncookies = 1
      -
      -        ## protect against tcp time-wait assassination hazards
      -        ## drop RST packets for sockets in the time-wait state
      -        ## (not widely supported outside of linux, but conforms to RFC)
      -        net.ipv4.tcp_rfc1337 = 1
      -
      -        ## tcp timestamps
      -        ## + protect against wrapping sequence numbers (at gigabit speeds)
      -        ## + round trip time calculation implemented in TCP
      -        ## - causes extra overhead and allows uptime detection by scanners like nmap
      -        ## enable @ gigabit speeds
      -        net.ipv4.tcp_timestamps = 0
      -        #net.ipv4.tcp_timestamps = 1
      -
      -        # Turn on and log spoofed, source routed, and redirect packets
      -        net.ipv4.conf.all.log_martians = 1
      -        net.ipv4.conf.default.log_martians = 1
      -
      -        ## ignore echo broadcast requests to prevent being part of smurf attacks (default)
      -        net.ipv4.icmp_echo_ignore_broadcasts = 1
      -
      -        # No source routed packets here
      -        net.ipv4.conf.all.accept_source_route = 0
      -        net.ipv4.conf.default.accept_source_route = 0
      -
      -        ## sets the kernels reverse path filtering mechanism to value 1(on)
      -        ## will do source validation of the packet's recieved from all the interfaces on the machine
      -        ## protects from attackers that are using ip spoofing methods to do harm
      -        net.ipv4.conf.all.rp_filter = 1
      -        net.ipv4.conf.default.rp_filter = 1
      -        net.ipv6.conf.default.rp_filter = 1
      -        net.ipv6.conf.all.rp_filter = 1
      -
      -        # Make sure no one can alter the routing tables
      -        net.ipv4.conf.all.accept_redirects = 0
      -        net.ipv4.conf.default.accept_redirects = 0
      -        net.ipv4.conf.all.secure_redirects = 0
      -        net.ipv4.conf.default.secure_redirects = 0
      -
      -        # Don't act as a router
      -        net.ipv4.ip_forward = 0
      -        net.ipv4.conf.all.send_redirects = 0
      -        net.ipv4.conf.default.send_redirects = 0
      -
      -        kernel.shmmax = 500000000
      -        # Turn on execshild
      -        kernel.exec-shield = 1
      -        kernel.randomize_va_space = 1
      -
      -        # Optimization for port usefor LBs
      -        # Increase system file descriptor limit
      -        fs.file-max = 65535
      -
      -        # Allow for more PIDs (to reduce rollover problems); may break some programs 32768
      -        kernel.pid_max = 65536
      -
      -        # Increase system IP port limits
      -        net.ipv4.ip_local_port_range = 2000 65000
      -
      -        # Increase TCP max buffer size setable using setsockopt()
      -        net.ipv4.tcp_rmem = 4096 87380 8388608
      -        net.ipv4.tcp_wmem = 4096 87380 8388608
      -
      -        # Increase Linux auto tuning TCP buffer limits
      -        # min, default, and max number of bytes to use
      -        # set max to at least 4MB, or higher if you use very high BDP paths
      -        # Tcp Windows etc
      -        net.core.rmem_max = 8388608
      -        net.core.wmem_max = 8388608
      -        net.core.netdev_max_backlog = 5000
      -        net.ipv4.tcp_window_scaling = 1
      -
      -        # End of file
      -        
      - -

      Change to act as a router (default of conf/sysctl.conf);

      - -
      -        # Act as a router, necessary for Access Point
      -        net.ipv4.ip_forward = 1
      -        net.ipv4.conf.all.send_redirects = 1
      -        net.ipv4.conf.default.send_redirects = 1
      -        
      - -

      Load new settings;

      - -
      -        # sysctl -p
      -        
      - Core OS Index

      This is part of the c9-doc Manual. - Copyright (C) 2016 + Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.

      diff --git a/core/package.html b/core/package.html index 475d94b..3c59669 100644 --- a/core/package.html +++ b/core/package.html @@ -2,13 +2,13 @@ - 2.2. Package Management + 2.3. Package Management Core OS Index -

      2.2. Package Management

      +

      2.3. Package Management

      For more information read crux handbook Package management front-end: @@ -57,7 +57,7 @@ $ prt-get depinst prt-utils prt-get-bashcompletion -

      2.2.1. Update System

      +

      2.3.1. Update System

      Before build software get latest version of port collections;

      @@ -87,7 +87,7 @@ $ prt-get update -fr $(revdep) -

      2.2.2. Install port and dependencies

      +

      2.3.2. Install port and dependencies

      Installing using prt-get tool;

      @@ -111,7 +111,7 @@

      If you user pkgmk and pkgadd allways check if README, pre and post instal files exist.

      -

      2.2.3. Ports collections

      +

      2.3.3. Ports collections

      Clone this documentation;

      @@ -146,7 +146,7 @@ $ sudo ports -u 6c37 -

      2.2.4. Show port information

      +

      2.3.4. Show port information

               $ prt-get info port_name
      @@ -164,13 +164,13 @@
               $ pkginfo -o filename
               
      -

      2.2.5. Show port dependencies

      +

      2.3.5. Show port dependencies

               $ prt-get depends port_name
               
      -

      2.2.6. Print information

      +

      2.3.6. Print information

      Example how to get ports installed from contrib. Maybe there is a "cleaner" way to this, for now is ok;

      @@ -181,7 +181,7 @@ Core OS Index

      This is part of the c9-doc Manual. - Copyright (C) 2016 + Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.

      diff --git a/core/ports.html b/core/ports.html index 489e728..98ccbba 100644 --- a/core/ports.html +++ b/core/ports.html @@ -23,7 +23,8 @@ # useradd -U -M -d /usr/ports -s /bin/false pkgmk -

      You can add your self to group pkgmk,

      +

      You can add your self to group pkgmk, Members of this group will + not be under tpe protection.

               # usermod -a -G pkgmk c9admin
      @@ -85,6 +86,8 @@
               export CFLAGS="-O2 -march=native -mtune=native"
               
      +

      "-protector-strong" which only insert stack canaries in fuctions where overflow might actually happen

      +

      Discover number of cores/cpus to hard code -j option.

      @@ -107,7 +110,7 @@
               # /etc/pkgmk.conf: pkgmk(8) configuration
               #
       
      -        export CFLAGS="-O2 -march=x86-64"
      +        export CFLAGS="-O2 -march=native -mtune=native"
               export CXXFLAGS="${CFLAGS}"
       
               export MAKEFLAGS="-j4"
      @@ -127,7 +130,7 @@
                               ;;
               esac
       
      -        PKGMK_SOURCE_MIRRORS=(http://crux.nu/distfiles/)
      +        #PKGMK_SOURCE_MIRRORS=(http://crux.nu/distfiles/)
               PKGMK_SOURCE_DIR="/usr/ports/distfiles"
               PKGMK_PACKAGE_DIR="/usr/ports/packages"
               PKGMK_WORK_DIR="/usr/ports/work/$name"
      @@ -163,6 +166,9 @@
               # the following line enables the user maintained contrib collection
               prtdir /usr/ports/contrib
       
      +        # ports described on this documentation
      +        #prtdir /usr/ports/c9-ports
      +
               # 6c37 team provides a collection with freetype-iu, fontconfig-iu
               # and cairo-iu ports.
               #prtdir /usr/ports/6c37
      @@ -185,7 +191,7 @@
               readme verbose           # (verbose|compact|disabled)
       
               ### prefer higher versions in sysup / diff
      -        preferhigher no      # (yes|no)
      +        preferhigher yes      # (yes|no)
       
               ### use regexp search
               # useregex no        # (yes|no)
      @@ -198,7 +204,7 @@
               ### EXPERT SECTION ###
       
               ### alternative commands
      -        makecommand      sudo -H -u pkgmk fakeroot pkgmk
      +        makecommand      sudo -H -u pkgmk -g pkgmk fakeroot pkgmk
               addcommand       sudo pkgadd
               removecommand    sudo pkgrm
               runscriptcommand sudo sh
      diff --git a/core/ports/linux-blob/.footprint b/core/ports/linux-blob/.footprint
      index f00d7fc..02c767e 100644
      --- a/core/ports/linux-blob/.footprint
      +++ b/core/ports/linux-blob/.footprint
      @@ -1,61 +1,56 @@
       drwxr-xr-x	root/root	boot/
      --rw-r--r--	root/root	boot/System.map-4.9.10-blob
      --rw-r--r--	root/root	boot/config-4.9.10-blob
      --rw-r--r--	root/root	boot/vmlinuz-4.9.10-blob
      +-rw-r--r--	root/root	boot/System.map-4.9.11-blob
      +-rw-r--r--	root/root	boot/config-4.9.11-blob
      +-rw-r--r--	root/root	boot/vmlinuz-4.9.11-blob
       drwxr-xr-x	root/root	lib/
       drwxr-xr-x	root/root	lib/modules/
      -drwxr-xr-x	root/root	lib/modules//
      -lrwxrwxrwx	root/root	lib/modules//build -> /usr/src/linux-4.9.10
      -drwxr-xr-x	root/root	lib/modules//kernel/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/platform/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/platform/soc_camera/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/platform/soc_camera/soc_camera.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/platform/soc_camera/soc_camera_platform.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/platform/soc_camera/soc_mediabus.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/usb/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/usb/gspca/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/usb/gspca/gspca_main.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/usb/uvc/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/usb/uvc/uvcvideo.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/media/v4l2-core/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/v4l2-core/videobuf-core.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/v4l2-core/videobuf2-core.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/v4l2-core/videobuf2-memops.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/v4l2-core/videobuf2-v4l2.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/misc/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/misc/eeprom/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/misc/eeprom/eeprom_93cx6.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/net/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/net/wireless/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/net/wireless/intel/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/net/wireless/intel/iwlwifi/
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/net/wireless/intel/iwlwifi/dvm/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko
      --rw-r--r--	root/root	lib/modules//kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/drivers/net/wireless/intel/iwlwifi/mvm/
      --rw-r--r--	root/root	lib/modules//kernel/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/fs/
      -drwxr-xr-x	root/root	lib/modules//kernel/fs/ntfs/
      --rw-r--r--	root/root	lib/modules//kernel/fs/ntfs/ntfs.ko
      -drwxr-xr-x	root/root	lib/modules//kernel/lib/
      --rw-r--r--	root/root	lib/modules//kernel/lib/crc-ccitt.ko
      --rw-r--r--	root/root	lib/modules//modules.alias
      --rw-r--r--	root/root	lib/modules//modules.alias.bin
      --rw-r--r--	root/root	lib/modules//modules.builtin
      --rw-r--r--	root/root	lib/modules//modules.builtin.bin
      --rw-r--r--	root/root	lib/modules//modules.dep
      --rw-r--r--	root/root	lib/modules//modules.dep.bin
      --rw-r--r--	root/root	lib/modules//modules.devname (EMPTY)
      --rw-r--r--	root/root	lib/modules//modules.order
      --rw-r--r--	root/root	lib/modules//modules.softdep
      --rw-r--r--	root/root	lib/modules//modules.symbols
      --rw-r--r--	root/root	lib/modules//modules.symbols.bin
      -lrwxrwxrwx	root/root	lib/modules//source -> /usr/src/linux-4.9.10
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/
      +lrwxrwxrwx	root/root	lib/modules/4.9.11-blob/build -> /usr/src/linux-4.9.11
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/platform/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/platform/soc_camera/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/platform/soc_camera/soc_camera.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/platform/soc_camera/soc_camera_platform.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/platform/soc_camera/soc_mediabus.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/usb/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/usb/gspca/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/usb/gspca/gspca_main.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/usb/uvc/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/usb/uvc/uvcvideo.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/v4l2-core/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/v4l2-core/videobuf-core.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/v4l2-core/videobuf2-core.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/v4l2-core/videobuf2-memops.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/v4l2-core/videobuf2-v4l2.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/iwlwifi/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/iwlwifi/dvm/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/iwlwifi/mvm/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/fs/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-blob/kernel/fs/ntfs/
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/kernel/fs/ntfs/ntfs.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.alias
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.alias.bin
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.builtin
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.builtin.bin
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.dep
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.dep.bin
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.devname (EMPTY)
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.order
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.softdep
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.symbols
      +-rw-r--r--	root/root	lib/modules/4.9.11-blob/modules.symbols.bin
      +lrwxrwxrwx	root/root	lib/modules/4.9.11-blob/source -> /usr/src/linux-4.9.11
       drwxr-xr-x	root/root	usr/
       drwxr-xr-x	root/root	usr/src/
      --rw-r--r--	root/root	usr/src/4.9.10-blob-config
      --rw-r--r--	root/root	usr/src/4.9.10-cpu_optimizations.patch
      --rw-r--r--	root/root	usr/src/grsecurity-3.1-4.9.9-201702122044.patch
      +-rw-r--r--	root/root	usr/src/4.9.11-blob-config
      +-rw-r--r--	root/root	usr/src/4.9.11-cpu_optimizations.patch
      +-rw-r--r--	root/root	usr/src/grsecurity-3.1-4.9.11-201702181444.patch
      diff --git a/core/ports/linux-blob/.md5sum b/core/ports/linux-blob/.md5sum
      index 614a350..8516def 100644
      --- a/core/ports/linux-blob/.md5sum
      +++ b/core/ports/linux-blob/.md5sum
      @@ -1,7 +1,7 @@
      -7140b24a6e9e13286515e807c2fd4572  config-c9
      +dc71c8f55df123437c468dad7be88757  config-c9
       00bc0d70f200c2673fe7dd6f02053fa4  enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch
      -85155985089acdb7c77e8e30fa135c86  grsecurity-3.1-4.9.9-201702122044.patch
      -ce5ab2a86c9b880617e36e84aa2deb6c  linux-4.9.10.tar.xz
      +e4eb7eab3a40968c3bd4a0a19339a6a1  grsecurity-3.1-4.9.11-201702181444.patch
      +98761ce71c603199fe6fcce600c60772  linux-4.9.11.tar.xz
       bcf38b0fbf7bd83323f3202ec082b15a  port-blob-cpu.patch
      -8f47b022540141ceb6a3ac5bc2a3531e  port-blob-grsecurity.patch
      -712ea2454ba5181e999661c94d12c629  port-blob-make.patch
      +48908f447c73e31c2428cb68b00d1e9c  port-blob-grsecurity.patch
      +4a443bf320ede9f5cb183843e85b3b62  port-blob-make.patch
      diff --git a/core/ports/linux-blob/Pkgfile b/core/ports/linux-blob/Pkgfile
      index ecb228d..b312361 100644
      --- a/core/ports/linux-blob/Pkgfile
      +++ b/core/ports/linux-blob/Pkgfile
      @@ -4,11 +4,11 @@
       # Depends on:   grub2 dracut
       
       name=linux-blob
      -version=4.9.10
      -release=1
      +version=4.9.11
      +release=3
       source=(https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-$version.tar.xz \
           https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch \
      -    https://grsecurity.net/test/grsecurity-3.1-4.9.9-201702122044.patch \
      +    http://grsecurity.net/test/grsecurity-3.1-4.9.11-201702181444.patch \
           port-blob-grsecurity.patch \
           port-blob-make.patch \
           port-blob-cpu.patch \
      @@ -18,12 +18,11 @@ build() {
       
           mkdir -p $PKG/usr/src
       
      -
           # /usr/src/version-cpu_optimizations.patch
           install -m 0644  $SRC/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch $PKG/usr/src/${version}-cpu_optimizations.patch
       
           # /usr/src/grsecurity-version.patch
      -    install -m 0644  $SRC/grsecurity-3.1-4.9.9-201702122044.patch $PKG/usr/src/
      +    install -m 0644  $SRC/grsecurity-3.1-4.9.11-201702181444.patch $PKG/usr/src/
       
           patch < port-blob-grsecurity.patch
           patch < port-blob-cpu.patch
      @@ -34,7 +33,7 @@ build() {
       
           make distclean
       
      -    patch -p1 < $SRC/grsecurity-3.1-4.9.9-201702122044.patch
      +    patch -p1 < $SRC/grsecurity-3.1-4.9.11-201702181444.patch
           patch -p1 < $SRC/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch
       
           cp $SRC/config-c9 .config
      diff --git a/core/ports/linux-blob/config-c9 b/core/ports/linux-blob/config-c9
      index b6750ec..2b0bb4b 100644
      --- a/core/ports/linux-blob/config-c9
      +++ b/core/ports/linux-blob/config-c9
      @@ -1,6 +1,6 @@
       #
       # Automatically generated file; DO NOT EDIT.
      -# Linux/x86 4.9.10-blob Kernel Configuration
      +# Linux/x86 4.9.11-blob Kernel Configuration
       #
       CONFIG_64BIT=y
       CONFIG_X86_64=y
      @@ -215,7 +215,7 @@ CONFIG_EVENTFD=y
       CONFIG_SHMEM=y
       CONFIG_AIO=y
       CONFIG_ADVISE_SYSCALLS=y
      -CONFIG_PCI_QUIRKS=y
      +# CONFIG_PCI_QUIRKS is not set
       CONFIG_MEMBARRIER=y
       # CONFIG_EMBEDDED is not set
       CONFIG_HAVE_PERF_EVENTS=y
      @@ -329,7 +329,7 @@ CONFIG_MODULE_SIG_SHA256=y
       # CONFIG_MODULE_SIG_SHA512 is not set
       CONFIG_MODULE_SIG_HASH="sha256"
       # CONFIG_MODULE_COMPRESS is not set
      -# CONFIG_TRIM_UNUSED_KSYMS is not set
      +CONFIG_TRIM_UNUSED_KSYMS=y
       CONFIG_MODULES_TREE_LOOKUP=y
       CONFIG_BLOCK=y
       CONFIG_BLK_DEV_BSG=y
      @@ -455,7 +455,7 @@ CONFIG_SWIOTLB=y
       CONFIG_IOMMU_HELPER=y
       # CONFIG_MAXSMP is not set
       CONFIG_NR_CPUS=4
      -# CONFIG_SCHED_SMT is not set
      +CONFIG_SCHED_SMT=y
       CONFIG_SCHED_MC=y
       CONFIG_PREEMPT_NONE=y
       # CONFIG_PREEMPT_VOLUNTARY is not set
      @@ -1357,7 +1357,7 @@ CONFIG_SRAM=y
       # CONFIG_EEPROM_AT25 is not set
       # CONFIG_EEPROM_LEGACY is not set
       # CONFIG_EEPROM_MAX6875 is not set
      -CONFIG_EEPROM_93CX6=m
      +# CONFIG_EEPROM_93CX6 is not set
       # CONFIG_EEPROM_93XX46 is not set
       # CONFIG_CB710_CORE is not set
       
      @@ -4209,8 +4209,8 @@ CONFIG_TASK_SIZE_MAX_SHIFT=42
       CONFIG_GRKERNSEC=y
       CONFIG_GRKERNSEC_CONFIG_AUTO=y
       # CONFIG_GRKERNSEC_CONFIG_CUSTOM is not set
      -CONFIG_GRKERNSEC_CONFIG_SERVER=y
      -# CONFIG_GRKERNSEC_CONFIG_DESKTOP is not set
      +# CONFIG_GRKERNSEC_CONFIG_SERVER is not set
      +CONFIG_GRKERNSEC_CONFIG_DESKTOP=y
       # CONFIG_GRKERNSEC_CONFIG_VIRT_NONE is not set
       # CONFIG_GRKERNSEC_CONFIG_VIRT_GUEST is not set
       CONFIG_GRKERNSEC_CONFIG_VIRT_HOST=y
      @@ -4228,7 +4228,7 @@ CONFIG_GRKERNSEC_CONFIG_PRIORITY_SECURITY=y
       # Default Special Groups
       #
       CONFIG_GRKERNSEC_PROC_GID=1001
      -CONFIG_GRKERNSEC_TPE_UNTRUSTED_GID=1005
      +CONFIG_GRKERNSEC_TPE_TRUSTED_GID=1005
       CONFIG_GRKERNSEC_SYMLINKOWN_GID=1006
       
       #
      @@ -4328,7 +4328,7 @@ CONFIG_GRKERNSEC_LINK=y
       CONFIG_GRKERNSEC_SYMLINKOWN=y
       CONFIG_GRKERNSEC_FIFO=y
       CONFIG_GRKERNSEC_SYSFS_RESTRICT=y
      -# CONFIG_GRKERNSEC_ROFS is not set
      +CONFIG_GRKERNSEC_ROFS=y
       CONFIG_GRKERNSEC_DEVICE_SIDECHANNEL=y
       CONFIG_GRKERNSEC_CHROOT=y
       CONFIG_GRKERNSEC_CHROOT_MOUNT=y
      @@ -4350,15 +4350,16 @@ CONFIG_GRKERNSEC_CHROOT_INITRD=y
       #
       # Kernel Auditing
       #
      -# CONFIG_GRKERNSEC_AUDIT_GROUP is not set
      -# CONFIG_GRKERNSEC_EXECLOG is not set
      +CONFIG_GRKERNSEC_AUDIT_GROUP=y
      +CONFIG_GRKERNSEC_AUDIT_GID=1007
      +CONFIG_GRKERNSEC_EXECLOG=y
       CONFIG_GRKERNSEC_RESLOG=y
      -# CONFIG_GRKERNSEC_CHROOT_EXECLOG is not set
      -# CONFIG_GRKERNSEC_AUDIT_PTRACE is not set
      -# CONFIG_GRKERNSEC_AUDIT_CHDIR is not set
      -# CONFIG_GRKERNSEC_AUDIT_MOUNT is not set
      +CONFIG_GRKERNSEC_CHROOT_EXECLOG=y
      +CONFIG_GRKERNSEC_AUDIT_PTRACE=y
      +CONFIG_GRKERNSEC_AUDIT_CHDIR=y
      +CONFIG_GRKERNSEC_AUDIT_MOUNT=y
       CONFIG_GRKERNSEC_SIGNAL=y
      -# CONFIG_GRKERNSEC_FORKFAIL is not set
      +CONFIG_GRKERNSEC_FORKFAIL=y
       CONFIG_GRKERNSEC_TIME=y
       CONFIG_GRKERNSEC_PROC_IPADDR=y
       CONFIG_GRKERNSEC_RWXMAP_LOG=y
      @@ -4373,8 +4374,8 @@ CONFIG_GRKERNSEC_SETXID=y
       CONFIG_GRKERNSEC_HARDEN_IPC=y
       CONFIG_GRKERNSEC_HARDEN_TTY=y
       CONFIG_GRKERNSEC_TPE=y
      -# CONFIG_GRKERNSEC_TPE_ALL is not set
      -# CONFIG_GRKERNSEC_TPE_INVERT is not set
      +CONFIG_GRKERNSEC_TPE_ALL=y
      +CONFIG_GRKERNSEC_TPE_INVERT=y
       CONFIG_GRKERNSEC_TPE_GID=1005
       
       #
      @@ -4382,13 +4383,19 @@ CONFIG_GRKERNSEC_TPE_GID=1005
       #
       CONFIG_GRKERNSEC_BLACKHOLE=y
       CONFIG_GRKERNSEC_NO_SIMULT_CONNECT=y
      -# CONFIG_GRKERNSEC_SOCKET is not set
      +CONFIG_GRKERNSEC_SOCKET=y
      +CONFIG_GRKERNSEC_SOCKET_ALL=y
      +CONFIG_GRKERNSEC_SOCKET_ALL_GID=1004
      +CONFIG_GRKERNSEC_SOCKET_CLIENT=y
      +CONFIG_GRKERNSEC_SOCKET_CLIENT_GID=1003
      +CONFIG_GRKERNSEC_SOCKET_SERVER=y
      +CONFIG_GRKERNSEC_SOCKET_SERVER_GID=1002
       
       #
       # Physical Protections
       #
       CONFIG_GRKERNSEC_DENYUSB=y
      -# CONFIG_GRKERNSEC_DENYUSB_FORCE is not set
      +CONFIG_GRKERNSEC_DENYUSB_FORCE=y
       
       #
       # Sysctl Support
      @@ -4649,7 +4656,7 @@ CONFIG_GENERIC_IOMAP=y
       CONFIG_GENERIC_IO=y
       CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
       CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
      -CONFIG_CRC_CCITT=m
      +CONFIG_CRC_CCITT=y
       CONFIG_CRC16=y
       CONFIG_CRC_T10DIF=y
       CONFIG_CRC_ITU_T=y
      diff --git a/core/ports/linux-blob/port-blob-grsecurity.patch b/core/ports/linux-blob/port-blob-grsecurity.patch
      index 6d27cb4..22d4580 100644
      --- a/core/ports/linux-blob/port-blob-grsecurity.patch
      +++ b/core/ports/linux-blob/port-blob-grsecurity.patch
      @@ -1,5 +1,5 @@
      ---- grsecurity-3.1-4.9.9-201702122044.patch	2017-02-18 05:14:08.682388834 +0000
      -+++ grsecurity-3.1-4.9.9-201702122044.patch	2017-02-18 05:15:45.579051680 +0000
      +--- grsecurity-3.1-4.9.11-201702181444.patch	2017-02-18 05:14:08.682388834 +0000
      ++++ grsecurity-3.1-4.9.11-201702181444.patch	2017-02-18 05:15:45.579051680 +0000
       -diff --git a/localversion-grsec b/localversion-grsec
       -new file mode 100644
       -index 0000000..7cd6065
      @@ -10,8 +10,8 @@
        diff --git a/mm/Kconfig b/mm/Kconfig
        index 86e3e0e..ab679cf 100644
        --- a/mm/Kconfig
      ---- grsecurity-3.1-4.9.9-201702122044.patch.orig	2017-02-18 09:07:57.220274062 +0000
      -+++ grsecurity-3.1-4.9.9-201702122044.patch	2017-02-18 09:08:16.380274647 +0000
      +--- grsecurity-3.1-4.9.11-201702181444.patch	2017-02-18 09:07:57.220274062 +0000
      ++++ grsecurity-3.1-4.9.11-201702181444.patch	2017-02-18 09:08:16.380274647 +0000
       @@ -156547,13 +156547,6 @@
         			break;
         		}
      diff --git a/core/ports/linux-blob/port-blob-make.patch b/core/ports/linux-blob/port-blob-make.patch
      index 9184cb5..368d592 100644
      --- a/core/ports/linux-blob/port-blob-make.patch
      +++ b/core/ports/linux-blob/port-blob-make.patch
      @@ -3,7 +3,7 @@
       @@ -1,7 +1,7 @@
        VERSION = 4
        PATCHLEVEL = 9
      - SUBLEVEL = 10
      + SUBLEVEL = 11
       -EXTRAVERSION =
       +EXTRAVERSION = -blob
        NAME = Roaring Lionus
      diff --git a/core/ports/linux-libre/.footprint b/core/ports/linux-libre/.footprint
      index 5d223e7..1279a5d 100644
      --- a/core/ports/linux-libre/.footprint
      +++ b/core/ports/linux-libre/.footprint
      @@ -1,64 +1,59 @@
       drwxr-xr-x	root/root	boot/
      --rw-r--r--	root/root	boot/System.map-4.9.10-grsec
      --rw-r--r--	root/root	boot/config-4.9.10-grsec
      --rw-r--r--	root/root	boot/vmlinuz-4.9.10-grsec
      +-rw-r--r--	root/root	boot/System.map-4.9.11-grsec
      +-rw-r--r--	root/root	boot/config-4.9.11-grsec
      +-rw-r--r--	root/root	boot/vmlinuz-4.9.11-grsec
       drwxr-xr-x	root/root	lib/
       drwxr-xr-x	root/root	lib/modules/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/
      -lrwxrwxrwx	root/root	lib/modules/4.9.10-grsec/build -> /usr/src/linux-4.9.10
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/platform/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/platform/soc_camera/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/platform/soc_camera/soc_camera.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/platform/soc_camera/soc_camera_platform.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/platform/soc_camera/soc_mediabus.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/usb/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/usb/gspca/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/usb/gspca/gspca_main.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/usb/uvc/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/usb/uvc/uvcvideo.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/v4l2-core/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/v4l2-core/videobuf-core.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/v4l2-core/videobuf2-core.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/v4l2-core/videobuf2-memops.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/v4l2-core/videobuf2-v4l2.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/misc/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/misc/eeprom/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/misc/eeprom/eeprom_93cx6.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/iwlwifi/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/iwlwifi/dvm/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/iwlwifi/mvm/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/fs/
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/fs/ntfs/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/fs/ntfs/ntfs.ko
      -drwxr-xr-x	root/root	lib/modules/4.9.10-grsec/kernel/lib/
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/kernel/lib/crc-ccitt.ko
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.alias
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.alias.bin
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.builtin
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.builtin.bin
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.dep
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.dep.bin
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.devname (EMPTY)
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.order
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.softdep
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.symbols
      --rw-r--r--	root/root	lib/modules/4.9.10-grsec/modules.symbols.bin
      -lrwxrwxrwx	root/root	lib/modules/4.9.10-grsec/source -> /usr/src/linux-4.9.10
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/
      +lrwxrwxrwx	root/root	lib/modules/4.9.11-grsec/build -> /usr/src/linux-4.9.11
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/platform/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/platform/soc_camera/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/platform/soc_camera/soc_camera.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/platform/soc_camera/soc_camera_platform.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/platform/soc_camera/soc_mediabus.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/usb/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/usb/gspca/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/usb/gspca/gspca_main.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/usb/uvc/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/usb/uvc/uvcvideo.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/v4l2-core/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/v4l2-core/videobuf-core.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/v4l2-core/videobuf2-core.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/v4l2-core/videobuf2-memops.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/v4l2-core/videobuf2-v4l2.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/iwlwifi/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/iwlwifi/dvm/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/iwlwifi/mvm/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/fs/
      +drwxr-xr-x	root/root	lib/modules/4.9.11-grsec/kernel/fs/ntfs/
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/kernel/fs/ntfs/ntfs.ko
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.alias
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.alias.bin
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.builtin
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.builtin.bin
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.dep
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.dep.bin
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.devname (EMPTY)
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.order
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.softdep
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.symbols
      +-rw-r--r--	root/root	lib/modules/4.9.11-grsec/modules.symbols.bin
      +lrwxrwxrwx	root/root	lib/modules/4.9.11-grsec/source -> /usr/src/linux-4.9.11
       drwxr-xr-x	root/root	usr/
       drwxr-xr-x	root/root	usr/src/
      --rw-r--r--	root/root	usr/src/4.9.10-cpu_optimizations.patch
      --rw-r--r--	root/root	usr/src/4.9.10-libre-config
      --rw-r--r--	root/root	usr/src/grsecurity-3.1-4.9.9-201702122044.patch
      +-rw-r--r--	root/root	usr/src/4.9.11-cpu_optimizations.patch
      +-rw-r--r--	root/root	usr/src/4.9.11-libre-config
      +-rw-r--r--	root/root	usr/src/grsecurity-3.1-4.9.11-201702181444.patch
       -rw-r--r--	root/root	usr/src/port-libre-cpu.patch
       -rw-r--r--	root/root	usr/src/port-libre-grsecurity.patch
       -rw-r--r--	root/root	usr/src/port-libre-make.patch
      diff --git a/core/ports/linux-libre/.md5sum b/core/ports/linux-libre/.md5sum
      index b481c10..ddd1878 100644
      --- a/core/ports/linux-libre/.md5sum
      +++ b/core/ports/linux-libre/.md5sum
      @@ -1,7 +1,7 @@
      -7140b24a6e9e13286515e807c2fd4572  config-c9
      +bf30b0af56c2621e317cab5e44d4235e  config-c9
       00bc0d70f200c2673fe7dd6f02053fa4  enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch
      -85155985089acdb7c77e8e30fa135c86  grsecurity-3.1-4.9.9-201702122044.patch
      -d68753b73b7c87d53424146eceb291f8  linux-libre-4.9.10-gnu.tar.xz
      +e4eb7eab3a40968c3bd4a0a19339a6a1  grsecurity-3.1-4.9.11-201702181444.patch
      +2af743d6b73201d5db83c1ccb175ed30  linux-libre-4.9.11-gnu.tar.xz
       bcf38b0fbf7bd83323f3202ec082b15a  port-libre-cpu.patch
      -470face301667e4a88a7664f69c1ae29  port-libre-grsecurity.patch
      -f8ba546153f4cdcd47b97bd2f8785af1  port-libre-make.patch
      +f9b2f7572adec2c46c1f1be2b784490e  port-libre-grsecurity.patch
      +ce88c28573de7b41ef686f4201d0abfa  port-libre-make.patch
      diff --git a/core/ports/linux-libre/Pkgfile b/core/ports/linux-libre/Pkgfile
      index 9f7a3d0..154435f 100644
      --- a/core/ports/linux-libre/Pkgfile
      +++ b/core/ports/linux-libre/Pkgfile
      @@ -4,11 +4,11 @@
       # Depends on:   grub2 dracut
       
       name=linux-libre
      -version=4.9.10
      -release=3
      +version=4.9.11
      +release=2
       source=(http://linux-libre.fsfla.org/pub/linux-libre/releases/$version-gnu/$name-$version-gnu.tar.xz \
           https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch \
      -    https://grsecurity.net/test/grsecurity-3.1-4.9.9-201702122044.patch \
      +    http://grsecurity.net/test/grsecurity-3.1-4.9.11-201702181444.patch \
           port-libre-grsecurity.patch \
           port-libre-cpu.patch \
           port-libre-make.patch \
      @@ -24,7 +24,7 @@ build() {
           install -m 0644  $SRC/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch $PKG/usr/src/${version}-cpu_optimizations.patch
       
           # /usr/src/grsecurity-version.patch
      -    install -m 0644  $SRC/grsecurity-3.1-4.9.9-201702122044.patch $PKG/usr/src/
      +    install -m 0644  $SRC/grsecurity-3.1-4.9.11-201702181444.patch $PKG/usr/src/
           install -m 0644  $SRC/port-libre-grsecurity.patch $PKG/usr/src/
           install -m 0644  $SRC/port-libre-cpu.patch $PKG/usr/src/
           install -m 0644  $SRC/port-libre-make.patch $PKG/usr/src/
      @@ -38,7 +38,7 @@ build() {
       
           make distclean
       
      -    patch -p1 < $SRC/grsecurity-3.1-4.9.9-201702122044.patch
      +    patch -p1 < $SRC/grsecurity-3.1-4.9.11-201702181444.patch
           patch -p1 < $SRC/enable_additional_cpu_optimizations_for_gcc_v4.9%2B_kernel_v3.15%2B.patch
       
           cp $SRC/config-c9 .config
      diff --git a/core/ports/linux-libre/config-c9 b/core/ports/linux-libre/config-c9
      index b6750ec..236d79e 100644
      --- a/core/ports/linux-libre/config-c9
      +++ b/core/ports/linux-libre/config-c9
      @@ -1,6 +1,6 @@
       #
       # Automatically generated file; DO NOT EDIT.
      -# Linux/x86 4.9.10-blob Kernel Configuration
      +# Linux/x86 4.9.11-grsec Kernel Configuration
       #
       CONFIG_64BIT=y
       CONFIG_X86_64=y
      @@ -215,7 +215,7 @@ CONFIG_EVENTFD=y
       CONFIG_SHMEM=y
       CONFIG_AIO=y
       CONFIG_ADVISE_SYSCALLS=y
      -CONFIG_PCI_QUIRKS=y
      +# CONFIG_PCI_QUIRKS is not set
       CONFIG_MEMBARRIER=y
       # CONFIG_EMBEDDED is not set
       CONFIG_HAVE_PERF_EVENTS=y
      @@ -329,7 +329,7 @@ CONFIG_MODULE_SIG_SHA256=y
       # CONFIG_MODULE_SIG_SHA512 is not set
       CONFIG_MODULE_SIG_HASH="sha256"
       # CONFIG_MODULE_COMPRESS is not set
      -# CONFIG_TRIM_UNUSED_KSYMS is not set
      +CONFIG_TRIM_UNUSED_KSYMS=y
       CONFIG_MODULES_TREE_LOOKUP=y
       CONFIG_BLOCK=y
       CONFIG_BLK_DEV_BSG=y
      @@ -455,7 +455,7 @@ CONFIG_SWIOTLB=y
       CONFIG_IOMMU_HELPER=y
       # CONFIG_MAXSMP is not set
       CONFIG_NR_CPUS=4
      -# CONFIG_SCHED_SMT is not set
      +CONFIG_SCHED_SMT=y
       CONFIG_SCHED_MC=y
       CONFIG_PREEMPT_NONE=y
       # CONFIG_PREEMPT_VOLUNTARY is not set
      @@ -1357,7 +1357,7 @@ CONFIG_SRAM=y
       # CONFIG_EEPROM_AT25 is not set
       # CONFIG_EEPROM_LEGACY is not set
       # CONFIG_EEPROM_MAX6875 is not set
      -CONFIG_EEPROM_93CX6=m
      +# CONFIG_EEPROM_93CX6 is not set
       # CONFIG_EEPROM_93XX46 is not set
       # CONFIG_CB710_CORE is not set
       
      @@ -4209,8 +4209,8 @@ CONFIG_TASK_SIZE_MAX_SHIFT=42
       CONFIG_GRKERNSEC=y
       CONFIG_GRKERNSEC_CONFIG_AUTO=y
       # CONFIG_GRKERNSEC_CONFIG_CUSTOM is not set
      -CONFIG_GRKERNSEC_CONFIG_SERVER=y
      -# CONFIG_GRKERNSEC_CONFIG_DESKTOP is not set
      +# CONFIG_GRKERNSEC_CONFIG_SERVER is not set
      +CONFIG_GRKERNSEC_CONFIG_DESKTOP=y
       # CONFIG_GRKERNSEC_CONFIG_VIRT_NONE is not set
       # CONFIG_GRKERNSEC_CONFIG_VIRT_GUEST is not set
       CONFIG_GRKERNSEC_CONFIG_VIRT_HOST=y
      @@ -4228,7 +4228,7 @@ CONFIG_GRKERNSEC_CONFIG_PRIORITY_SECURITY=y
       # Default Special Groups
       #
       CONFIG_GRKERNSEC_PROC_GID=1001
      -CONFIG_GRKERNSEC_TPE_UNTRUSTED_GID=1005
      +CONFIG_GRKERNSEC_TPE_TRUSTED_GID=1005
       CONFIG_GRKERNSEC_SYMLINKOWN_GID=1006
       
       #
      @@ -4328,7 +4328,7 @@ CONFIG_GRKERNSEC_LINK=y
       CONFIG_GRKERNSEC_SYMLINKOWN=y
       CONFIG_GRKERNSEC_FIFO=y
       CONFIG_GRKERNSEC_SYSFS_RESTRICT=y
      -# CONFIG_GRKERNSEC_ROFS is not set
      +CONFIG_GRKERNSEC_ROFS=y
       CONFIG_GRKERNSEC_DEVICE_SIDECHANNEL=y
       CONFIG_GRKERNSEC_CHROOT=y
       CONFIG_GRKERNSEC_CHROOT_MOUNT=y
      @@ -4350,15 +4350,16 @@ CONFIG_GRKERNSEC_CHROOT_INITRD=y
       #
       # Kernel Auditing
       #
      -# CONFIG_GRKERNSEC_AUDIT_GROUP is not set
      -# CONFIG_GRKERNSEC_EXECLOG is not set
      +CONFIG_GRKERNSEC_AUDIT_GROUP=y
      +CONFIG_GRKERNSEC_AUDIT_GID=1007
      +CONFIG_GRKERNSEC_EXECLOG=y
       CONFIG_GRKERNSEC_RESLOG=y
      -# CONFIG_GRKERNSEC_CHROOT_EXECLOG is not set
      -# CONFIG_GRKERNSEC_AUDIT_PTRACE is not set
      -# CONFIG_GRKERNSEC_AUDIT_CHDIR is not set
      -# CONFIG_GRKERNSEC_AUDIT_MOUNT is not set
      +CONFIG_GRKERNSEC_CHROOT_EXECLOG=y
      +CONFIG_GRKERNSEC_AUDIT_PTRACE=y
      +CONFIG_GRKERNSEC_AUDIT_CHDIR=y
      +CONFIG_GRKERNSEC_AUDIT_MOUNT=y
       CONFIG_GRKERNSEC_SIGNAL=y
      -# CONFIG_GRKERNSEC_FORKFAIL is not set
      +CONFIG_GRKERNSEC_FORKFAIL=y
       CONFIG_GRKERNSEC_TIME=y
       CONFIG_GRKERNSEC_PROC_IPADDR=y
       CONFIG_GRKERNSEC_RWXMAP_LOG=y
      @@ -4373,8 +4374,8 @@ CONFIG_GRKERNSEC_SETXID=y
       CONFIG_GRKERNSEC_HARDEN_IPC=y
       CONFIG_GRKERNSEC_HARDEN_TTY=y
       CONFIG_GRKERNSEC_TPE=y
      -# CONFIG_GRKERNSEC_TPE_ALL is not set
      -# CONFIG_GRKERNSEC_TPE_INVERT is not set
      +CONFIG_GRKERNSEC_TPE_ALL=y
      +CONFIG_GRKERNSEC_TPE_INVERT=y
       CONFIG_GRKERNSEC_TPE_GID=1005
       
       #
      @@ -4382,13 +4383,19 @@ CONFIG_GRKERNSEC_TPE_GID=1005
       #
       CONFIG_GRKERNSEC_BLACKHOLE=y
       CONFIG_GRKERNSEC_NO_SIMULT_CONNECT=y
      -# CONFIG_GRKERNSEC_SOCKET is not set
      +CONFIG_GRKERNSEC_SOCKET=y
      +CONFIG_GRKERNSEC_SOCKET_ALL=y
      +CONFIG_GRKERNSEC_SOCKET_ALL_GID=1004
      +CONFIG_GRKERNSEC_SOCKET_CLIENT=y
      +CONFIG_GRKERNSEC_SOCKET_CLIENT_GID=1003
      +CONFIG_GRKERNSEC_SOCKET_SERVER=y
      +CONFIG_GRKERNSEC_SOCKET_SERVER_GID=1002
       
       #
       # Physical Protections
       #
       CONFIG_GRKERNSEC_DENYUSB=y
      -# CONFIG_GRKERNSEC_DENYUSB_FORCE is not set
      +CONFIG_GRKERNSEC_DENYUSB_FORCE=y
       
       #
       # Sysctl Support
      @@ -4649,7 +4656,7 @@ CONFIG_GENERIC_IOMAP=y
       CONFIG_GENERIC_IO=y
       CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
       CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
      -CONFIG_CRC_CCITT=m
      +CONFIG_CRC_CCITT=y
       CONFIG_CRC16=y
       CONFIG_CRC_T10DIF=y
       CONFIG_CRC_ITU_T=y
      diff --git a/core/ports/linux-libre/port-libre-grsecurity.patch b/core/ports/linux-libre/port-libre-grsecurity.patch
      index d437421..cecd956 100644
      --- a/core/ports/linux-libre/port-libre-grsecurity.patch
      +++ b/core/ports/linux-libre/port-libre-grsecurity.patch
      @@ -1,5 +1,5 @@
      ---- grsecurity-3.1-4.9.9-201702122044.patch	2017-02-18 05:14:08.682388834 +0000
      -+++ grsecurity-3.1-4.9.9-201702122044.patch	2017-02-18 05:15:45.579051680 +0000
      +--- grsecurity-3.1-4.9.11-201702181444.patch 	2017-02-18 05:14:08.682388834 +0000
      ++++ grsecurity-3.1-4.9.11-201702181444.patch	2017-02-18 05:15:45.579051680 +0000
       @@ -90805,59 +90805,6 @@
         	if (!file->private_data)
         		return -ENOMEM;
      diff --git a/core/ports/linux-libre/port-libre-make.patch b/core/ports/linux-libre/port-libre-make.patch
      index 6a32ba8..dfbd8af 100644
      --- a/core/ports/linux-libre/port-libre-make.patch
      +++ b/core/ports/linux-libre/port-libre-make.patch
      @@ -3,7 +3,7 @@
       @@ -1,7 +1,7 @@
        VERSION = 4
        PATCHLEVEL = 9
      - SUBLEVEL = 10
      + SUBLEVEL = 11
       -EXTRAVERSION = -gnu
       +EXTRAVERSION = -grsec
        NAME = Roaring Lionus
      diff --git a/core/reboot.html b/core/reboot.html
      index c63f9bc..7bc22ea 100644
      --- a/core/reboot.html
      +++ b/core/reboot.html
      @@ -33,109 +33,17 @@
       
               

      1.4.1. Linux Kernel

      -

      c9-ports have two kernels, linux libre and linux blob. +

      Core ports have two kernels, linux-libre and linux-blob. Port linux-libre kernel is a true source based kernel that respects your freedoms, is x86_64 but not generic configured, - with all drivers as modules or correct graphic driver. - Port linux-blob contain blobs and loads firmware.

      + select modules (drivers) for your hardware, for example + correct graphic driver and disk. Port linux-blob is dangerous, + contain blobs (from bad corporations).

               # cd /usr/ports/c9-ports/linux-libre
               # pkgmk -d
      -        # pkgadd /usr/ports/packages/linux-libre#4.9.9-3.pkg.tar.gz
      -        
      - -

      1.4.2. Dracut - Initramfs

      - -

      Install dracut;

      - -
      -        # cd /usr/ports/c9-ports/dracut
      -        # pkgmk -d
      -        # pkgadd /usr/ports/packages/dracut#044-2.pkg.tar.gz
      -        
      - -

      Review configuration file;

      - -
      -        # PUT YOUR CONFIG IN separate files
      -        # in /etc/dracut.conf.d named ".conf"
      -
      -        # Equivalent to -H
      -        hostonly="yes"
      -
      -        # Mount / and /usr read-only by default.
      -        ro_mnt="no"
      -
      -        # Equivalent to -m "module module module"
      -        dracutmodules+="dash kernel-modules rootfs-block udev-rules usrmount base fs-lib shutdown"
      -
      -        # Equivalent to -a "module"
      -        add_dracutmodules+="caps debug"
      -
      -        # Equivalent to -o "module"
      -        #omit_dracutmodules+="systemd systemd-bootchart systemd-networkd systemd-initrd"
      -
      -        # SEE man dracut.conf(5) for options
      -        
      - -

      Run dracut to create init ram filesystem for - port linux-blob kernel;

      - -
      -        # dracut -v /boot/initramfs-4.9.9-blob.img 4.9.9-blob
      -        
      - -

      1.4.3. Configuring Grub2

      - -

      Create grub file in /etc/default/grub with values;

      - -
      -        GRUB_DISABLE_LINUX_UUID=false
      -        GRUB_ENABLE_LINUX_LABEL=false
      -        
      - -

      Grub Manual, - install grub on MBR of disk sdb;

      - -
      -        # grub-install /dev/sdb
      -        Installation finished. No error reported.
      -        
      - -

      If you are installing on removable media;

      - -
      -        # grub-install --removable /dev/sdb
      -        Installation finished. No error reported.
      -        
      - -

      grub-mkconfig generates grub.cfg, it will try to discover - available kernels and attempt to generate menu entries for - them;

      - -
      -        # grub-mkconfig -o /boot/grub/grub.cfg
      -        Generating grub.cfg ...
      -        Found linux image: /boot/vmlinuz-4.9.9-grsec
      -        done
      -        #
      -        
      - -

      Check /boot/grub/grub.cfg, if is wrong add menu to - /etc/grub.d/40_custom, replace correct msdos partition - from grub-prob output and correct UUID from fstab or blkid

      - -
      -        # grub-probe --target=hints_string /
      -        
      - -

      To add rw as default edit /etc/grub.d/10_linux file, current - version change line 138 to;

      - -
      -        echo    '$message'
      -        linux   ${rel_dirname}/${basename} root=${linux_root_device_thisversion} rw ${args}
      +        # pkgadd /usr/ports/packages/linux-libre#4.9.11-2.pkg.tar.gz
               

      1.4.4. Checkup

      @@ -152,13 +60,13 @@

      Debug initram

      -        /usr/lib/dracut/skipcpio /boot/initramfs-4.9.9-blob.img | gunzip -c | cpio -i -d
      +        /usr/lib/dracut/skipcpio /boot/initramfs-4.9.11-blob.img | gunzip -c | cpio -i -d
               36875 blocks
               
      Core OS Index

      This is part of the c9-doc Manual. - Copyright (C) 2016 + Copyright (C) 2017 c9 team. See the file Gnu Free Documentation License for copying conditions.

      -- cgit From d26a4e12deafade205d37a9fda748a6b78dfdb6a Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sat, 25 Feb 2017 18:40:03 +0000 Subject: overall revesion --- core/bash.html | 10 +- core/conf/iptables/iptables-lan.sh | 143 ++++++++++++++++++--------- core/conf/iptables/rules.v4 | 76 +++++++------- core/conf/sysctl.conf | 148 +++++++++++++++------------- core/dash.html | 4 +- core/exim.html | 33 ++++--- core/grsecurity.html | 85 ++++++++++++++++ core/hardening.html | 197 +++++++++++++++++++++++++++++++++++++ core/index.html | 51 +++++----- core/linux.html | 71 +++++++------ core/network.html | 16 +-- core/package.html | 16 +-- core/ports.html | 8 +- core/reboot.html | 11 ++- core/scripts/setup-install.sh | 2 +- core/tmux.html | 6 +- core/tty-terminal.html | 4 +- tools/conf/etc/rc.d/dnscrypt-proxy | 5 +- tools/dnsmasq.html | 7 +- tools/gitolite.html | 3 +- tools/index.html | 6 -- tools/mutt.html | 10 +- tools/qemu.html | 18 ++-- tools/x.html | 28 ++++-- 24 files changed, 671 insertions(+), 287 deletions(-) create mode 100644 core/grsecurity.html create mode 100644 core/hardening.html (limited to 'core/ports.html') diff --git a/core/bash.html b/core/bash.html index 2c1f6e9..353d7df 100644 --- a/core/bash.html +++ b/core/bash.html @@ -2,12 +2,12 @@ - 2.4.2. Bash + 2.5.2. Bash Core OS Index -

      2.4.2. Bash

      +

      2.5.2. Bash

      Just to be sure, setup bash as default login;

      @@ -32,7 +32,7 @@ alias, editor. -

      2.4.2.1. Profile

      +

      2.5.2.1. Profile

      Example of ~/.profile;

      @@ -43,7 +43,7 @@ export SSH_AUTH_SOCK # enable gpg-agent for ssh
      -

      2.4.2.2. Bash RC

      +

      2.5.2.2. Bash RC

      Example of ~/.bashrc;

      @@ -106,7 +106,7 @@ fi -

      2.4.2.3. Bash profile

      +

      2.5.2.3. Bash profile

      Example of ~/.bash_profile;

      diff --git a/core/conf/iptables/iptables-lan.sh b/core/conf/iptables/iptables-lan.sh index fae7345..58d92c3 100644 --- a/core/conf/iptables/iptables-lan.sh +++ b/core/conf/iptables/iptables-lan.sh @@ -26,8 +26,7 @@ NIC_NAME="enp8s0 wlp7s0" # Logging options. #------------------------------------------------------------------------------ -LOG="LOG --log-level debug --log-tcp-sequence --log-tcp-options" -LOG="$LOG --log-ip-options" +LOG="LOG --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options" # Defaults for rate limiting @@ -59,9 +58,9 @@ $MODPROBE ip_conntrack_irc # Drop everything by default. $IPTABLES -P INPUT DROP $IPTABLES -P FORWARD DROP -$IPTABLES -P OUTPUT ACCEPT +$IPTABLES -P OUTPUT DROP -# Set the nat/mangle/raw tables' chains to ACCEPT +# Set the nat/mangle/raw tables' chains to DROP $IPTABLES -t mangle -P PREROUTING ACCEPT $IPTABLES -t mangle -P INPUT ACCEPT @@ -89,53 +88,58 @@ $IPTABLES -t mangle -Z # Block all IPv6 traffic # If the ip6tables command is available, try to block all IPv6 traffic. -if test -x $IP6TABLES; then +#if test -x $IP6TABLES; then # Set the default policies # drop everything -$IP6TABLES -P INPUT DROP 2>/dev/null -$IP6TABLES -P FORWARD DROP 2>/dev/null -$IP6TABLES -P OUTPUT DROP 2>/dev/null - -# The mangle table can pass everything -$IP6TABLES -t mangle -P PREROUTING ACCEPT 2>/dev/null -$IP6TABLES -t mangle -P INPUT ACCEPT 2>/dev/null -$IP6TABLES -t mangle -P FORWARD ACCEPT 2>/dev/null -$IP6TABLES -t mangle -P OUTPUT ACCEPT 2>/dev/null -$IP6TABLES -t mangle -P POSTROUTING ACCEPT 2>/dev/null +#$IP6TABLES -P INPUT DROP +#$IP6TABLES -P FORWARD DROP +#$IP6TABLES -P OUTPUT DROP +# +## The mangle table can pass everything +#$IP6TABLES -t mangle -P PREROUTING ACCEPT +#$IP6TABLES -t mangle -P INPUT ACCEPT +#$IP6TABLES -t mangle -P FORWARD ACCEPT +#$IP6TABLES -t mangle -P OUTPUT ACCEPT +#$IP6TABLES -t mangle -P POSTROUTING ACCEPT # Delete all rules. -$IP6TABLES -F 2>/dev/null -$IP6TABLES -t mangle -F 2>/dev/null - -# Delete all chains. -$IP6TABLES -X 2>/dev/null -$IP6TABLES -t mangle -X 2>/dev/null - -# Zero all packets and counters. -$IP6TABLES -Z 2>/dev/null -$IP6TABLES -t mangle -Z 2>/dev/null -fi +#$IP6TABLES -F 2>/dev/null +#$IP6TABLES -t mangle -F 2>/dev/null +# +## Delete all chains. +#$IP6TABLES -X 2>/dev/null +#$IP6TABLES -t mangle -X 2>/dev/null +# +## Zero all packets and counters. +#$IP6TABLES -Z 2>/dev/null +#$IP6TABLES -t mangle -Z 2>/dev/null +#fi # Custom user-defined chains. #------------------------------------------------------------------------------ # LOG packets, then ACCEPT. $IPTABLES -N ACCEPTLOG -$IPTABLES -A ACCEPTLOG -j $LOG $RLIMIT --log-prefix "ACCEPT " +$IPTABLES -A ACCEPTLOG -j $LOG $RLIMIT --log-prefix "iptables: ACCEPT " $IPTABLES -A ACCEPTLOG -j ACCEPT # LOG packets, then DROP. $IPTABLES -N DROPLOG -$IPTABLES -A DROPLOG -j $LOG $RLIMIT --log-prefix "DROP " +$IPTABLES -A DROPLOG -j $LOG $RLIMIT --log-prefix "iptables: DROP " $IPTABLES -A DROPLOG -j DROP # LOG packets, then REJECT. # TCP packets are rejected with a TCP reset. $IPTABLES -N REJECTLOG -$IPTABLES -A REJECTLOG -j $LOG $RLIMIT --log-prefix "REJECT " +$IPTABLES -A REJECTLOG -j $LOG $RLIMIT --log-prefix "iptables: REJECT " $IPTABLES -A REJECTLOG -p tcp -j REJECT --reject-with tcp-reset $IPTABLES -A REJECTLOG -j REJECT +# Allow loopback interface to do anything. +$IPTABLES -A INPUT -i lo -j ACCEPT +$IPTABLES -A OUTPUT -o lo -j ACCEPT + + # Only allows RELATED ICMP types # (destination-unreachable, time-exceeded, and parameter-problem). # TODO: Rate-limit this traffic? @@ -185,10 +189,6 @@ $IPTABLES -A FORWARD -p icmp -j DROPLOG # Selectively allow certain special types of traffic. #------------------------------------------------------------------------------ -# Allow loopback interface to do anything. -$IPTABLES -A INPUT -i lo -j ACCEPT -$IPTABLES -A OUTPUT -o lo -j ACCEPT - # Allow incoming connections related to existing allowed connections. $IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT @@ -199,7 +199,7 @@ $IPTABLES -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT #------------------------------------------------------------------------------ # We don't care about Milkosoft, Drop SMB/CIFS/etc.. -# ^ person before me; my label = psychogreedyevilsoft +# ^ greedyevilsoft $IPTABLES -A INPUT -p tcp -m multiport --dports 135,137,138,139,445,1433,1434 -j DROP $IPTABLES -A INPUT -p udp -m multiport --dports 135,137,138,139,445,1433,1434 -j DROP @@ -234,12 +234,13 @@ $IPTABLES -A SYN_FLOOD -m limit --limit 2/s --limit-burst 6 -j RETURN $IPTABLES -A SYN_FLOOD -j DROP -$IPTABLES -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -m limit --limit 5/min --limit-burst 7 -j LOG --log-prefix "iptables: drop sync: " --log-level 7 -$IPTABLES -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP - -$IPTABLES -A INPUT -f -m limit --limit 5/min --limit-burst 7 -j LOG --log-prefix "iptables: drop frag: " -$IPTABLES -A INPUT -f -j DROP +#$IPTABLES -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -m limit --limit 30/min --limit-burst 7 -j DROPLOG --log-prefix "iptables: drop sync: " --log-level 7 +#$IPTABLES -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP +$IPTABLES -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROPLOG +#$IPTABLES -A INPUT -f -m limit --limit 5/min --limit-burst 7 -j LOG --log-prefix "iptables: drop frag: " +#$IPTABLES -A INPUT -f -j DROP +$IPTABLES -A INPUT -f -j DROPLOG # TODO: ICQ, MSN, GTalk, Skype, Yahoo, etc... @@ -247,22 +248,67 @@ $IPTABLES -A INPUT -f -j DROP #------------------------------------------------------------------------------ # Allow incoming SSH requests. -$IPTABLES -A INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT +#$IPTABLES -A INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT + +# Allow incoming https server +#$IPTABLES -A INPUT -p tcp -m tcp --dport 443 --sport $PHIGH -m state --state NEW,ESTABLISHED -j ACCEPT + + +# Selectively allow certain outbound connections, block the rest. +#------------------------------------------------------------------------------ +# + +# Allow ping +$IPTABLES -A OUTPUT -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT +# Allow to ssh clients +$IPTABLES -A OUTPUT -p tcp -m tcp --sport 2222 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT + +# Allow to dns +$IPTABLES -A OUTPUT -p udp -m udp --sport $PHIGH --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow irc +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 6667 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to xmmp +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 5222 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT +# Allow to rsync server +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 873 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to pop3s server +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 995 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to smtps server +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 465 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to ntp server +$IPTABLES -A OUTPUT -p udp -m udp --sport $PHIGH --dport 123 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to ftp server +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 20 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to https server +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 443 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT +#$IPTABLES -A OUTPUT -p udp -m udp --sport $PHIGH --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT +# Allow to http server +$IPTABLES -A OUTPUT -p tcp -m tcp --sport $PHIGH --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT + +# Selectively allow certain outbound server connections, block the rest. +#------------------------------------------------------------------------------ + +# Allow from https server +#$IPTABLES -A OUTPUT -p tcp -m tcp --sport 443 --dport $PHIGH -m state --state ESTABLISHED -j ACCEPT + +# Allow from dns server +#$IPTABLES -A OUTPUT -p udp -m udp --sport 53 --dport $PHIGH -m state --state ESTABLISHED -j ACCEPT # Explicitly log and reject everything else. #------------------------------------------------------------------------------ # Use REJECT instead of REJECTLOG if you don't need/want logging. -$IPTABLES -A INPUT -j REJECTLOG -$IPTABLES -A OUTPUT -j REJECTLOG +$IPTABLES -A INPUT -j DROPLOG +$IPTABLES -A OUTPUT -j DROPLOG $IPTABLES -A FORWARD -j REJECTLOG # Counter hits -for i in $NIC_NAME -do - iptables -I INPUT -p tcp -m multiport --dports 22 -i $i -m state --state NEW -m recent --set - iptables -I INPUT -p tcp -m multiport --dports 22 -i $i -m state --state NEW -m recent --update --seconds 50 --hitcount 3 -j DROP -done +#for i in $NIC_NAME +#do +# iptables -I INPUT -p tcp -m multiport --dports 22 -i $i -m state --state NEW -m recent --set +# iptables -I INPUT -p tcp -m multiport --dports 22 -i $i -m state --state NEW -m recent --update --seconds 50 --hitcount 3 -j DROP +#done #------------------------------------------------------------------------------ # Testing the firewall. @@ -273,5 +319,4 @@ done # Exit gracefully. #------------------------------------------------------------------------------ - - exit 0 +exit 0 diff --git a/core/conf/iptables/rules.v4 b/core/conf/iptables/rules.v4 index 5a2ffe8..568455a 100644 --- a/core/conf/iptables/rules.v4 +++ b/core/conf/iptables/rules.v4 @@ -1,25 +1,25 @@ -# Generated by iptables-save v1.6.1 on Tue Feb 21 13:55:04 2017 +# Generated by iptables-save v1.6.1 on Sat Feb 25 18:34:17 2017 *security -:INPUT ACCEPT [3624:2121853] +:INPUT ACCEPT [4559:2307887] :FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [3590:999020] +:OUTPUT ACCEPT [4459:962215] COMMIT -# Completed on Tue Feb 21 13:55:04 2017 -# Generated by iptables-save v1.6.1 on Tue Feb 21 13:55:04 2017 +# Completed on Sat Feb 25 18:34:17 2017 +# Generated by iptables-save v1.6.1 on Sat Feb 25 18:34:17 2017 *raw -:PREROUTING ACCEPT [5432:2268406] -:OUTPUT ACCEPT [3623:1011362] +:PREROUTING ACCEPT [18446:3412851] +:OUTPUT ACCEPT [4467:962535] COMMIT -# Completed on Tue Feb 21 13:55:04 2017 -# Generated by iptables-save v1.6.1 on Tue Feb 21 13:55:04 2017 +# Completed on Sat Feb 25 18:34:17 2017 +# Generated by iptables-save v1.6.1 on Sat Feb 25 18:34:17 2017 *nat -:PREROUTING ACCEPT [1808:146553] -:INPUT ACCEPT [0:0] -:OUTPUT ACCEPT [322:28410] -:POSTROUTING ACCEPT [289:16068] +:PREROUTING ACCEPT [13936:1107904] +:INPUT ACCEPT [49:2940] +:OUTPUT ACCEPT [504:40037] +:POSTROUTING ACCEPT [504:40037] COMMIT -# Completed on Tue Feb 21 13:55:04 2017 -# Generated by iptables-save v1.6.1 on Tue Feb 21 13:55:04 2017 +# Completed on Sat Feb 25 18:34:17 2017 +# Generated by iptables-save v1.6.1 on Sat Feb 25 18:34:17 2017 *mangle :PREROUTING ACCEPT [0:0] :INPUT ACCEPT [0:0] @@ -27,21 +27,18 @@ COMMIT :OUTPUT ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] COMMIT -# Completed on Tue Feb 21 13:55:04 2017 -# Generated by iptables-save v1.6.1 on Tue Feb 21 13:55:04 2017 +# Completed on Sat Feb 25 18:34:17 2017 +# Generated by iptables-save v1.6.1 on Sat Feb 25 18:34:17 2017 *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] -:OUTPUT ACCEPT [0:0] +:OUTPUT DROP [0:0] :ACCEPTLOG - [0:0] :DROPLOG - [0:0] :REJECTLOG - [0:0] :RELATED_ICMP - [0:0] :SYN_FLOOD - [0:0] --A INPUT -i wlp7s0 -p tcp -m multiport --dports 22 -m state --state NEW -m recent --update --seconds 50 --hitcount 3 --name DEFAULT --mask 255.255.255.255 --rsource -j DROP --A INPUT -i wlp7s0 -p tcp -m multiport --dports 22 -m state --state NEW -m recent --set --name DEFAULT --mask 255.255.255.255 --rsource --A INPUT -i enp8s0 -p tcp -m multiport --dports 22 -m state --state NEW -m recent --update --seconds 50 --hitcount 3 --name DEFAULT --mask 255.255.255.255 --rsource -j DROP --A INPUT -i enp8s0 -p tcp -m multiport --dports 22 -m state --state NEW -m recent --set --name DEFAULT --mask 255.255.255.255 --rsource +-A INPUT -i lo -j ACCEPT -A INPUT -p icmp -m limit --limit 1/sec --limit-burst 2 -j ACCEPT -A INPUT -p icmp -m limit --limit 1/sec --limit-burst 2 -j LOG --log-prefix "PING-DROP:" -A INPUT -p icmp -j DROP @@ -50,7 +47,6 @@ COMMIT -A INPUT -p icmp -m state --state RELATED -m limit --limit 3/sec --limit-burst 8 -j RELATED_ICMP -A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 3/sec --limit-burst 8 -j ACCEPT -A INPUT -p icmp -j DROPLOG --A INPUT -i lo -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m multiport --dports 135,137,138,139,445,1433,1434 -j DROP -A INPUT -p udp -m multiport --dports 135,137,138,139,445,1433,1434 -j DROP @@ -68,31 +64,41 @@ COMMIT -A INPUT -p tcp -m tcp --tcp-flags FIN,ACK FIN -j DROPLOG -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,ACK,URG -j DROPLOG -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j SYN_FLOOD --A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -m limit --limit 5/min --limit-burst 7 -j LOG --log-prefix "iptables: drop sync: " --log-level 7 --A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP --A INPUT -f -m limit --limit 5/min --limit-burst 7 -j LOG --log-prefix "iptables: drop frag: " --A INPUT -f -j DROP --A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --A INPUT -j REJECTLOG +-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROPLOG +-A INPUT -f -j DROPLOG +-A INPUT -j DROPLOG -A FORWARD -p icmp -f -j DROPLOG -A FORWARD -p icmp -j DROPLOG -A FORWARD -m state --state INVALID -j DROP -A FORWARD -j REJECTLOG +-A OUTPUT -o lo -j ACCEPT -A OUTPUT -p icmp -j ACCEPT -A OUTPUT -p icmp -f -j DROPLOG -A OUTPUT -p icmp -m state --state ESTABLISHED -m limit --limit 3/sec --limit-burst 8 -j ACCEPT -A OUTPUT -p icmp -m state --state RELATED -m limit --limit 3/sec --limit-burst 8 -j RELATED_ICMP -A OUTPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 3/sec --limit-burst 8 -j ACCEPT -A OUTPUT -p icmp -j DROPLOG --A OUTPUT -o lo -j ACCEPT -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT -A OUTPUT -m state --state INVALID -j DROP --A OUTPUT -j REJECTLOG --A ACCEPTLOG -m limit --limit 3/sec --limit-burst 8 -j LOG --log-prefix "ACCEPT " --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options +-A OUTPUT -p icmp -m icmp --icmp-type 8 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 2222 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT +-A OUTPUT -p udp -m udp --sport 1024:65535 --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 6667 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 5222 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 873 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 995 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 465 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p udp -m udp --sport 1024:65535 --dport 123 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 20 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 443 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT +-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT +-A OUTPUT -j DROPLOG +-A ACCEPTLOG -m limit --limit 3/sec --limit-burst 8 -j LOG --log-prefix "iptables: ACCEPT " --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options -A ACCEPTLOG -j ACCEPT --A DROPLOG -m limit --limit 3/sec --limit-burst 8 -j LOG --log-prefix "DROP " --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options +-A DROPLOG -m limit --limit 3/sec --limit-burst 8 -j LOG --log-prefix "iptables: DROP " --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options -A DROPLOG -j DROP --A REJECTLOG -m limit --limit 3/sec --limit-burst 8 -j LOG --log-prefix "REJECT " --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options +-A REJECTLOG -m limit --limit 3/sec --limit-burst 8 -j LOG --log-prefix "iptables: REJECT " --log-level 7 --log-tcp-sequence --log-tcp-options --log-ip-options -A REJECTLOG -p tcp -j REJECT --reject-with tcp-reset -A REJECTLOG -j REJECT --reject-with icmp-port-unreachable -A RELATED_ICMP -p icmp -m icmp --icmp-type 3 -j ACCEPT @@ -102,4 +108,4 @@ COMMIT -A SYN_FLOOD -m limit --limit 2/sec --limit-burst 6 -j RETURN -A SYN_FLOOD -j DROP COMMIT -# Completed on Tue Feb 21 13:55:04 2017 +# Completed on Sat Feb 25 18:34:17 2017 diff --git a/core/conf/sysctl.conf b/core/conf/sysctl.conf index b60d3e6..d17c0c6 100644 --- a/core/conf/sysctl.conf +++ b/core/conf/sysctl.conf @@ -2,9 +2,13 @@ # /etc/sysctl.conf: configuration for system variables, see sysctl.conf(5) # -kernel.printk = 15 1 1 4 -kernel.randomize_va_space = 1 -kernel.shmmax = 500000000 +kernel.printk = 7 1 1 4 +kernel.randomize_va_space = 2 +# Shared Memory +#kernel.shmmax = 500000000 +# Total allocated file handlers that can be allocated +# fs.file-nr= +vm.mmap_min_addr=65536 # Allow for more PIDs (to reduce rollover problems); may break some programs 32768 kernel.pid_max = 65536 @@ -16,14 +20,13 @@ kernel.pid_max = 65536 # Ioperm and iopl can be used to modify the running kernel. # Unfortunately, some programs need this access to operate properly, # the most notable of which are XFree86 and hwclock. hwclock can be -# remedied by having RTC support in the kernel, so real-time -# clock support is enabled if this option is enabled, to ensure +# remedied by having RTC support in the kernel, so real-time +# clock support is enabled if this option is enabled, to ensure # that hwclock operates correctly. -# +# # If you're using XFree86 or a version of Xorg from 2012 or earlier, # you may not be able to boot into a graphical environment with this # option enabled. In this case, you should use the RBAC system instead. -#kernel.grsecurity.disable_priv_io = 1 kernel.grsecurity.disable_priv_io = 0 # If you say Y here, attempts to bruteforce exploits against forking @@ -36,13 +39,13 @@ kernel.grsecurity.disable_priv_io = 0 # In the suid/sgid case, the attempt is logged, the user has all their # existing instances of the suid/sgid binary terminated and will # be unable to execute any suid/sgid binaries for 15 minutes. -# +# # It is recommended that you also enable signal logging in the auditing # section so that logs are generated when a process triggers a suspicious # signal. # If the sysctl option is enabled, a sysctl option with name # "deter_bruteforce" is created. -#kernel.grsecurity.deter_bruteforce = 1 +kernel.grsecurity.deter_bruteforce = 1 # # Filesystem Protections @@ -58,7 +61,7 @@ fs.file-max = 65535 # symlink is the owner of the directory. users will also not be # able to hardlink to files they do not own. If the sysctl option is # enabled, a sysctl option with name "linking_restrictions" is created. -kernel.grsecurity.linking_restrictions = 1 +kernel.grsecurity.linking_restrictions = 0 # Apache's SymlinksIfOwnerMatch option has an inherent race condition @@ -72,7 +75,7 @@ kernel.grsecurity.linking_restrictions = 1 # will be in place for the group you specify. If the sysctl option # is enabled, a sysctl option with name "enforce_symlinksifowner" is # created. -#kernel.grsecurity.enforce_symlinksifowner = 1 +kernel.grsecurity.enforce_symlinksifowner = 0 #kernel.grsecurity.symlinkown_gid = 33 # if you say Y here, users will not be able to write to FIFOs they don't @@ -80,7 +83,7 @@ kernel.grsecurity.linking_restrictions = 1 # the FIFO is the same owner of the directory it's held in. If the sysctl # option is enabled, a sysctl option with name "fifo_restrictions" is # created. -#kernel.grsecurity.fifo_restrictions = 1 +kernel.grsecurity.fifo_restrictions = 0 # If you say Y here, a sysctl option with name "romount_protect" will # be created. By setting this option to 1 at runtime, filesystems @@ -115,14 +118,14 @@ kernel.grsecurity.chroot_caps = 1 # against another published method of breaking a chroot. If the sysctl # option is enabled, a sysctl option with name "chroot_deny_chmod" is # created. -kernel.grsecurity.chroot_deny_chmod = 1 +kernel.grsecurity.chroot_deny_chmod = 1 # If you say Y here, processes inside a chroot will not be able to chroot # again outside the chroot. This is a widely used method of breaking -# out of a chroot jail and should not be allowed. If the sysctl -# option is enabled, a sysctl option with name +# out of a chroot jail and should not be allowed. If the sysctl +# option is enabled, a sysctl option with name # "chroot_deny_chroot" is created. -kernel.grsecurity.chroot_deny_chroot = 1 +kernel.grsecurity.chroot_deny_chroot = 1 # If you say Y here, a well-known method of breaking chroots by fchdir'ing # to a file descriptor of the chrooting process that points to a directory @@ -182,14 +185,14 @@ kernel.grsecurity.chroot_deny_unix = 1 # directory, so that `.' can be outside the tree rooted at # `/'. In particular, the super-user can escape from a # `chroot jail' by doing `mkdir foo; chroot foo; cd ..'. -# +# # It is recommended that you say Y here, since it's not known to break # any software. If the sysctl option is enabled, a sysctl option with # name "chroot_enforce_chdir" is created. kernel.grsecurity.chroot_enforce_chdir = 1 # If you say Y here, processes inside a chroot will not be able to -# kill, send signals with fcntl, ptrace, capget, getpgid, setpgid, +# kill, send signals with fcntl, ptrace, capget, getpgid, setpgid, # getsid, or view any process outside of the chroot. If the sysctl # option is enabled, a sysctl option with name "chroot_findtask" is # created. @@ -212,7 +215,7 @@ kernel.grsecurity.chroot_restrict_nice = 1 # watch certain users instead of having a large amount of logs from the # entire system. If the sysctl option is enabled, a sysctl option with # name "audit_group" is created. -kernel.grsecurity.audit_group = 0 +kernel.grsecurity.audit_group = 0 # If you say Y here, the exec and chdir logging features will only operate # on a group you specify. This option is recommended if you only want to @@ -228,67 +231,64 @@ kernel.grsecurity.audit_group = 0 # name "exec_logging" is created. # WARNING: This option when enabled will produce a LOT of logs, especially # on an active system. -kernel.grsecurity.exec_logging = 0 +kernel.grsecurity.exec_logging = 0 # If you say Y here, all attempts to overstep resource limits will # be logged with the resource name, the requested size, and the current # limit. It is highly recommended that you say Y here. If the sysctl # option is enabled, a sysctl option with name "resource_logging" is # created. If the RBAC system is enabled, the sysctl value is ignored. -#kernel.grsecurity.resource_logging = 1 -kernel.grsecurity.resource_logging = 0 +kernel.grsecurity.resource_logging = 1 # If you say Y here, all executions inside a chroot jail will be logged # to syslog. This can cause a large amount of logs if certain # applications (eg. djb's daemontools) are installed on the system, and # is therefore left as an option. If the sysctl option is enabled, a # sysctl option with name "chroot_execlog" is created. -kernel.grsecurity.chroot_execlog = 0 +kernel.grsecurity.chroot_execlog = 0 # If you say Y here, all attempts to attach to a process via ptrace # will be logged. If the sysctl option is enabled, a sysctl option # with name "audit_ptrace" is created. -#kernel.grsecurity.audit_ptrace = 1 -kernel.grsecurity.audit_ptrace = 0 +kernel.grsecurity.audit_ptrace = 1 # If you say Y here, all attempts to attach to a process via ptrace # will be logged. If the sysctl option is enabled, a sysctl option # with name "audit_ptrace" is created. -kernel.grsecurity.audit_chdir = 0 +kernel.grsecurity.audit_chdir = 0 # If you say Y here, all mounts and unmounts will be logged. If the # sysctl option is enabled, a sysctl option with name "audit_mount" is # created. -#kernel.grsecurity.audit_mount = 1 -kernel.grsecurity.audit_mount = 0 +kernel.grsecurity.audit_mount = 1 # If you say Y here, certain important signals will be logged, such as # SIGSEGV, which will as a result inform you of when a error in a program # occurred, which in some cases could mean a possible exploit attempt. # If the sysctl option is enabled, a sysctl option with name # "signal_logging" is created. -kernel.grsecurity.signal_logging = 0 +kernel.grsecurity.signal_logging = 1 # If you say Y here, all failed fork() attempts will be logged. # This could suggest a fork bomb, or someone attempting to overstep # their process limit. If the sysctl option is enabled, a sysctl option # with name "forkfail_logging" is created. #kernel.grsecurity.forkfail_logging = 1 -kernel.grsecurity.forkfail_logging = 0 +kernel.grsecurity.forkfail_logging = 1 # If you say Y here, any changes of the system clock will be logged. # If the sysctl option is enabled, a sysctl option with name # "timechange_logging" is created. -#kernel.grsecurity.timechange_logging = 1 +kernel.grsecurity.timechange_logging = 1 # if you say Y here, calls to mmap() and mprotect() with explicit # usage of PROT_WRITE and PROT_EXEC together will be logged when # denied by the PAX_MPROTECT feature. This feature will also # log other problematic scenarios that can occur when PAX_MPROTECT -# is enabled on a binary, like textrels and PT_GNU_STACK. If the +# is enabled on a binary, like textrels and PT_GNU_STACK. If the # sysctl option is enabled, a sysctl option with name "rwxmap_logging" # is created. -#kernel.grsecurity.rwxmap_logging = 1 +kernel.grsecurity.rwxmap_logging = 1 # # Executable Protections @@ -305,14 +305,14 @@ kernel.grsecurity.forkfail_logging = 0 kernel.grsecurity.dmesg = 1 # Hide symbol addresses in /proc/kallsyms -kernel.kptr_restrict = 1 +#kernel.kptr_restrict = 2 # If you say Y here, TTY sniffers and other malicious monitoring # programs implemented through ptrace will be defeated. If you # have been using the RBAC system, this option has already been # enabled for several years for all users, with the ability to make # fine-grained exceptions. -# +# # This option only affects the ability of non-root users to ptrace # processes that are not a descendent of the ptracing process. # This means that strace ./binary and gdb ./binary will still work, @@ -327,7 +327,7 @@ kernel.grsecurity.harden_ptrace = 1 # prevent infoleaking of their contents. This option adds # consistency to the use of that file mode, as the binary could normally # be read out when run without privileges while ptracing. -# +# # If the sysctl option is enabled, a sysctl option with name "ptrace_readexec" # is created. kernel.grsecurity.ptrace_readexec = 1 @@ -341,7 +341,7 @@ kernel.grsecurity.ptrace_readexec = 1 # same way, allowing the other threads of the process to continue # running with root privileges. If the sysctl option is enabled, # a sysctl option with name "consistent_setxid" is created. -#kernel.grsecurity.consistent_setxid = 1 +kernel.grsecurity.consistent_setxid = 0 # If you say Y here, access to overly-permissive IPC objects (shared # memory, message queues, and semaphores) will be denied for processes @@ -359,7 +359,7 @@ kernel.grsecurity.ptrace_readexec = 1 # CAP_IPC_OWNER are still permitted to access these IPC objects. # If the sysctl option is enabled, a sysctl option with name # "harden_ipc" is created. -kernel.grsecurity.harden_ipc = 1 +kernel.grsecurity.harden_ipc = 0 # If you say Y here, you will be able to choose a gid to add to the # supplementary groups of users you want to mark as "untrusted." @@ -367,7 +367,7 @@ kernel.grsecurity.harden_ipc = 1 # root-owned directories writable only by root. If the sysctl option # is enabled, a sysctl option with name "tpe" is created. kernel.grsecurity.tpe = 1 -kernel.grsecurity.tpe_gid = 101 +kernel.grsecurity.tpe_gid = 4 # If you say Y here, the group you specify in the TPE configuration will # decide what group TPE restrictions will be *disabled* for. This @@ -386,10 +386,11 @@ kernel.grsecurity.tpe_invert = 1 # world-writable, or in directories owned by root and writable only by # root. If the sysctl option is enabled, a sysctl option with name # "tpe_restrict_all" is created. -kernel.grsecurity.tpe_restrict_all = 0 +kernel.grsecurity.tpe_restrict_all = 1 + +kernel.grsecurity.harden_tty = 1 -#kernel.grsecurity.harden_tty = 1 # # Network Protections # @@ -418,7 +419,7 @@ net.ipv6.conf.lo.disable_ipv6 = 1 #net.ipv6.conf.default.dad_transmits = 0 #net.ipv6.conf.default.max_addresses = 0 -# Avoid a smurf attack +# Avoid a smurf attack, ping scanning net.ipv4.icmp_echo_ignore_broadcasts = 1 # Turn on protection for bad icmp error messages @@ -447,10 +448,6 @@ net.ipv4.conf.default.log_martians = 1 ## ignore echo broadcast requests to prevent being part of smurf attacks (default) net.ipv4.icmp_echo_ignore_broadcasts = 1 -# No source routed packets here -net.ipv4.conf.all.accept_source_route = 0 -net.ipv4.conf.default.accept_source_route = 0 - ## sets the kernels reverse path filtering mechanism to value 1(on) ## will do source validation of the packet's recieved from all the interfaces on the machine ## protects from attackers that are using ip spoofing methods to do harm @@ -459,16 +456,23 @@ net.ipv4.conf.default.rp_filter = 1 #net.ipv6.conf.default.rp_filter = 1 #net.ipv6.conf.all.rp_filter = 1 + # Make sure no one can alter the routing tables +# Act as a router, necessary for Access Point net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 +# No source routed packets here +# Discard packets with source routes, ip spoofing +net.ipv4.conf.all.accept_source_route = 0 +net.ipv4.conf.default.accept_source_route = 0 -# Act as a router, necessary for Access Point -net.ipv4.ip_forward = 1 -net.ipv4.conf.all.send_redirects = 1 -net.ipv4.conf.default.send_redirects = 1 + +net.ipv4.conf.all.send_redirects = 0 +net.ipv4.conf.default.send_redirects = 0 + +net.ipv4.ip_forward = 0 # Increase system IP port limits net.ipv4.ip_local_port_range = 2000 65000 @@ -477,15 +481,29 @@ net.ipv4.ip_local_port_range = 2000 65000 net.ipv4.tcp_rmem = 4096 87380 8388608 net.ipv4.tcp_wmem = 4096 87380 8388608 +# Disable proxy_arp +net.ipv4.conf.default.proxy_arp = 0 +net.ipv4.conf.all.proxy_arp = 0 + +# Disable bootp_relay +net.ipv4.conf.default.bootp_relay = 0 +net.ipv4.conf.all.bootp_relay = 0 + +# Decrease TCP fin timeout +net.ipv4.tcp_fin_timeout = 30 +# Decrease TCP keep alive time +net.ipv4.tcp_keepalive_time = 1800 +# Sen SynAck retries to 3 +net.ipv4.tcp_synack_retries = 3 # If you say Y here, neither TCP resets nor ICMP # destination-unreachable packets will be sent in response to packets # sent to ports for which no associated listening process exists. -# This feature supports both IPV4 and IPV6 and exempts the -# loopback interface from blackholing. Enabling this feature +# This feature supports both IPV4 and IPV6 and exempts the +# loopback interface from blackholing. Enabling this feature # makes a host more resilient to DoS attacks and reduces network # visibility against scanners. -# +# # The blackhole feature as-implemented is equivalent to the FreeBSD # blackhole feature, as it prevents RST responses to all packets, not # just SYNs. Under most application behavior this causes no @@ -498,7 +516,7 @@ net.ipv4.tcp_wmem = 4096 87380 8388608 # can spend in LAST_ACK state. If you're using haproxy and not # all servers it connects to have this option enabled, consider # disabling this feature on the haproxy host. -# +# # If the sysctl option is enabled, two sysctl options with names # "ip_blackhole" and "lastack_retries" will be created. # While "ip_blackhole" takes the standard zero/non-zero on/off @@ -506,14 +524,14 @@ net.ipv4.tcp_wmem = 4096 87380 8388608 # "tcp_retries1" and "tcp_retries2". The default value of 4 # prevents a socket from lasting more than 45 seconds in LAST_ACK # state. -#kernel.grsecurity.ip_blackhole = 1 -#kernel.grsecurity.lastack_retries = 4 +kernel.grsecurity.ip_blackhole = 1 +kernel.grsecurity.lastack_retries = 4 # If you say Y here, you will be able to choose a GID of whose users will # be unable to connect to other hosts from your machine or run server # applications from your machine. If the sysctl option is enabled, a # sysctl option with name "socket_all" is created. -#kernel.grsecurity.socket_all = 1 +kernel.grsecurity.socket_all = 0 # Here you can choose the GID to disable socket access for. Remember to # add the users you want socket access disabled for to the GID @@ -527,13 +545,13 @@ net.ipv4.tcp_wmem = 4096 87380 8388608 # you specify will have to use passive mode when initiating ftp transfers # from the shell on your machine. If the sysctl option is enabled, a # sysctl option with name "socket_client" is created. -#kernel.grsecurity.socket_client = 1 +kernel.grsecurity.socket_client = 1 # Here you can choose the GID to disable client socket access for. # Remember to add the users you want client socket access disabled for to # the GID specified here. If the sysctl option is enabled, a sysctl # option with name "socket_client_gid" is created. -#kernel.grsecurity.socket_client_gid = 203 +kernel.grsecurity.socket_client_gid = 15 # If you say Y here, you will be able to choose a GID of whose users will # be unable to connect to other hosts from your machine, but will be @@ -541,13 +559,13 @@ net.ipv4.tcp_wmem = 4096 87380 8388608 # you specify will have to use passive mode when initiating ftp transfers # from the shell on your machine. If the sysctl option is enabled, a # sysctl option with name "socket_client" is created. -#kernel.grsecurity.socket_server = 1 +kernel.grsecurity.socket_server = 1 # Here you can choose the GID to disable server socket access for. # Remember to add the users you want server socket access disabled for to # the GID specified here. If the sysctl option is enabled, a sysctl # option with name "socket_server_gid" is created. -#kernel.grsecurity.socket_server_gid = 204 +kernel.grsecurity.socket_server_gid = 99 # # Physical Protections @@ -559,17 +577,15 @@ net.ipv4.tcp_wmem = 4096 87380 8388608 # device insertion will be logged. This option is intended to be # used against custom USB devices designed to exploit vulnerabilities # in various USB device drivers. -# +# # For greatest effectiveness, this sysctl should be set after any # relevant init scripts. This option is safe to enable in distros # as each user can choose whether or not to toggle the sysctl. -#kernel.grsecurity.deny_new_usb = 0 +kernel.grsecurity.deny_new_usb = 0 # # Restrict grsec sysctl changes after this was set # -#kernel.grsecurity.grsec_lock = 1 - - +kernel.grsecurity.grsec_lock = 0 # End of file diff --git a/core/dash.html b/core/dash.html index ed6dbab..a926ce7 100644 --- a/core/dash.html +++ b/core/dash.html @@ -2,13 +2,13 @@ - 2.4.1. Dash + 2.5.1. Dash Core OS Index -

      2.4.1. Dash

      +

      2.5.1. Dash

      By default dash installed as /bin/sh, if not relink;

      diff --git a/core/exim.html b/core/exim.html index c1fd494..e922789 100644 --- a/core/exim.html +++ b/core/exim.html @@ -2,24 +2,33 @@ - 2.5. Exim + 2.6. Exim Core OS Index -

      2.5. Exim

      +

      2.6. Exim

      -

      2.5.1. Exim Configuration

      +

      2.6.1. Exim Configuration

      Exim come with default configuration we will change to mach system settings /etc/exim/exim.conf.

      -

      2.5.2. Certificates

      +
      +        $ sudo prt-get depinst mailx
      +        
      -

      Create private key, this example issues a certificate to - core.privat-server.net, if you wish get a subdomain from - afraid.org - pointing to your public ip. -

      +

      2.6.2. Certificates

      + +

      Exim creates a key for you if you just copy exim.conf and start daemon;

      + +
      +        # cp /home/silvino/data/git/c9/c9-doc/core/conf/exim/exim.conf /etc/exim/exim.conf
      +        # sh /etc/rc.d/exim start
      +        SSL certificate /etc/ssl/certs/exim.crt with key /etc/ssl/keys/exim.key for host c9.core created
      +        #
      +        
      + +

      Manually create a private key;

       	$ sudo mkdir /etc/ssl/keys
      @@ -55,7 +64,7 @@
       	# chmod 644 /etc/ssl/certs/exim.cert
       	
      -

      2.5.3. Aliases

      +

      2.6.3. Aliases

      Exim come with default aliases we will change to mach system settings /etc/exim/aliases;

      @@ -100,7 +109,7 @@ #### -

      2.5.4. Smarthost

      +

      2.6.4. Smarthost

      Tony Finch publish a nice configuration reference. @@ -124,7 +133,7 @@ # exim -bt bob@remote.com -

      2.5. Fetchmail

      +

      2.6. Fetchmail

               $ prt-get depinst fetchmail
      diff --git a/core/grsecurity.html b/core/grsecurity.html
      new file mode 100644
      index 0000000..cda9bfb
      --- /dev/null
      +++ b/core/grsecurity.html
      @@ -0,0 +1,85 @@
      +
      +
      +    
      +        
      +        Grsecurity
      +    
      +    
      +
      +        Tools Index
      +
      +        

      Grsecurity

      + +

      Grsecurity utilities are installed and configured in + hardening, kernel witch grsecurity + patch is installed using + linux port.

      + + +

      Special Groups

      +
      +        getent group tpe >/dev/null || groupadd -g 200 tpe
      +        getent group audit >/dev/null || groupadd -g 201 audit
      +        getent group socket-deny-all >/dev/null || groupadd -g 202 socket-deny-all
      +        getent group socket-deny-client >/dev/null || groupadd -g 203 socket-deny-client
      +        getent group socket-deny-server >/dev/null || groupadd -g 204 socket-deny-server
      +        
      + +

      Pax

      + +

      Grub uses nested functions and thus needs either PAX_EMUTRAMP enabled in the kernel and EMUTRAMP enabled on affected binaries, or if PAX_EMUTRAMP is not enabled in the kernel, needs MPROTECT disabled on affected binaries. Depending on the version of grub in use, some of the following files may not exist, but you should mark all those that exist. To add EMUTRAMP, use the '-CE' argument to paxctl. To remove MPROTECT, use '-Cm'.

      + + /usr/bin/grub-script-check + /usr/sbin/grub-probe + /usr/sbin/grub-mkdevicemap + +

      Gradm

      + +

      Gradm is grsecurity access control lists administration utility. Gradm + have a + learning mode + per-subject, per-role or system-wide. Learning mode gather information that + RBAC system supports, it reduces policy size, increase readability and enforces + that is configurable. Protected resources can be added to /etc/grsec/learn_cong + to learning system.

      + +

      Entering in learning mode;

      + +
      +        # gradm -F -L /etc/grsec/learning.log
      +        
      + +

      To perform administrative tasks while system learning is running, + authenticate to admin role;

      + +
      +        # gradm -a admin
      +        
      + +

      When learning system have gather sufficient data disable RBAC system;

      + +
      +        # gradm -D
      +        
      + +

      Now that RBAC is disable data collected can be used to generate ACLs;

      + +
      +        # gradm -F -L /etc/grsec/learning.logs -O /etc/grset/policy
      +        
      + +

      Start RBAC with policy;

      + +
      +        # gradm -E
      +        
      + + Tools Index +

      This is part of the c9-doc Manual. + Copyright (C) 2017 + c9 team. + See the file Gnu Free Documentation License + for copying conditions.

      + + + diff --git a/core/hardening.html b/core/hardening.html new file mode 100644 index 0000000..478c911 --- /dev/null +++ b/core/hardening.html @@ -0,0 +1,197 @@ + + + + + Hardening + + + + Tools Index + +

      Hardening

      + +

      Kernel in ports have upstream linux kernel and + grsecurity patch, it should break some functionality + for the user and pkgmk user if tpe protection is active.

      + +
      +        $ sudo prt-get depinst gradm paxtest paxd checksec lynis
      +        
      + +

      Check grsecurity on how to setup + kernel, pax and gradm.

      + +

      Lynis tries to give system overall configuration, without + changing default profile run irrelevant tests. Create a lynis + profile by coping default one and run lynis;

      + +
      +        $ sudo cp /etc/lynis/default.prf /etc/lynis/custom.prf
      +        $ sudo lynis configure settings color=yes
      +        $ sudo lynis show settings
      +        $ sudo lynis show profile
      +        
      + +
      +        $ lynis audit system > lynis_report
      +        $ mv /tmp/lynis.log .
      +        $ mv /tmp/lynis-report.dat .
      +        
      + +

      Add unnecessary tests to profile to have less noise.

      + +

      Rebuild Toolchain

      + +

      Add flags to pkgmk configuration and change specific ports that + don't build with hardening flags. More information about + arch security, + gentoo security, + gcc instrumentation-options + and glibc + configuring and compiling. Edit /etc/pkgmk.conf;

      + +
      +        export CPPFLAGS="-D_FORTIFY_SOURCE=2"
      +        export CFLAGS="-O2 -march=native -mtune=native -fstack-protector-strong --param=ssp-buffer-size=4"
      +        export CXXFLAGS="${CFLAGS}"
      +        export LDFLAGS="-z relro"
      +        
      + +

      Core

      + +

      Ports in core collection that need to be changed in order + to build with pkgmk harden configuration.

      + +

      Glibc

      + + + +
      +        export CPPFLAGS=""
      +        export CFLAGS="-O2 -march=native -mtune=native"
      +        export CXXFLAGS="${CFLAGS}"
      +        export LDFLAGS=""
      +        
      + +
      +        ../$name-${version:0:4}/configure --prefix=/usr \
      +                --libexecdir=/usr/lib \
      +                --with-headers=$PKG/usr/include \
      +                --enable-kernel=3.12 \
      +                --enable-add-ons \
      +                --enable-static-nss \
      +                --disable-profile \
      +                --disable-werror \
      +                --without-gd \
      +                --enable-obsolete-rpc \
      +                --enable-multi-arch \
      +                --enable-stackguard-randomization \
      +                --enable-stack-protector=strong
      +        
      + +

      Gcc

      + + + +
      +        export CPPFLAGS=""
      +        export CFLAGS="-O2 -march=native -mtune=native"
      +        export CXXFLAGS="${CFLAGS}"
      +        export LDFLAGS=""
      +        
      + +

      libcap

      + + + +

      bzip2

      + + + +

      hdparm

      + + + +

      Opt

      + +

      lsof

      + + + +

      python

      + + + +

      zip

      + + + +

      glew

      + + + +

      dmenu

      + + + +

      Boost

      + + + +
      +        export CPPFLAGS=""
      +        export CFLAGS="-O2 -march=native -mtune=native"
      +        export CXXFLAGS="${CFLAGS}"
      +        export LDFLAGS=""
      +        
      + +

      Contrib

      + +

      gsl

      + + + + + Tools Index +

      This is part of the c9-doc Manual. + Copyright (C) 2017 + c9 team. + See the file Gnu Free Documentation License + for copying conditions.

      + + + diff --git a/core/index.html b/core/index.html index 6859376..97376f4 100644 --- a/core/index.html +++ b/core/index.html @@ -79,41 +79,46 @@
    • 2.1.5. Sysctl
  • - -
  • 2.2. Network +
  • 2.2. Hardening + +
  • +
  • 2.3. Network
  • -
  • 2.3. Package Management +
  • 2.4. Package Management
  • -
  • 2.4. Terminals and shells +
  • 2.5. Terminals and shells
  • -
  • 2.5. Exim +
  • 2.6. Exim
  • diff --git a/core/linux.html b/core/linux.html index 903d9e2..888b916 100644 --- a/core/linux.html +++ b/core/linux.html @@ -164,9 +164,8 @@ kernel.printk = 7 1 1 4 kernel.randomize_va_space = 2 - kernel.kptr_restrict = 2 # Shared Memory - kernel.shmmax = 500000000 + #kernel.shmmax = 500000000 # Total allocated file handlers that can be allocated # fs.file-nr= vm.mmap_min_addr=65536 @@ -188,7 +187,6 @@ # If you're using XFree86 or a version of Xorg from 2012 or earlier, # you may not be able to boot into a graphical environment with this # option enabled. In this case, you should use the RBAC system instead. - #kernel.grsecurity.disable_priv_io = 1 kernel.grsecurity.disable_priv_io = 0 # If you say Y here, attempts to bruteforce exploits against forking @@ -207,7 +205,7 @@ # signal. # If the sysctl option is enabled, a sysctl option with name # "deter_bruteforce" is created. - #kernel.grsecurity.deter_bruteforce = 1 + kernel.grsecurity.deter_bruteforce = 1 # # Filesystem Protections @@ -223,7 +221,7 @@ # symlink is the owner of the directory. users will also not be # able to hardlink to files they do not own. If the sysctl option is # enabled, a sysctl option with name "linking_restrictions" is created. - kernel.grsecurity.linking_restrictions = 1 + kernel.grsecurity.linking_restrictions = 0 # Apache's SymlinksIfOwnerMatch option has an inherent race condition @@ -237,7 +235,7 @@ # will be in place for the group you specify. If the sysctl option # is enabled, a sysctl option with name "enforce_symlinksifowner" is # created. - #kernel.grsecurity.enforce_symlinksifowner = 1 + kernel.grsecurity.enforce_symlinksifowner = 0 #kernel.grsecurity.symlinkown_gid = 33 # if you say Y here, users will not be able to write to FIFOs they don't @@ -245,7 +243,7 @@ # the FIFO is the same owner of the directory it's held in. If the sysctl # option is enabled, a sysctl option with name "fifo_restrictions" is # created. - #kernel.grsecurity.fifo_restrictions = 1 + kernel.grsecurity.fifo_restrictions = 0 # If you say Y here, a sysctl option with name "romount_protect" will # be created. By setting this option to 1 at runtime, filesystems @@ -280,14 +278,14 @@ # against another published method of breaking a chroot. If the sysctl # option is enabled, a sysctl option with name "chroot_deny_chmod" is # created. - kernel.grsecurity.chroot_deny_chmod = 1 + kernel.grsecurity.chroot_deny_chmod = 1 # If you say Y here, processes inside a chroot will not be able to chroot # again outside the chroot. This is a widely used method of breaking # out of a chroot jail and should not be allowed. If the sysctl # option is enabled, a sysctl option with name # "chroot_deny_chroot" is created. - kernel.grsecurity.chroot_deny_chroot = 1 + kernel.grsecurity.chroot_deny_chroot = 1 # If you say Y here, a well-known method of breaking chroots by fchdir'ing # to a file descriptor of the chrooting process that points to a directory @@ -400,7 +398,7 @@ # limit. It is highly recommended that you say Y here. If the sysctl # option is enabled, a sysctl option with name "resource_logging" is # created. If the RBAC system is enabled, the sysctl value is ignored. - #kernel.grsecurity.resource_logging = 1 + kernel.grsecurity.resource_logging = 1 # If you say Y here, all executions inside a chroot jail will be logged # to syslog. This can cause a large amount of logs if certain @@ -412,8 +410,7 @@ # If you say Y here, all attempts to attach to a process via ptrace # will be logged. If the sysctl option is enabled, a sysctl option # with name "audit_ptrace" is created. - #kernel.grsecurity.audit_ptrace = 1 - kernel.grsecurity.audit_ptrace = 0 + kernel.grsecurity.audit_ptrace = 1 # If you say Y here, all attempts to attach to a process via ptrace # will be logged. If the sysctl option is enabled, a sysctl option @@ -423,27 +420,26 @@ # If you say Y here, all mounts and unmounts will be logged. If the # sysctl option is enabled, a sysctl option with name "audit_mount" is # created. - #kernel.grsecurity.audit_mount = 1 - kernel.grsecurity.audit_mount = 0 + kernel.grsecurity.audit_mount = 1 # If you say Y here, certain important signals will be logged, such as # SIGSEGV, which will as a result inform you of when a error in a program # occurred, which in some cases could mean a possible exploit attempt. # If the sysctl option is enabled, a sysctl option with name # "signal_logging" is created. - kernel.grsecurity.signal_logging = 0 + kernel.grsecurity.signal_logging = 1 # If you say Y here, all failed fork() attempts will be logged. # This could suggest a fork bomb, or someone attempting to overstep # their process limit. If the sysctl option is enabled, a sysctl option # with name "forkfail_logging" is created. #kernel.grsecurity.forkfail_logging = 1 - kernel.grsecurity.forkfail_logging = 0 + kernel.grsecurity.forkfail_logging = 1 # If you say Y here, any changes of the system clock will be logged. # If the sysctl option is enabled, a sysctl option with name # "timechange_logging" is created. - #kernel.grsecurity.timechange_logging = 1 + kernel.grsecurity.timechange_logging = 1 # if you say Y here, calls to mmap() and mprotect() with explicit # usage of PROT_WRITE and PROT_EXEC together will be logged when @@ -452,7 +448,7 @@ # is enabled on a binary, like textrels and PT_GNU_STACK. If the # sysctl option is enabled, a sysctl option with name "rwxmap_logging" # is created. - #kernel.grsecurity.rwxmap_logging = 1 + kernel.grsecurity.rwxmap_logging = 1 # # Executable Protections @@ -469,7 +465,7 @@ kernel.grsecurity.dmesg = 1 # Hide symbol addresses in /proc/kallsyms - kernel.kptr_restrict = 1 + #kernel.kptr_restrict = 2 # If you say Y here, TTY sniffers and other malicious monitoring # programs implemented through ptrace will be defeated. If you @@ -505,7 +501,7 @@ # same way, allowing the other threads of the process to continue # running with root privileges. If the sysctl option is enabled, # a sysctl option with name "consistent_setxid" is created. - #kernel.grsecurity.consistent_setxid = 1 + kernel.grsecurity.consistent_setxid = 0 # If you say Y here, access to overly-permissive IPC objects (shared # memory, message queues, and semaphores) will be denied for processes @@ -523,7 +519,7 @@ # CAP_IPC_OWNER are still permitted to access these IPC objects. # If the sysctl option is enabled, a sysctl option with name # "harden_ipc" is created. - kernel.grsecurity.harden_ipc = 1 + kernel.grsecurity.harden_ipc = 0 # If you say Y here, you will be able to choose a gid to add to the # supplementary groups of users you want to mark as "untrusted." @@ -531,7 +527,7 @@ # root-owned directories writable only by root. If the sysctl option # is enabled, a sysctl option with name "tpe" is created. kernel.grsecurity.tpe = 1 - kernel.grsecurity.tpe_gid = 101 + kernel.grsecurity.tpe_gid = 4 # If you say Y here, the group you specify in the TPE configuration will # decide what group TPE restrictions will be *disabled* for. This @@ -550,10 +546,11 @@ # world-writable, or in directories owned by root and writable only by # root. If the sysctl option is enabled, a sysctl option with name # "tpe_restrict_all" is created. - kernel.grsecurity.tpe_restrict_all = 0 + kernel.grsecurity.tpe_restrict_all = 1 - #kernel.grsecurity.harden_tty = 1 + kernel.grsecurity.harden_tty = 1 + # # Network Protections # @@ -687,14 +684,14 @@ # "tcp_retries1" and "tcp_retries2". The default value of 4 # prevents a socket from lasting more than 45 seconds in LAST_ACK # state. - #kernel.grsecurity.ip_blackhole = 1 - #kernel.grsecurity.lastack_retries = 4 + kernel.grsecurity.ip_blackhole = 1 + kernel.grsecurity.lastack_retries = 4 # If you say Y here, you will be able to choose a GID of whose users will # be unable to connect to other hosts from your machine or run server # applications from your machine. If the sysctl option is enabled, a # sysctl option with name "socket_all" is created. - #kernel.grsecurity.socket_all = 1 + kernel.grsecurity.socket_all = 0 # Here you can choose the GID to disable socket access for. Remember to # add the users you want socket access disabled for to the GID @@ -708,13 +705,13 @@ # you specify will have to use passive mode when initiating ftp transfers # from the shell on your machine. If the sysctl option is enabled, a # sysctl option with name "socket_client" is created. - #kernel.grsecurity.socket_client = 1 + kernel.grsecurity.socket_client = 1 # Here you can choose the GID to disable client socket access for. # Remember to add the users you want client socket access disabled for to # the GID specified here. If the sysctl option is enabled, a sysctl # option with name "socket_client_gid" is created. - #kernel.grsecurity.socket_client_gid = 203 + kernel.grsecurity.socket_client_gid = 15 # If you say Y here, you will be able to choose a GID of whose users will # be unable to connect to other hosts from your machine, but will be @@ -722,13 +719,13 @@ # you specify will have to use passive mode when initiating ftp transfers # from the shell on your machine. If the sysctl option is enabled, a # sysctl option with name "socket_client" is created. - #kernel.grsecurity.socket_server = 1 + kernel.grsecurity.socket_server = 1 # Here you can choose the GID to disable server socket access for. # Remember to add the users you want server socket access disabled for to # the GID specified here. If the sysctl option is enabled, a sysctl # option with name "socket_server_gid" is created. - #kernel.grsecurity.socket_server_gid = 204 + kernel.grsecurity.socket_server_gid = 99 # # Physical Protections @@ -744,12 +741,12 @@ # For greatest effectiveness, this sysctl should be set after any # relevant init scripts. This option is safe to enable in distros # as each user can choose whether or not to toggle the sysctl. - #kernel.grsecurity.deny_new_usb = 0 + kernel.grsecurity.deny_new_usb = 0 # # Restrict grsec sysctl changes after this was set # - #kernel.grsecurity.grsec_lock = 1 + kernel.grsecurity.grsec_lock = 0 # End of file @@ -757,10 +754,10 @@ Core OS Index

    This is part of the c9-doc Manual. -Copyright (C) 2017 -c9 team. -See the file Gnu Free Documentation License -for copying conditions.

    + Copyright (C) 2017 + c9 team. + See the file Gnu Free Documentation License + for copying conditions.

    diff --git a/core/network.html b/core/network.html index bcf52f5..4f1f20a 100644 --- a/core/network.html +++ b/core/network.html @@ -2,12 +2,12 @@ - 2. Network + 2.3. Network Core OS Index -

    2. Network

    +

    2.3. Network

    Operation of the network can be handle with init scripts;

    @@ -49,7 +49,7 @@ described scripts then proceed to update system.

    -

    2.2.1. Resolver

    +

    2.3.1. Resolver

    This example will use Chaos Computer Club @@ -65,7 +65,7 @@ # chattr +i /etc/resolv.conf -

    2.2.2. Static IP

    +

    2.3.2. Static IP

    Current example of /etc/rc.d/net;

    @@ -112,7 +112,7 @@ # ip route add default via ${GW} -

    2.2.3. Iptables

    +

    2.3.3. Iptables

    For more information about iptables read arch wiki. @@ -149,7 +149,7 @@

    -

    2.2.4. Wpa and dhcpd

    +

    2.3.4. Wpa and dhcpd

    There is more information on Wiki Wifi Start Scripts and @@ -167,7 +167,7 @@ # iwconfig wlp2s0 essid NAME key s:ABCDE12345 -

    2.2.4.1. Wpa Supplicant

    +

    2.3.4.1. Wpa Supplicant

    Configure wpa supplicant edit;

    @@ -197,7 +197,7 @@ init script to auto load wpa configuration and dhcp client.

    -

    2.2.4.2. Wpa Cli

    +

    2.3.4.2. Wpa Cli

             # wpa_cli
    diff --git a/core/package.html b/core/package.html
    index 3c59669..327029e 100644
    --- a/core/package.html
    +++ b/core/package.html
    @@ -2,13 +2,13 @@
     
         
             
    -        2.3. Package Management
    +        2.4. Package Management
         
         
     
             Core OS Index
     
    -        

    2.3. Package Management

    +

    2.4. Package Management

    For more information read crux handbook Package management front-end: @@ -57,7 +57,7 @@ $ prt-get depinst prt-utils prt-get-bashcompletion

    -

    2.3.1. Update System

    +

    2.4.1. Update System

    Before build software get latest version of port collections;

    @@ -87,7 +87,7 @@ $ prt-get update -fr $(revdep) -

    2.3.2. Install port and dependencies

    +

    2.4.2. Install port and dependencies

    Installing using prt-get tool;

    @@ -111,7 +111,7 @@

    If you user pkgmk and pkgadd allways check if README, pre and post instal files exist.

    -

    2.3.3. Ports collections

    +

    2.4.3. Ports collections

    Clone this documentation;

    @@ -146,7 +146,7 @@ $ sudo ports -u 6c37 -

    2.3.4. Show port information

    +

    2.4.4. Show port information

             $ prt-get info port_name
    @@ -164,13 +164,13 @@
             $ pkginfo -o filename
             
    -

    2.3.5. Show port dependencies

    +

    2.4.5. Show port dependencies

             $ prt-get depends port_name
             
    -

    2.3.6. Print information

    +

    2.4.6. Print information

    Example how to get ports installed from contrib. Maybe there is a "cleaner" way to this, for now is ok;

    diff --git a/core/ports.html b/core/ports.html index 98ccbba..9662e43 100644 --- a/core/ports.html +++ b/core/ports.html @@ -23,8 +23,8 @@ # useradd -U -M -d /usr/ports -s /bin/false pkgmk -

    You can add your self to group pkgmk, Members of this group will - not be under tpe protection.

    +

    You can add your self to group pkgmk. Check if members of this + group are under tpe protection.

             # usermod -a -G pkgmk c9admin
    @@ -62,7 +62,7 @@
             

    Edit fstab, change uid to id of pkgmk, this example 102;

    -        pkgmk /usr/ports/work tmpfs size=30G,uid=102,defaults 0 0
    +        pkgmk /usr/ports/work tmpfs size=30G,uid=102,defaults,mode=0750 0 0
             
    @@ -86,8 +86,6 @@ export CFLAGS="-O2 -march=native -mtune=native"
    -

    "-protector-strong" which only insert stack canaries in fuctions where overflow might actually happen

    -

    Discover number of cores/cpus to hard code -j option.

    diff --git a/core/reboot.html b/core/reboot.html
    index 7bc22ea..23e2996 100644
    --- a/core/reboot.html
    +++ b/core/reboot.html
    @@ -33,13 +33,22 @@
     
             

    1.4.1. Linux Kernel

    -

    Core ports have two kernels, linux-libre and linux-blob. +

    Core ports have two + linux kernels, + linux-libre and + linux-blob. Port linux-libre kernel is a true source based kernel that respects your freedoms, is x86_64 but not generic configured, select modules (drivers) for your hardware, for example correct graphic driver and disk. Port linux-blob is dangerous, contain blobs (from bad corporations).

    +

    Addition to upstream kernel is applied a patch with + more cpu families gcc optimizations and grsecurity patch. + Check tpe protection configuration on + sysctl if breaks functionality + during initial configuration.

    +
             # cd /usr/ports/c9-ports/linux-libre
             # pkgmk -d
    diff --git a/core/scripts/setup-install.sh b/core/scripts/setup-install.sh
    index 01e3bd1..0e0a720 100644
    --- a/core/scripts/setup-install.sh
    +++ b/core/scripts/setup-install.sh
    @@ -270,7 +270,7 @@ setup_ports() {
             PATH=/bin:/usr/bin:/sbin:/usr/sbin \
             /bin/bash -c "id pkgmk >> /etc/fstab"
     
    -    echo "pkgmk                                           /usr/ports/work tmpfs size=30G,gid=102,uid=101,defaults 0    0" >> $CHROOT/etc/fstab
    +    echo "pkgmk                                           /usr/ports/work tmpfs size=30G,gid=102,uid=101,defaults,mode=0750 0    0" >> $CHROOT/etc/fstab
     
         vim $CHROOT/etc/fstab
     
    diff --git a/core/tmux.html b/core/tmux.html
    index d1ab587..fe494b5 100644
    --- a/core/tmux.html
    +++ b/core/tmux.html
    @@ -2,13 +2,13 @@
     
         
             
    -        2.4.3. Tmux
    +        2.5.3. Tmux
         
     
         
     
             Core OS Index
    -        

    2.4.3. Tmux

    +

    2.5.3. Tmux

    Install tmux, improves cli work efficiency;

    @@ -79,7 +79,7 @@ key } swap pane
    -

    2.4.3.1. Copy paste

    +

    2.5.3.1. Copy paste

    This instructions are valid if tmux.conf file discribed in this document is used;

    diff --git a/core/tty-terminal.html b/core/tty-terminal.html index 47f7bf0..1abf15e 100644 --- a/core/tty-terminal.html +++ b/core/tty-terminal.html @@ -2,13 +2,13 @@ - 2.4. Consoles, terminals and shells + 2.5. Consoles, terminals and shells Core OS Index -

    2.4. Consoles, terminals and shells

    +

    2.5. Consoles, terminals and shells

    Consoles
    diff --git a/tools/conf/etc/rc.d/dnscrypt-proxy b/tools/conf/etc/rc.d/dnscrypt-proxy index 0874fa6..db8cd77 100755 --- a/tools/conf/etc/rc.d/dnscrypt-proxy +++ b/tools/conf/etc/rc.d/dnscrypt-proxy @@ -12,7 +12,7 @@ # Authors: https://github.com/simonclausen/dnscrypt-autoinstall/graphs/contributors # Project site: https://github.com/simonclausen/dnscrypt-autoinstall -USER=nobody +USER=net PATH=/usr/sbin:/usr/bin:/sbin:/bin DAEMON=/usr/sbin/dnscrypt-proxy NAME=dnscrypt-proxy @@ -24,7 +24,8 @@ PKEY1=3748:5585:E3B9:D088:FD25:AD36:B037:01F5:520C:D648:9E9A:DD52:1457:4955:9F0A case "$1" in start) echo "Starting $NAME" - $DAEMON --daemonize --ephemeral-keys --user=nobody --local-address=127.0.0.1:40 \ + $DAEMON --daemonize --ephemeral-keys --user=nobody \ + --local-address=127.0.0.1:40 \ --resolver-address=$ADDRESS3 \ --provider-name=$PNAME1 \ --provider-key=$PKEY3 \ diff --git a/tools/dnsmasq.html b/tools/dnsmasq.html index 2aa7b82..720979b 100644 --- a/tools/dnsmasq.html +++ b/tools/dnsmasq.html @@ -14,6 +14,11 @@ censorship there for respect your freedom and privacy. Read Tor Dns Resolver for more information.

    +
    +        $ sudo useradd -M -r -s /bin/false -g net net
    +        
    + +

    1. Dnscrypt

    @@ -28,7 +33,7 @@
             nobody user. Basic usage example;

    -        $ sudo -u nobody  dnscrypt-proxy --daemonize --resolver-name=<resolver name>
    +        $ sudo -u net  dnscrypt-proxy --daemonize --resolver-name=<resolver name>
             

    2. Dnsmasq

    diff --git a/tools/gitolite.html b/tools/gitolite.html index 94abda0..ab1ad3a 100644 --- a/tools/gitolite.html +++ b/tools/gitolite.html @@ -22,8 +22,7 @@

    Create user and home directory;

    -        # mkdir -p /srv/gitolite
    -        # useradd -r -s /bin/bash -m -d /srv/gitolite gitolite
    +        # useradd -r -s /bin/bash -U -m -d /srv/gitolite gitolite
             # chown gitolite:gitolite /srv/gitolite
             
    diff --git a/tools/index.html b/tools/index.html index da1cd40..2f84114 100644 --- a/tools/index.html +++ b/tools/index.html @@ -68,12 +68,6 @@

    System Administration

      -
    • Hardening - -
    • Network Tools
      • Dnscrypt and Dnsmasq
      • diff --git a/tools/mutt.html b/tools/mutt.html index ef7cdbd..5c72e0c 100644 --- a/tools/mutt.html +++ b/tools/mutt.html @@ -162,7 +162,15 @@

        2.1. System Email

        -

        Content of .mutt/system;

        +

        Check and point enviroment mail variable to new local maildir;

        + +
        +        $ echo "MAIL=$HOME/.mail/" >> ~/.bashrc
        +        $ source ~/.bashrc
        +        $ env | grep MAIL
        +        
        + +

        Content of .mutt/system;

                 color status green default
        diff --git a/tools/qemu.html b/tools/qemu.html
        index 1c58e49..c914d74 100644
        --- a/tools/qemu.html
        +++ b/tools/qemu.html
        @@ -43,22 +43,17 @@
                 this describes how to create a qcow2 type;

        -        $ qemu-img create -f qcow2 crux-img.qcow2 15G
        +        $ qemu-img create -f qcow2 crux-img.qcow2 20G
                 
        -

        You can mount disk image;

        +

        Qemu disk images can be treated as regular disks using + qemu disk network block device server;

                 $ sudo modprobe nbd
                 $ sudo qemu-nbd -c /dev/nbd0 /crux-img.qcow2
                 
        -

        To disconnect image disk (ndb);

        - -
        -        $ sudo qemu-nbd -d /dev/nbd0
        -        
        -

        Information about preparing partitions and storage administration. @@ -100,6 +95,13 @@ # mount $BLK_VAR $CHROOT/var

        +

        Before disconnecting image, clean dev mappings;

        + +
        +        $ sudo kpartx -d /dev/nbd0
        +        $ sudo qemu-nbd -d /dev/nbd0
        +        
        +

        2. Network

        Network configuration;

        diff --git a/tools/x.html b/tools/x.html index e01aaca..ad5ea6d 100644 --- a/tools/x.html +++ b/tools/x.html @@ -40,6 +40,12 @@ $ prt-get search xorg-font-bh | xargs sudo prt-get depinst
    +

    From 6c37 collection;

    + +
    +        $ prt-get depinst otf-sourcecode
    +        
    +

    Configure

    Example of /etc/skel/.xinitrc;

    @@ -170,24 +176,26 @@

    Window Managers

    -

    Dwm

    -        $ sudo prt-get depinst dmenu \
    -            dwm \
    -            spectrwm \
    +        $ sudo prt-get depinst \
    +            alsa-utils \
    +            libdrm \
    +            mesa3d \
    +            ffmpeg \
    +            gstreamer \
    +            gstreamer-vaapi \
    +            gst-plugins-base \
    +            gst-plugins-good \
    +            adwaita-icon-theme \
    +            dmenu \
                 st \
                 conky \
                 dillo \
    -            adwaita-icon-theme \
    +            spectrwm \
                 gparted \
                 gimp \
                 libreoffice \
    -            ffmpeg \
    -            gstreamer \
    -            gstreamer-vaapi \
    -            gst-plugins-base \
    -            gst-plugins-good \
                 epiphany
             
    -- cgit From 40fc398cab05e1ae769554a50fb423ca38c3bfb6 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Wed, 1 Mar 2017 21:26:01 +0000 Subject: 6c37 ports configuration updated --- core/conf/ports/6c37-dropin.httpup | 5 +++++ core/conf/ports/6c37.httpup | 5 +++++ core/configure.html | 4 ++-- core/package.html | 2 ++ core/ports.html | 16 +++++++++------- 5 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 core/conf/ports/6c37-dropin.httpup create mode 100644 core/conf/ports/6c37.httpup (limited to 'core/ports.html') diff --git a/core/conf/ports/6c37-dropin.httpup b/core/conf/ports/6c37-dropin.httpup new file mode 100644 index 0000000..6dfb3e2 --- /dev/null +++ b/core/conf/ports/6c37-dropin.httpup @@ -0,0 +1,5 @@ +# Collection 6c37-dropin, by camille at airmail dot cc +# File generated by the CRUX portdb http://crux.nu/portdb/ + +ROOT_DIR=/usr/ports/6c37-dropin +URL=https://raw.githubusercontent.com/6c37/crux-ports-dropin/3.3/ diff --git a/core/conf/ports/6c37.httpup b/core/conf/ports/6c37.httpup new file mode 100644 index 0000000..dbc9422 --- /dev/null +++ b/core/conf/ports/6c37.httpup @@ -0,0 +1,5 @@ +# Collection 6c37, by kori at openmailbox dot org +# File generated by the CRUX portdb http://crux.nu/portdb/ + +ROOT_DIR=/usr/ports/6c37 +URL=https://raw.githubusercontent.com/6c37/crux-ports/3.2/ diff --git a/core/configure.html b/core/configure.html index b6b3fb5..6349b65 100644 --- a/core/configure.html +++ b/core/configure.html @@ -52,7 +52,7 @@

    Edit /etc/hosts to contain your hostname and FQDN, - this example uses c9.core and c9.root.cx sub-domain from + this example uses c9.core and c9.root.sx sub-domain from afraid.org pointing to 10.0.0.1 ip;

    @@ -62,7 +62,7 @@ 127.0.0.1 c9.core c9 #<ip-address> <hostname.domain.org> <aliases> - 10.0.0.1 c9.root.cx + 10.0.0.1 c9.root.sx # IPv6 #::1 ip6-localhost ip6-loopback diff --git a/core/package.html b/core/package.html index 327029e..21415ae 100644 --- a/core/package.html +++ b/core/package.html @@ -136,6 +136,7 @@ # 6c37 team provides a collection with freetype-iu, fontconfig-iu # and cairo-iu ports. + prtdir /usr/ports/6c37-dropin prtdir /usr/ports/6c37 @@ -143,6 +144,7 @@
             $ sudo ports -u c9-ports
    +        $ sudo ports -u 6c37-dropin
             $ sudo ports -u 6c37
             
    diff --git a/core/ports.html b/core/ports.html index 9662e43..6a5e4a8 100644 --- a/core/ports.html +++ b/core/ports.html @@ -155,6 +155,15 @@ # note: the order matters: the package found first is used prtdir /usr/ports/core + + # ports described on this documentation + prtdir /usr/ports/c9-ports + + # 6c37 team provides a collection with freetype-iu, fontconfig-iu + # and cairo-iu ports. + prtdir /usr/ports/6c37 + prtdir /usr/ports/6c37-dropin + prtdir /usr/ports/opt prtdir /usr/ports/xorg @@ -164,13 +173,6 @@ # the following line enables the user maintained contrib collection prtdir /usr/ports/contrib - # ports described on this documentation - #prtdir /usr/ports/c9-ports - - # 6c37 team provides a collection with freetype-iu, fontconfig-iu - # and cairo-iu ports. - #prtdir /usr/ports/6c37 - ### use mypackage form local directory # prtdir /home/packages/build:mypackage -- cgit