forked from widdix/aws-ec2-ssh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaws-ec2-ssh.spec
More file actions
70 lines (48 loc) · 1.91 KB
/
aws-ec2-ssh.spec
File metadata and controls
70 lines (48 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%define name aws-ec2-ssh
%define version %{jenkins_version}
%define release %{jenkins_release}%{?dist}
Name: %{name}
Summary: Manage AWS EC2 SSH access with IAM
Version: %{version}
Release: %{release}
Group: System/Administration
License: MIT
URL: https://cloudonaut.io/manage-aws-ec2-ssh-access-with-iam/
Source0: https://github.com/widdix/aws-ec2-ssh/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-root}
Vendor: widdix GmbH
Packager: Michiel van Baak
Requires: bash
%description
Use your IAM user's public SSH key to get access via SSH to an EC2 instance.
%prep
%setup -q
%build
%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 import_users.sh ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 authorized_keys_command.sh ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 aws-ec2-ssh.conf ${RPM_BUILD_ROOT}/etc/aws-ec2-ssh.conf
%post
sed -i 's:#AuthorizedKeysCommand none:AuthorizedKeysCommand /usr/bin/authorized_keys_command.sh:g' /etc/ssh/sshd_config
sed -i 's:#AuthorizedKeysCommandUser nobody:AuthorizedKeysCommandUser nobody:g' /etc/ssh/sshd_config
/etc/init.d/sshd restart
%postun
sed -i 's:AuthorizedKeysCommand /usr/bin/authorized_keys_command.sh:#AuthorizedKeysCommand none:g' /etc/ssh/sshd_config
sed -i 's:AuthorizedKeysCommandUser nobody:#AuthorizedKeysCommandUser nobody:g' /etc/ssh/sshd_config
/etc/init.d/sshd restart
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/import_users.sh
%attr(755,root,root) %{_bindir}/authorized_keys_command.sh
%config /etc/aws-ec2-ssh.conf
%changelog
* Thu Apr 27 2017 Michiel van Baak <michiel@vanbaak.eu> - post-1.0-master
- use correct versioning based on fedora package versioning guide
* Sat Apr 15 2017 Michiel van Baak <michiel@vanbaak.eu> - pre-1.0
- Initial RPM spec file