aws-iam-ldap-bridge icon indicating copy to clipboard operation
aws-iam-ldap-bridge copied to clipboard

Create chef recipe to install the server

Open denismo opened this issue 11 years ago • 7 comments

denismo avatar Apr 11 '13 10:04 denismo

I just did this, so I thought I'd help you out here. Tested on Ubuntu 14.04:

attributes/default.rb

default['aws-iam-ldap-bridge']['root'] = '/opt/aws-iam-ldap-bridge'
default['aws-iam-ldap-bridge']['repo'] = 'http://github.com/denismo/aws-iam-ldap-bridge.git'

recipes/default.rb

%w( git openjdk-7-jdk ant ).each do |package|
  package package
end

source_repo = node['aws-iam-ldap-bridge']['repo']
source_root = node['aws-iam-ldap-bridge']['root']

directory source_root do
  recursive true
  action :create
end

git source_root do
  repository source_repo
  action :sync
  notifies :run, "execute[build aws-iam-ldap-bridge]", :immediately
end

execute 'build aws-iam-ldap-bridge' do
  cwd source_root
  command 'ant dist'
  action :nothing
end

TheCase avatar Nov 17 '14 21:11 TheCase

Thanks, though this only builds the source. I have since created scripts/install.sh which does the job, so it can be wrapped in Chef if necessary or executed directly.

denismo avatar Nov 18 '14 00:11 denismo

ah. Misunderstood. I'll post a wrapper once I complete it. Was having trouble using the compiled source anyhow.

TheCase avatar Nov 18 '14 01:11 TheCase

Interesting, what were the problems with the source?


From: TheCase [email protected] To: denismo/aws-iam-ldap-bridge [email protected] Cc: Denis Mikhalkin [email protected] Sent: Tuesday, 18 November 2014, 12:03 Subject: Re: [aws-iam-ldap-bridge] Create chef recipe to install the server (#3)

ah. Misunderstood. I'll post a wrapper once I complete it. Was having trouble using the compiled source anyhow. — Reply to this email directly or view it on GitHub.

denismo avatar Nov 18 '14 01:11 denismo

I'm trying this on a non-EC2 host with the credentials in ENV exports. I'm not sure it able to connect to poll:

[19:43:06] ERROR [com.denismo.aws.iam.LDAPIAMPoller] - Exception preparing structure
org.apache.directory.api.ldap.model.exception.LdapInvalidDnException: ERR_04195 Unexpected character '"' at position 0. Excpected start of attributeType.
    at org.apache.directory.api.ldap.model.name.FastDnParser.matchAttributeType(FastDnParser.java:286)
    at org.apache.directory.api.ldap.model.name.FastDnParser.parseRdnInternal(FastDnParser.java:149)
    at org.apache.directory.api.ldap.model.name.FastDnParser.parseDn(FastDnParser.java:90)
    at org.apache.directory.api.ldap.model.name.Dn.parseInternal(Dn.java:1368)
    at org.apache.directory.api.ldap.model.name.Dn.<init>(Dn.java:285)
    at org.apache.directory.server.core.shared.DefaultDnFactory.create(DefaultDnFactory.java:103)
    at com.denismo.apacheds.Runner.createStructure(Runner.java:221)
    at com.denismo.aws.iam.LDAPIAMPoller.createStructure(LDAPIAMPoller.java:113)
    at com.denismo.aws.iam.LDAPIAMPoller.pollIAM(LDAPIAMPoller.java:214)
    at com.denismo.aws.iam.LDAPIAMPoller.access$000(LDAPIAMPoller.java:73)
    at com.denismo.aws.iam.LDAPIAMPoller$1.run(LDAPIAMPoller.java:582)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)
[19:43:06] ERROR [com.denismo.aws.iam.LDAPIAMPoller] - Exception polling
java.lang.RuntimeException: Unable to initialize poller
    at com.denismo.aws.iam.LDAPIAMPoller.createStructure(LDAPIAMPoller.java:118)
    at com.denismo.aws.iam.LDAPIAMPoller.pollIAM(LDAPIAMPoller.java:214)
    at com.denismo.aws.iam.LDAPIAMPoller.access$000(LDAPIAMPoller.java:73)
    at com.denismo.aws.iam.LDAPIAMPoller$1.run(LDAPIAMPoller.java:582)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)

TheCase avatar Nov 18 '14 21:11 TheCase

I did get this working with a EC2 host and a custom instance role

TheCase avatar Nov 18 '14 21:11 TheCase

the line which throws the error is trying to create a node for rootDN. It seems like you might be having a misconfiguration if it complains about syntax error. The default one works, so you must have overridden it in the configuration file, and there is a typo I presume.


From: TheCase [email protected] To: denismo/aws-iam-ldap-bridge [email protected] Cc: Denis Mikhalkin [email protected] Sent: Wednesday, 19 November 2014, 8:29 Subject: Re: [aws-iam-ldap-bridge] Create chef recipe to install the server (#3)

I did get this working with a EC2 host and a custom instance role — Reply to this email directly or view it on GitHub.

denismo avatar Nov 19 '14 10:11 denismo