Reduce windows folder size on windows 7/8

The following command will uninstall all previous versions of components without the scheduled task’s 30-day grace period:

DISM.exe /online /Cleanup-Image /StartComponentCleanup

The following command will remove files needed for uninstallation of service packs. You won’t be able to uninstall any currently installed service packs after running this command:

DISM.exe /online /Cleanup-Image /SPSuperseded

The following command will remove all old versions of every component. You won’t be able to uninstall any currently installed service packs or updates after this completes:

DISM.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

Source: https://superuser.com/questions/669193/why-is-windows-folder-so-big-in-windows-8-1

How to Reduce the Size of Your WinSXS Folder on Windows 7 or 8

Active Directory and Active Directory Domain services ports

 

Protocol and Port AD and AD DS Usage Type of traffic
TCP and UDP 389 Directory, Replication, User and Computer Authentication, Group Policy, Trusts LDAP
TCP 636 Directory, Replication, User and Computer Authentication, Group Policy, Trusts LDAP SSL
TCP 3268 Directory, Replication, User and Computer Authentication, Group Policy, Trusts LDAP GC
TCP 3269 Directory, Replication, User and Computer Authentication, Group Policy, Trusts LDAP GC SSL
TCP and UDP 88 User and Computer Authentication, Forest Level Trusts Kerberos
TCP and UDP 53 User and Computer Authentication, Name Resolution, Trusts DNS
TCP and UDP 445 Replication, User and Computer Authentication, Group Policy, Trusts SMB,CIFS,SMB2, DFSN, LSARPC, NbtSS, NetLogonR, SamR, SrvSvc
TCP 25 Replication SMTP
TCP 135 Replication RPC, EPM
TCP Dynamic Replication, User and Computer Authentication, Group Policy, Trusts RPC, DCOM, EPM, DRSUAPI, NetLogonR, SamR, FRS
TCP 5722 File Replication RPC, DFSR (SYSVOL)
UDP 123 Windows Time, Trusts Windows Time
TCP and UDP 464 Replication, User and Computer Authentication, Trusts Kerberos change/set password
UDP Dynamic Group Policy DCOM, RPC, EPM
UDP 138 DFS, Group Policy DFSN, NetLogon, NetBIOS Datagram Service
TCP 9389 AD DS Web Services SOAP
UDP 67 and UDP 2535 DHCP

noteNote
DHCP is not a core AD DS service but it is often present in many AD DS deployments.
DHCP, MADCAP
UDP 137 User and Computer Authentication, NetLogon, NetBIOS Name Resolution
TCP 139 User and Computer Authentication, Replication DFSN, NetBIOS Session Service, NetLogon

Source: https://technet.microsoft.com/en-us/library/dd772723(v=ws.10).aspx

Web-Based Guacamole tool

Guacamole website: https://guacamole.incubator.apache.org/

Create database for Guacamole: (DB name is guacamole_db)

$ mysql -u root -p

mysql> create database guacamole_db;
mysql> grant all privileges on guacamole_db.* to guacamole_user@localhost identified by 'secure password';
mysql> flush  privileges;

Initializing the MySQL database

$ docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql

$ mysql -u guacamole_user -p guacamole_db < initdb.sql

Create my-guacd docker container

$ docker run --name my-guacd -d guacamole/guacd

Create my-guacamole docker container

docker run --name my-guacamole \
  --link my-guacd:guacd \
  -e MYSQL_HOSTNAME=${DB_HOST} \
  -e MYSQL_PORT=${DB_PORT} \
  -e MYSQL_DATABASE=${DB_NAME} \
  -e MYSQL_USER=${DB_USER} \
  -e MYSQL_PASSWORD=${DB_PASS} \
  -d -p 8080:8080 guacamole/guacamole

Test:

http://<server ip>:8080/guacamole/

Logs:

$ docker logs my-guacamole

Behind apache proxy:

<Location /guacamole/>
    Order allow,deny
    Allow from all
    ProxyPass http://HOSTNAME:8080/guacamole/ flushpackets=on
    ProxyPassReverse http://HOSTNAME:8080/guacamole/
</Location>

<Location /guacamole/websocket-tunnel>
    Order allow,deny
    Allow from all
    ProxyPass ws://HOSTNAME:8080/guacamole/websocket-tunnel
    ProxyPassReverse ws://HOSTNAME:8080/guacamole/websocket-tunnel
</Location>

Add static route on Mac OSX and Windows

Add static route on windows is very easy. Run command prompt as Administrator.

route -p add 10.10.120.0 mask 255.255.255.0 192.168.0.1

