Installation main and satellite services

Description: Criterias: Accept mail from any SMTP server in the world. Be able to send mail to any SMTP server in the world. Not accept mail for any other destinations than your domain. Meet the requirements of RFC 2821, section 4.5.1 concerning the postmaster address. Should rewrite local usernames to real names through LDAP lookups Forwarded email from satellite systems should have their FQDN rewritten to this server’s Implementation (Main server): Login on server as root: Install postfix through aptitude Select type Internet Site Set System Mail Name to d4.sysinst.ida.liu.se In /etc/postfix/main.cf, add the following lines: mynetworks = 127.0.0.0/8 130.236.179.88/29 [::ffff:127.0.0.0]/104 [::1]/128 masquerade_domains = $mydomain local_header_rewrite_clients = permit_mynetworks sender_canonical_maps = ldap:/etc/postfix/canonical_sender recipient_canonical_maps = ldap:/etc/postfix/canonical_recipent Create /etc/postfix/canonical_sender: search_base = ou=People,dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se server_host = server.d4.sysinst.ida.liu.se bind = no version = 3 domain = d4.sysinst.ida.liu.se query_filter = uid=%u result_attribute = mail Create /etc/postfix/canonical_recipent: search_base = ou=People,dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se server_host = server.d4.sysinst.ida.liu.se bind = no version = 3 domain = d4.sysinst.ida.liu.se query_filter = mail=%s result_attribute = uid Set MX record. Add line to /etc/bind/db.d4.sysinst.ida.liu.se: @ IN MX 10 server.d4.sysinst.ida.liu.se. Restart the services: service postfix restart service bind9 restart Implementation (Satellite Systems/Clients): Install postfix through aptitude Select type Satellite System Set System Mail Name to d4.sysinst.ida.liu.se Set SMTP Relay Host to server.d4.sysinst.ida.liu.se Verification: Test that the server can receive email from generic server outside of LAN Test that the server can send email to generic server outside of LAN Test that the server does not accept email for other domains than d4.sysinst.ida.liu.se Test that all clients can send email to *@d4.sysinst.ida.liu.se and they should end up on server Test that all clients do not have smtp open to LAN/WAN

NFS Installation

Description: Install the NFS Kernel Server and allow mappings from the subnet 130.236.179.88/29 Implementation (Server-side): Login as root Install package nfs-kernel-server Add the following line to /etc/hosts.allow: portmap: 130.236.179.88/255.255.255.248 Add the following line to /etc/exports: /usr/local 130.236.179.88/29(ro,root_squash,subtree_check) Restart the services service portmap restart service nfs-kernel-server restart Implementation (Client-side): Login as root Install package nfs-common Attempt a mount: mount -o ro,vers=3 -t nfs server.d4.sysinst.ida.liu.se:/usr/local /usr/local If it works, add the following line to /etc/fstab: server.d4.sysinst.ida.liu.se:/usr/local /usr/local nfs ro,vers=3 0 0 Verification: Create file /usr/local/bin/hello which echoes hello. Run hello on client, should echo hello. Make sure it’s not possible to mount from other host

Expect: Simulating ssh login

Clean #! /usr/bin/env expect set host [lindex $argv 0]; set user [lindex $argv 1]; set passwd [lindex $argv 2]; set timeout 5 spawn ssh $user@$host expect { "yes/no" { send "yes\r" exp_continue } "password:" { send "$passwd\r" exp_continue } "$user@$host:~? " { exit 0 } timeout { exit 2 } } exit 1 Wrapped inside bash #! /usr/bin/env bash assert_ssh_login() { local host="${1}" local user="${2}" local passwd="${3}" local details="$(echo -e "\ set timeout 5 \n\ spawn ssh ${user}@${host} \n\ expect { \n\ \"yes/no\" { \n\ send \"yes\r\" \n\ exp_continue \n\ } \n\ \n\ \"password:\" { \n\ send \"${passwd}\r\" \n\ exp_continue \n\ } \n\ \n\ \"${user}@${host}:~? \" {\n\ exit 0 \n\ } \n\ \n\ timeout { \n\ exit 2 \n\ } \n\ } \n\ \n\ exit 1 \n\ " | expect)" case "${?}" in "0") echo "Can login as ${user} on ${host}" ;; "1") echo "${user} can not login on ${host}. Details: ${details}" ;; "2") echo "${user} can not login on ${host} (Timeout). Details: ${details}" ;; * ) echo "${user} can not login on ${host} (Error ${?}): Details: ${details}" ;; esac }

October 20, 2015  | 

Configure static eth0 in /etc/network/interfaces

