add install files (just add credentials)
This commit is contained in:
		
							parent
							
								
									d58b9048c9
								
							
						
					
					
						commit
						a5ea5c2350
					
				
					 4 changed files with 33 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
.credentials
 | 
			
		||||
							
								
								
									
										3
									
								
								config
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								config
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
[default]
 | 
			
		||||
region = us-west-2
 | 
			
		||||
output = json
 | 
			
		||||
							
								
								
									
										12
									
								
								get_authorized_keys
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								get_authorized_keys
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
# Accomodate for local install
 | 
			
		||||
PATH=$HOME/.local/bin:$PATH
 | 
			
		||||
 | 
			
		||||
aws codecommit get-file \
 | 
			
		||||
  --repository-name authorized_keys \
 | 
			
		||||
  --file-path authorized_keys \
 | 
			
		||||
  --query 'fileContent' \
 | 
			
		||||
  --cli-read-timeout 1 \
 | 
			
		||||
  --cli-connect-timeout 1 \
 | 
			
		||||
  --output text |base64 -d
 | 
			
		||||
							
								
								
									
										17
									
								
								makeitso
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								makeitso
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser
 | 
			
		||||
 | 
			
		||||
sudo sh -c "echo 'AuthorizedKeysCommand /etc/ssh/get_authorized_keys
 | 
			
		||||
AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config"
 | 
			
		||||
 | 
			
		||||
sudo cp authorized_keys /etc/ssh
 | 
			
		||||
 | 
			
		||||
sudo chmod 755 /etc/ssh/get_authorized_keys
 | 
			
		||||
 | 
			
		||||
sudo -u authorizedkeysuser mkdir ~authorizedkeysuser/.aws
 | 
			
		||||
sudo -u authorizedkeysuser cp config ~authorizedkeysuser/.aws
 | 
			
		||||
sudo -u authorizedkeysuser cp .credentials ~authorizedkeysuser/.aws/credentials
 | 
			
		||||
sudo -u authorizedkeysuser chmod 600 ~authorizedkeysuser/.aws/*
 | 
			
		||||
sudo -u authorizedkeysuser sh -c 'command -v aws > /dev/null 2>&1 || pip install --user awscli'
 | 
			
		||||
sudo systemctl restart sshd
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue