Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit 97d1d0f

Browse files
mvanbaakmichaelwittig
authored andcommitted
Add spec file so we can create RPM packages. (#37)
* change install.sh so it does not run sed on the scripts, but creates a config file * use the config file if it exists, falling back to the same defaults as we had before if the config file is not present or an option is not set in it * Document config file * Create first version of a rpm spec file and config * Change location of the configuration file so its no longer redhad/centos/awslinux specific * Add config file to repo, and fix spec file so version is correct according to https://fedoraproject.org/wiki/Packaging:Versioning
1 parent 99854c7 commit 97d1d0f

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

aws-ec2-ssh.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
IAM_AUTHORIZED_GROUPS=""
2+
LOCAL_MARKER_GROUP="iam-synced-users"
3+
LOCAL_GROUPS=""
4+
SUDOERSGROUP=""
5+
ASSUMEROLE=""

aws-ec2-ssh.spec

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

Comments
 (0)