Add static route on OS x, need the following steps

  1. Find the network service which can access gateway
    mac-mini:~ ladmin$ networksetup -listallnetworkservices
    An asterisk (*) denotes that a network service is disabled.
    Internet
    LAN
    Backup-LAN
    Bluetooth DUN
    *FireWire
    *Bluetooth PAN 2
    Wi-Fi
     
    mac-mini:~ ladmin$ networksetup -getinfo LAN
    Manual Configuration
    IP address: 192.168.15.2
    Subnet mask: 255.255.255.0
    Router: 192.168.15.254
    IPv6: Automatic
    IPv6 IP address: none
    IPv6 Router: none
    Ethernet Address: 00:1f:5b:33:1d:75
  2. set additional gateway on the network service
    mac-mini:~ ladmin$ sudo networksetup -setadditionalroutes LAN 10.0.0.0 255.255.255.0 192.168.15.254
    Password:
    mac-mini:~ ladmin$ networksetup -getadditionalroutes LAN
    10.0.0.0 255.255.255.0 192.168.15.254
  3. Check the route list

    mac-mini:~ ladmin$ netstat -rn
    Routing tables
     
    Internet:
    Destination        Gateway            Flags        Refs      Use   Netif Expire
    default            213.125.227.185    UGSc           18        0   vlan0
    default            192.168.15.254     UGScI           0        0     en0
    default            192.168.15.254     UGScI           0        0     en1
    default            192.168.15.254     UGScI           0        0     en2
    10/24              192.168.15.254     UGSc            0        0     en1
    127                127.0.0.1          UCS             0        0     lo0
    127.0.0.1          127.0.0.1          UH             75  2330825     lo0
    169.254            link#8             UCS             1        0   vlan0
    169.254            link#4             UCSI            0        0     en0
    169.254            link#5             UCSI            0        0     en1
    

    Add more routing paths:

    iso@isoAir:/dev$ sudo networksetup -setadditionalroutes “Ethernet Pantalla Trabajo” 10.0.0.0 255.0.0.0 10.1.36.1 172.16.0.0 255.240.0.0 10.1.36.1 192.168.0.0 255.255.0.0 10.1.36.1
    iso@isoAir:/dev$ sudo networksetup -getadditionalroutes “Ethernet Pantalla Trabajo”
    10.0.0.0 255.0.0.0 10.1.36.1
    172.16.0.0 255.240.0.0 10.1.36.1
    192.168.0.0 255.255.0.0 10.1.36.1
    

    reference:

    http://www.marcoach.nl/persistent-static-routes-on-os-x/

    https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sag_tcpip_pro_addstaticroute.mspx?mfr=true

Ubuntu 16.04 Winbind and Active Directory

Official SSSD and Active Directory guide doesn’t work. It is hard to find what’s wrong. Using Winbind works well.

Installation:

sudo apt install winbind samba
sudo apt install cups-common python-crypto-dbg python-crypto-doc bind9 bind9utils ctdb ldb-tools ntp smbldap-tools heimdal-clients libnss-winbind libpam-winbind

Configuration:

sudo vi /etc/samba/smb.conf
[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
#   workgroup = GROUP

# server string is the equivalent of the NT Description field
  server string = %h server (Samba, Ubuntu)

        security = ads
        realm = MYDOMAIN.COM
# If the system doesn't find the domain controller automatically, you may need the following line
#        password server = 10.0.0.1
# note that workgroup is the 'short' domain name
        workgroup = MYDOMAIN
#       winbind separator = +
        idmap uid = 10000-20000
        idmap gid = 10000-20000
        winbind enum users = yes
        winbind enum groups = yes
        template homedir = /home/%D/%U
        template shell = /bin/bash
        client use spnego = yes
        client ntlmv2 auth = yes
        encrypt passwords = yes
        winbind use default domain = yes
        restrict anonymous = 2

Restart services:

sudo service winbind stop
sudo service samba-ad-dc restart
sudo service winbind start

Join the AD (see “net ads help”):

sudo kinit Admin@MYDOMAIN.COM
# check klist
sudo klist
# join (ignore the dns error messages)
sudo net ads join -k

OR
sudo net ads join -U Admin@MYDOMAIN.COM

Setup Authentication

sudo vi /etc/nsswitch.conf

 

passwd:         compat winbind
group:          compat winbind
shadow:         compat

Restart Winbind

sudo service winbind restart

PAM Configuration

sudo pam-auth-update

Create Home directory

sudo mkdir /home/MYDOMAIN

Add sudo users

sudo vi /etc/sudoers.d/MYDOMAIN

 

# replace adgroup as real domain group name
%adgroup        ALL=(ALL) NOPASSWD: ALL

Test

wbinfo -u
wbinfo -g

Login as a domain user and enjoy…