Description: The first step is to establish basic network connectivity for your router/gateway. This will allow you to connect to the installation server on the distribution network, from which you can install the routing software needed in later steps. Your router needs three network interfaces: the loopback interface (lo; which is used for network connections within the gateway) the interface connected to the distribution network (eth1) the interface connected to your network (eth0). Each interface needs an address, netmask and broadcast address. It is important that you specify the correct netmask and broadcast address! ...

Configure static wlan0 in /etc/network/interfaces

Get wpa-psk by running wpa_passphrase MyNetwork MyPassphrase. /etc/network/interfaces should be chmod 0600 if you put the wpa-psk there source /etc/network/interfaces.d/* # The loopback network interface auto lo wlan0 iface lo inet loopback iface wlan0 inet dhcp wpa-ssid MyNetwork wpa-psk a2d024861ef90117c47083c9252d1e9c107c7cc6ab938cd08349c9192d444d2f

Postfix - Address Family Not Supported

Basically, postfix was configured with ipv6 support when the OS does not provide it Starting Postfix Mail Transport Agent: postfixpostmulti: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocol postmulti: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocol postfix: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocol Solution: sudo postconf -e 'inet_protocols = ipv4' sudo /etc/init.d/postfix restart

Configure linux client to use LDAP

Description: Clients should use server.d4.sysinst.ida.liu.se for LDAP authentication Implementation: Login to computers as root Install package libnss-ldapd Set LDAP server URI: ldap://server.d4.sysinst.ida.liu.se Set LDAP server search base: dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se Set LDAP server to use all services In /etc/nsswitch.conf, replace compat with files In /etc/pam.d/common-session, add line to end: session required pam_mkhomedir.so skel=/etc/skel umask=0022

LDAP Server installation

Description: Configure LDAP to the domain d4.sysinst.ida.liu.se Implementation: Login to server as root Install the packages slapd, ldap-utils and migrationtools Set /etc/ldap/ldap.conf so contain the following: # # LDAP Defaults # # See ldap.conf(5) for details # This file should be world readable but not world writable. BASE dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se URI ldapi:/// In /etc/migrationtools/migrate_common.ph, locate and set the following: $DEFAULT_MAIL_DOMAIN = "d4.sysinst.ida.liu.se"; $DEFAULT_BASE = "dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se"; cd /usr/share/migrationtools ./migrate_all_online.sh Install package libnss-ldapd through aptitude, use all services Edit /etc/nsswitch.conf, change all “compat” to “files” In /etc/pam.d/common-session, add line to end: session required pam_mkhomedir.so skel=/etc/skel umask=0022 Verification: Create /root/olle.ldif root@server:~# cat user.ldif dn: uid=olle,ou=People,dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se objectClass: top objectClass: account objectClass: posixAccount objectClass: shadowAccount cn: olle uid: olle uidNumber: 10000 gidNumber: 100 homeDirectory: /home/olle loginShell: /bin/bash gecos: olle userPassword: {crypt}x shadowLastChange: 0 shadowMax: 99999 shadowWarning: 0 ldapadd -W -D "cn=admin,dc=d4,dc=sysinst,dc=ida,dc=liu,dc=se" -f olle.ldif ...

September 30, 2015  |  🏷️Ldap

DNS/Bind9 - Installation and configuration

Description: Need to install DNS on server with the following configuration: It must respond authoritatively to all non-recursive queries for names in the zones it is authoritative for. It must respond to all recursive queries from the hosts on its own network. It must not respond to any recursive queries from any outside host (i.e. host not on its own network). Apart from the queries in (1), it should not respond to any queries from any outside host. It must contain valid zone data for its zone(s). The cache parameters must be chosen sensibly It must not be susceptible to the standard cache poisoning attacks. See http://www.kb.cert.org/vuls/id/800113 for details. Test its DNS server using porttest.dns-oarc.net (see http://www.dns-oarc.net/oarc/services/porttest). It should have the following normal zone: ...

September 26, 2015  |  🏷️Dns 🏷️Bind

Install Quagga configure with RIP

Description: Install quagga on gw and configure it so traffic can be forwarded between internet and the virtual LAN Implementation: Enable ip-forwarding: In /etc/sysctl.conf: Uncomment net.ipv4.ip_forward=1 Restart gw Installation: Run aptitude Locate and install metapackage quagga Configuration: In /etc/quagga/daemons, set the following: zebra=yes ripd=yes Create /etc/quagga/zebra.conf (owned by quagga:quagga, mode 640): hostname gw.d4.sysinst.ida.liu.se password read_password enable password write_password log file /var/log/quagga/zebra.log ip forwarding ipv6 forwarding Create /etc/quagga/ripd.conf (owned by quagga:quagga, mode 640): hostname gw.d4.sysinst.ida.liu.se password read_password enable password write_password log file /var/log/quagga/ripd.conf router rip version 2 network eth1 route 130.236.179.88/29 ! Start: service quagga start ...