If I don't want my %{dist}-string get crapped-up.%dist .el7
Screw you, CentOS. Stuff was just fine on CentOS 5 and CentOS 6. This change is not an improvement.
My technical blog - mostly storage- and networking-related postings with an emphasis on Linux and virtualization
If I don't want my %{dist}-string get crapped-up.%dist .el7
#!/bin/sh
yum update -y
yum install -y git
pip install --upgrade pip
pip install --upgrade tornado
git clone https://github.com/liftoff/GateOne.git /tmp/GateOne
(cd /tmp/GateOne ; python setup.py install)
chkconfig gateone on
service gateone start
printf "Sleeping for 15s..."
sleep 15
echo "Done!"
pkill gateone
sed -i -e '/"https_redirect"/s/: .*$/: true,/' \
-e '/"origins":/s/:.*$/: ["*"],/' \
$(readlink -f /etc/gateone/conf.d/10server.conf)
sed -i '/"auth"/s/: .*$/: "pam",/' \
$(readlink -f /etc/gateone/conf.d/20authentication.conf)
service gateone restart
When installed from its Git repository, the default configuration of GateOne only allows connection from an instances local interfaces. The `sed` operation against the "/etc/gateone/conf.d/10server.conf" configuration-file opens up this restriction. Setting the "origins" definition to '"*"' will allow browser connections from anywhere (if this is unacceptable, you can use AWS security-groups to lock things back down a bit).For enterprise components that will be migrated from private virtualization and cloud solutions to commercial cloud offerings, the above allows them to take not just my build, but any build that's enabled for automated provisioning and inject their account. Instead of launching a system with whatever the default-user is that's baked in, the above allows them to reset any system's initial username to be whatever they want (the above's '#cloud-config system_info: default_user: name: ent-adm
ent-adm' is just an example - I dunno what their preferred account name is - I've simply used the above whenever I'm deploying instance-templates and don't want to remember "instance X uses userid A; instance Y uses userid B; and instance Z uses userid C").Appends creates line to your /etc/postfix/main.cf that looks like:postconf -e "relayhost = [email-smtp.us-west-2.amazonaws.com]:587"
Note: The AWS SES relays are currently only available within a few regions (as of this writing, NoVA/us-east-1, Oregon/us-west-2 and Ireland/eu-west-1). Each relay requires a SASL credential be created to allow relaying. So, no big deal publicizing the relay's name if spammers don't have such credentials.relayhost = [email-smtp.us-west-2.amazonaws.com]:587
Two critical items above are the "smtp_sasl_password_maps" and "smtp_tls_CAfile" parameters:smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sasl_mechanism_filter = plain smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt smtp_use_tls = yes smtp_tls_security_level = encrypt
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
# Sender Address <userid>:<password> patch-alert@ses-test.cloudlab.xanthia.com AKIAICAOGQX5UA0ACDSVJ:pDHM1n4uYLGN4BQOnzGcTSeQXSRDjcKCy6VkmQk+CoBV
# Sender Address [relay-host]:port patch-alert@ses-test.cloudlab.xanthia.com [email-smtp.us-west-2.amazonaws.com]:587
This should result in an SMTP log-snippet that resembles the following:# sendmail -f patch-alert@ses-test.cloudlab.xanthia.com -t <<EOF To: fubar@cloudlab.xanthia.com Subject: Per-User SASL Test Content-type: text/html If this arrived, things are probably set up correctly EOF # sendmail -f unmapped-user@ses-test.cloudlab.xanthia.com -t <<EOF To: fubar@cloudlab.xanthia.com Subject: Per-User SASL Test Content-type: text/html If this bounced, things are probably set up correctly EOF
As can be seen in the snippet, the first message (from the mapped sender) was relayed while the second message (from the unmapped sender) was rejected.Feb 16 18:08:09 ses-test maintuser: MARK == MARK == MARK Feb 16 18:08:22 ses-test postfix/pickup[5484]: 2B7D244AB: uid=0 from=<patch-alert@ses-test.cloudlab.xanthia.com> Feb 16 18:08:22 ses-test postfix/cleanup[5583]: 2B7D244AB: message-id=<20160216180822.2B7D244AB@ses-test.cloudlab.xanthia.com> Feb 16 18:08:22 ses-test postfix/qmgr[5485]: 2B7D244AB: from=<patch-alert@ses-test.cloudlab.xanthia.com>, size=403, nrcpt=1 (queue active) Feb 16 18:08:22 ses-test postfix/smtp[5585]: 2B7D244AB: to=<thjones2@gmail.com>, relay=email-smtp.us-west-2.amazonaws.com[54.187.123.10]:587, delay=0.37, delays=0.02/0.03/0.19/0.13, dsn=2.0.0, status=sent (250 Ok 00000152eb44d396-408494a9-93f0-4f21-8985-460c057537bf-000000) Feb 16 18:08:22 ses-test postfix/qmgr[5485]: 2B7D244AB: removed Feb 16 18:08:32 ses-test postfix/pickup[5484]: A339E44AB: uid=0 from=<bad-sender@ses-test.cloudlab.xanthia.com> Feb 16 18:08:32 ses-test postfix/cleanup[5583]: A339E44AB: message-id=<20160216180832.A339E44AB@ses-test.cloudlab.xanthia.com> Feb 16 18:08:32 ses-test postfix/qmgr[5485]: A339E44AB: from=<bad-sender@ses-test.cloudlab.xanthia.com>, size=408, nrcpt=1 (queue active) Feb 16 18:08:32 ses-test postfix/smtp[5585]: A339E44AB: to=<thjones2@gmail.com>, relay=email-smtp.us-west-2.amazonaws.com[54.69.81.169]:587, delay=0.09, delays=0.01/0/0.08/0, dsn=5.0.0, status=bounced (host email-smtp.us-west-2.amazonaws.com[54.69.81.169] said: 530 Authentication required (in reply to MAIL FROM command))
#!/bin/sh
DEFIF=$(ip route show | awk '/^default/{print $5}')
BASEIP=$(printf '%02X' \
$(ip addr show ${DEFIF} | \
awk '/inet /{print $2}' | \
sed -e 's#/.*$##' -e 's/\./ /g' \
))
vgrename -v VolGroup00 VolGroup00_${BASEIP}
sed -i 's/VolGroup00/&_'${BASEIP}'/' /etc/fstab
sed -i 's/VolGroup00/&_'${BASEIP}'/g' /boot/grub/grub.conf
for KRNL in $(awk '/initrd/{print $2}' /boot/grub/grub.conf | \
sed -e 's/^.*initramfs-//' -e 's/\.img$//')
do
mkinitrd -f -v /boot/initramfs-${KRNL}.img ${KRNL}
done
init 6
Note that the above script assumes that the current root VG name is "VolGroup00". If your current root VG name is different, change the value in the script above as appropriate.Line of the pasted-in script. Once you've authenticated to Guacamole, you'll be able to login to the hosting-instance via SSH using the instance's no-privileged user's credentials. Once logged in, you can escalate privileges and then configure additional authentication mechanisms and connection destinations and protocols.printf "\t<authorize username=\"admin\" password=\"PASSWORD\">\n"
# fsck /dev/loop0 fsck from util-linux-ng 2.17.2 e2fsck 1.41.12 (17-May-2010) /dev/loop0: recovering journal /dev/loop0: clean, 13/297184 files, 56066/1187840 blocks
https://drive.google.com/drive/#folders/0F3SA-qkPpztNflU1bUtyekYYC091a2ttHZJpMElwTm9UcFNqN1pNMlf3iUlTUkJ0UU5PUVk
http://www.googledrive.com/host/The browsable URL to your publicly-viewable folder will now look like:
http://www.googledrive.com/host/0F3SA-qkPpztNflU1bUtyekYYC091a2ttHZJpMElwTm9UcFNqN1pNMlf3iUlTUkJ0UU5PUVk
# curl http://169.254.169.254/latest/dynamic/instance-identity/document
{
"accountId" : "717243568699",
"architecture" : "x86_64",
"availabilityZone" : "us-west-2b",
"billingProducts" : null,
"devpayProductCodes" : null,
"imageId" : "ami-9df0ec7a",
"instanceId" : "i-51825ba7",
"instanceType" : "t1.micro",
"kernelId" : "aki-fc8f11cc",
"pendingTime" : "2015-03-25T19:04:51Z",
"privateIp" : "172.31.19.148",
"ramdiskId" : null,
"region" : "us-east-1",
"version" : "2010-08-31"
}
# curl http://169.254.169.254/latest/dynamic/instance-identity/document
{
"accountId" : "717243568699",
"architecture" : "x86_64",
"availabilityZone" : "us-west-2b",
"billingProducts" : [ "bp-6fa54006" ],
"devpayProductCodes" : null,
"imageId" : "ami-9df0ec7a",
"instanceId" : "i-51825ba7",
"instanceType" : "t1.micro",
"kernelId" : "aki-fc8f11cc",
"pendingTime" : "2015-03-25T19:04:51Z",
"privateIp" : "172.31.19.148",
"ramdiskId" : null,
"region" : "us-east-1",
"version" : "2010-08-31"
}
Note on Compatibility: the Red Hat provided PVM AMIs do not yield well to this method. The Red Hat provided PVM AMIs are all designed with their boot/root device set to /dev/sda1. To date, attempts to leverage the above techniques for PVM AMIs that require their boot/root device set to /dev/sda (used when using a single, partitioned EBS to host a bare /boot partition and LVM-managed root partitions) have not met with success.
mv /usr/share/xml/scap/ssg/content/ssg-rhel6-cpe-oval.xml \ /usr/share/xml/scap/ssg/content/ssg-rhel6-cpe-oval.xml-DIST && \ cp /usr/share/xml/scap/ssg/content/ssg-rhel6-cpe-oval.xml-DIST \ /usr/share/xml/scap/ssg/content/ssg-rhel6-cpe-oval.xml && \ sed -i '{ s#Red Hat Enterprise Linux 6#CentOS 6##g s#cpe:/o:redhat:enterprise_linux:6#cpe:/o:centos:centos:6##g }' /usr/share/xml/scap/ssg/content/ssg-rhel6-cpe-oval.xml mv /usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml \ /usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml-DIST && \ cp /usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml-DIST \ /usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml && \ sed -i \ 's#cpe:/o:redhat:enterprise_linux#cpe:/o:centos:centos##g' \ /usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml
NOTE: Ironically, doing the above edits will cause the various SCAP profiles to flag an error when running the tests that verify that RPMs have been unaltered. I've submitted a bug to the CentOS group so these fixes are included in future versions of the CentOS OpenSCAP RPMs, but, until then, you just need to be aware that the `oscap` tool will flag the above two files.
oscap xccdf eval --profile common --report \ /var/tmp/oscap-report_`date "+%Y%m%d%H%M"`.html \ --results /var/tmp/oscap-results_`date "+%Y%m%d%H%M"`.xml\ --cpe /usr/share/xml/scap/ssg/content/ssg-rhel6-cpe-dictionary.xml \ /usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml