Thursday, March 28, 2019

UNTRUSTED CERT TITLE

I'm trying to reinstall macOS Sierra from the recovery partition, and I'm getting an error when it is checking for eligibility "UNTRUSTED CERT TITLE "

To fix this, simply update date time in your Mac by going to terminal:
ntpdate -u time.apple.com

Tuesday, January 23, 2018

Remove queue on printer

When you cannot cancel, delete, remove queue files on printer, please follow this:
Open services.msc --> stop 'Print Spooler' service.
Go to C:\Windows\System32\spool\PRINTERS and remove all items here.
Start 'Print Spooler' and check.

Tuesday, June 27, 2017

Nginx Configuration to block SQL Injection and similar attacks

location ~* "(eval\()" { deny all; }
location ~* "(127\.0\.0\.1)" { deny all; }
location ~* "([a-z0-9]{2000})" { deny all; }
location ~* "(javascript\:)(.*)(\;)" { deny all; }
location ~* "(base64_encode)(.*)(\()" { deny all; }
location ~* "(GLOBALS|REQUEST)(=|\[|%)" { deny all; }
location ~* "(<|%3C).*script.*(>|%3)" { deny all; }
location ~ "(\\|\.\.\.|\.\./|~|`|<|>|\|)" { deny all; }
location ~* "(boot\.ini|etc/passwd|self/environ)" { deny all; }
location ~* "(thumbs?(_editor|open)?|tim(thumb)?)\.php" { deny all; }
location ~* "(\'|\")(.*)(drop|insert|md5|select|union)" { deny all; }
location ~* "(https?|ftp|php):/" { deny all; }
location ~* "(=\\\'|=\\%27|/\\\'/?)\." { deny all; }
location ~* "/(\$(\&)?|\*|\"|\.|,|&|&amp;?)/?$" { deny all; }
location ~ "(\{0\}|\(/\(|\.\.\.|\+\+\+|\\\"\\\")" { deny all; }
location ~ "(~|`|<|>|:|;|%|\\|\s|\{|\}|\[|\]|\|)" { deny all; }
location ~* "/(=|\$&|_mm|(wp-)?config\.|cgi-|etc/passwd|muieblack)" { deny all; }
location ~* "(&pws=0|_vti_|\(null\)|\{\$itemURL\}|echo(.*)kae|etc/passwd|eval\(|self/environ)" { deny all; }
location ~* "\.(aspx?|bash|bak?|cfg|cgi|dll|exe|git|hg|ini|jsp|log|mdb|out|sql|svn|swp|tar|rdf)$" { deny all; }
location ~* "/(^$|mobiquo|phpinfo|shell|sqlpatch|thumb|thumb_editor|thumbopen|timthumb|webshell)\.php" { deny all; }


https://gist.github.com/VirtuBox/5fedc39c30813f5373aa8ae9328a0ec3

Tuesday, May 9, 2017

Debian 8 Jessie Sample Preseed

#### Contents of the preconfiguration file (for jessie)
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/keymap select us
#d-i keymap select us
d-i keyboard-configuration/xkb-keymap select us

# Scan another CD or DVD?
apt-cdrom-setup apt-setup/cdrom/set-first       boolean false

### Network configuration
d-i netcfg/choose_interface select auto
# Manual
#d-i netcfg/get_nameservers  string 192.168.1.5
#d-i netcfg/get_ipaddress    string 192.168.1.10
#d-i netcfg/get_netmask      string 255.255.255.0
#d-i netcfg/get_gateway      string 192.168.1.1
#d-i netcfg/confirm_static   boolean true
#d-i netcfg/get_hostname string localhost
#d-i netcfg/get_domain string localdomain.com
#d-i netcfg/hostname string localhost

### Mirror settings
d-i apt-setup/use_mirror boolean true
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string debian.xtdv.net
d-i mirror/http/directory string /debian
d-i mirror/suite string jessie
d-i mirror/http/proxy string


### Account setup
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true
d-i passwd/user-fullname string John
d-i passwd/username string john
d-i passwd/user-password-crypted password $6$pp9kuTEa$4rIwzjBHUK0jyRC1vE73k7EdQWu8azUCPkwHNOf1BCcV9AC74RVMiGGxKgwn4nxL2GIGSh5orkA8qirDjkJTI1
d-i passwd/user-uid string 1000
d-i passwd/user-default-groups string sudo adm

### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Ho_Chi_Minh
d-i clock-setup/ntp boolean true

### Partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/purge_lvm_from_device  boolean true
d-i partman-auto/choose_recipe select boot-root
d-i partman-auto-lvm/new_vg_name string system
d-i partman-auto/expert_recipe string                   \
        boot-root ::                                    \
        103 100 205 ext4                                \
                $primary{ }                             \
                $bootable{ }                            \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ ext4 }    \
                mountpoint{ /boot }                     \
        .                                               \
        1024 110 2048 ext4                              \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ ext4 }    \
                mountpoint{ / }                         \
        .                                               \
        1024 120 3096 ext4                              \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ ext4 }    \
                mountpoint{ /var }                      \
        .                                               \
        512 130 1024 ext4                               \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ ext4 }    \
                mountpoint{ /var/lib/mysql }            \
        .                                               \
        512 140 1024 ext4                               \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ ext4 }    \
                mountpoint{ /www }                      \
        .                                               \
        512 150 1024 ext4                               \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ xfs }     \
                mountpoint{ /tmp }                      \
        .                                               \
        2048 160 3096 ext4                              \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ ext4 }    \
                mountpoint{ /usr }                      \
        .                                               \
        512 170 1024 linux-swap                         \
                $lvmok{ }                               \
                method{ swap } format{ }                \
        .                                               \
        2048 10 3096 ext4                               \
                $lvmok{ }                               \
                method{ format } format{ }              \
                use_filesystem{ } filesystem{ xfs }     \
                mountpoint{ /home }                     \
        .
d-i partman/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
#d-i partman-lvm/confirm boolean true
d-i partman/choose_partition \
        select Finish partitioning and write changes to disk
d-i partman/confirm_nooverwrite boolean true
d-i partman/mount_style select uuid
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
#d-i grub-pc/install_devices multiselect /dev/sda
d-i grub-installer/bootdev  string /dev/sda

### Apt setup
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org

# Dotdeb
#d-i apt-setup/local0/repository string http://packages.dotdeb.org wheezy all
#d-i apt-setup/local0/comment string Dotdeb
#d-i apt-setup/local0/source boolean true
#d-i apt-setup/local0/key string http://www.dotdeb.org/dotdeb.gpg

#d-i apt-setup/local1/repository string http://packages.dotdeb.org wheezy-php55 all
#d-i apt-setup/local1/comment string Dotdeb-PHP55
#d-i apt-setup/local1/source boolean true
#d-i apt-setup/local1/key string http://www.dotdeb.org/dotdeb.gpg

# Puppet
#d-i apt-setup/local2/repository string http://apt.puppetlabs.com wheezy main
#d-i apt-setup/local2/comment string Puppet
#d-i apt-setup/local2/source boolean true
#d-i apt-setup/local2/key string http://apt.puppetlabs.com/keyring.gpg

#d-i apt-setup/local2/repository string http://apt.puppetlabs.com wheezy dependencies
#d-i apt-setup/local2/comment string Puppet-Dependencies
#d-i apt-setup/local2/source boolean true
#d-i apt-setup/local2/key string http://apt.puppetlabs.com/keyring.gpg

### Package selection
tasksel tasksel/first multiselect none
d-i pkgsel/include string openssh-server curl
d-i pkgsel/upgrade select none
popularity-contest popularity-contest/participate boolean false

### Misc options
# Disable that annoying WEP key dialog.
#d-i netcfg/wireless_wep string
# Allow non-free firmware
d-i hw-detect/load_firmware boolean true
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

### Set up firstboot
#d-i preseed/late_command string chroot /target sh -c "/usr/bin/curl -o /tmp/postinstall http://vtm-svn-01.luxoft.com/postinstall && /bin/sh -x /tmp/postinstall"

Tuesday, April 25, 2017

Convert Ubuntu Desktop to Server

# update
sudo apt-get update

# install the 'tasksel' package so we can remove the desktop image       
sudo apt-get install tasksel

# remove the desktop image
sudo tasksel remove ubuntu-desktop

# tell tasksel to start the server image setup
sudo tasksel install server

# install the server images
sudo apt-get install linux-server linux-image-server

# remove lightdm
sudo apt-get purge lightdm

# remove all packages no longer required (~400 MB)
sudo apt-get autoremove