|
| 1 | +%define name aws-ec2-ssh |
| 2 | +%define version 0 |
| 3 | +%define unmangled_version 0 |
| 4 | +%define release 1.20170427.git.5a15fc6%{?dist} |
| 5 | + |
| 6 | + |
| 7 | +Name: %{name} |
| 8 | +Summary: Manage AWS EC2 SSH access with IAM |
| 9 | +Version: %{version} |
| 10 | +Release: %{release} |
| 11 | + |
| 12 | +Group: System/Administration |
| 13 | +License: MIT |
| 14 | +URL: https://cloudonaut.io/manage-aws-ec2-ssh-access-with-iam/ |
| 15 | +Source0: %{name}-%{unmangled_version}.tar.gz |
| 16 | +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
| 17 | +BuildArch: noarch |
| 18 | +BuildRoot: %{_tmppath}/%{name}-root} |
| 19 | +Vendor: widdix GmbH |
| 20 | +Packager: Michiel van Baak |
| 21 | + |
| 22 | +Requires: bash |
| 23 | + |
| 24 | +%description |
| 25 | +Use your IAM user's public SSH key to get access via SSH to an EC2 instance. |
| 26 | + |
| 27 | + |
| 28 | +%prep |
| 29 | +%setup -q |
| 30 | + |
| 31 | + |
| 32 | +%build |
| 33 | + |
| 34 | + |
| 35 | +%install |
| 36 | +rm -rf ${RPM_BUILD_ROOT} |
| 37 | +mkdir -p ${RPM_BUILD_ROOT}%{_bindir} |
| 38 | +mkdir -p ${RPM_BUILD_ROOT}/etc/sysconfig |
| 39 | +install -m 755 import_users.sh ${RPM_BUILD_ROOT}%{_bindir} |
| 40 | +install -m 755 authorized_keys_command.sh ${RPM_BUILD_ROOT}%{_bindir} |
| 41 | +install -m 755 aws-ec2-ssh.conf ${RPM_BUILD_ROOT}/etc/aws-ec2-ssh.conf |
| 42 | + |
| 43 | +%post |
| 44 | +sed -i 's:#AuthorizedKeysCommand none:AuthorizedKeysCommand /usr/bin/authorized_keys_command.sh:g' /etc/ssh/sshd_config |
| 45 | +sed -i 's:#AuthorizedKeysCommandUser nobody:AuthorizedKeysCommandUser nobody:g' /etc/ssh/sshd_config |
| 46 | +/etc/init.d/sshd restart |
| 47 | + |
| 48 | + |
| 49 | +%postun |
| 50 | +sed -i 's:AuthorizedKeysCommand /usr/bin/authorized_keys_command.sh:#AuthorizedKeysCommand none:g' /etc/ssh/sshd_config |
| 51 | +sed -i 's:AuthorizedKeysCommandUser nobody:#AuthorizedKeysCommandUser nobody:g' /etc/ssh/sshd_config |
| 52 | +/etc/init.d/sshd restart |
| 53 | + |
| 54 | + |
| 55 | +%clean |
| 56 | +rm -rf ${RPM_BUILD_ROOT} |
| 57 | + |
| 58 | + |
| 59 | +%files |
| 60 | +%defattr(-,root,root) |
| 61 | +%attr(755,root,root) %{_bindir}/import_users.sh |
| 62 | +%attr(755,root,root) %{_bindir}/authorized_keys_command.sh |
| 63 | +%config /etc/aws-ec2-ssh.conf |
| 64 | + |
| 65 | + |
| 66 | +%changelog |
| 67 | + |
| 68 | +* Thu Apr 27 2017 Michiel van Baak <[email protected]> - post-1.0-master |
| 69 | +- use correct versioning based on fedora package versioning guide |
| 70 | + |
| 71 | +* Sat Apr 15 2017 Michiel van Baak <[email protected]> - pre-1.0 |
| 72 | +- Initial RPM spec file |
0 commit comments