mirror of
				https://github.com/krislamo/graylog_demo
				synced 2025-11-04 00:28:35 +00:00 
			
		
		
		
	eh
This commit is contained in:
		
							
								
								
									
										41
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										41
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
								
							@@ -62,11 +62,32 @@ Vagrant.configure("2") do |config|
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # Start compose services and add default input
 | 
					  # Start compose services and add default input
 | 
				
			||||||
  config.vm.provision "shell", inline: <<-SHELL
 | 
					  config.vm.provision "shell", inline: <<-SHELL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Remove old keys and create directories
 | 
					    # Remove old keys and create directories
 | 
				
			||||||
    mkdir -p /vagrant/pki
 | 
					    mkdir -p /vagrant/pki
 | 
				
			||||||
    rm -r /vagrant/pki/*
 | 
					    rm -r /vagrant/pki/*
 | 
				
			||||||
    mkdir -p /vagrant/pki/{fluentd,graylog}
 | 
					    mkdir -p /vagrant/pki/{fluentd,graylog}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Generate and install TLS keys
 | 
				
			||||||
 | 
					    cd /vagrant/pki
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Generate Graylog's CA
 | 
				
			||||||
 | 
					    openssl genrsa -out rootCA.key 4096 2> /dev/null
 | 
				
			||||||
 | 
					    openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 \
 | 
				
			||||||
 | 
					        -out rootCA.crt -subj "/C=US/ST=GA/O=MyOrg/CN=localhost" 2> /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Generate Fluentd's keys
 | 
				
			||||||
 | 
					    openssl genrsa -out fluentd.key 4096 2> /dev/null
 | 
				
			||||||
 | 
					    openssl req -new -sha256 -key fluentd.key \
 | 
				
			||||||
 | 
					        -subj "/C=US/ST=GA/O=MyOrg/CN=localhost" -out fluentd.csr 2> /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Sign Fluentd's certificate
 | 
				
			||||||
 | 
					    openssl x509 -req -in fluentd.csr -CA rootCA.crt -CAkey rootCA.key \
 | 
				
			||||||
 | 
					        -CAcreateserial -out fluentd-signed.crt -days 500 -sha256 2> /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mv fluentd*.* fluentd/
 | 
				
			||||||
 | 
					    mv root*.* graylog/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bring up containers
 | 
					    # Bring up containers
 | 
				
			||||||
    cd /vagrant
 | 
					    cd /vagrant
 | 
				
			||||||
    /usr/local/bin/docker-compose up -d 2> /dev/null
 | 
					    /usr/local/bin/docker-compose up -d 2> /dev/null
 | 
				
			||||||
@@ -129,26 +150,6 @@ Vagrant.configure("2") do |config|
 | 
				
			|||||||
          -d @GELFTCPInput.json
 | 
					          -d @GELFTCPInput.json
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Generate and install TLS keys
 | 
					 | 
				
			||||||
    cd /vagrant/pki
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Generate Graylog's CA
 | 
					 | 
				
			||||||
    openssl genrsa -out rootCA.key 4096 2> /dev/null
 | 
					 | 
				
			||||||
    openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 \
 | 
					 | 
				
			||||||
        -out rootCA.crt -subj "/C=US/ST=GA/O=MyOrg/CN=localhost" 2> /dev/null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Generate Fluentd's keys
 | 
					 | 
				
			||||||
    openssl genrsa -out fluentd.key 4096 2> /dev/null
 | 
					 | 
				
			||||||
    openssl req -new -sha256 -key fluentd.key \
 | 
					 | 
				
			||||||
        -subj "/C=US/ST=GA/O=MyOrg/CN=localhost" -out fluentd.csr 2> /dev/null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Sign Fluentd's certificate
 | 
					 | 
				
			||||||
    openssl x509 -req -in fluentd.csr -CA rootCA.crt -CAkey rootCA.key \
 | 
					 | 
				
			||||||
        -CAcreateserial -out fluentd-signed.crt -days 500 -sha256 2> /dev/null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mv fluentd*.* fluentd/
 | 
					 | 
				
			||||||
    mv root*.* graylog/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  SHELL
 | 
					  SHELL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,8 @@ USER root
 | 
				
			|||||||
RUN apt-get update \
 | 
					RUN apt-get update \
 | 
				
			||||||
 && apt-get -y install --no-install-recommends wget \
 | 
					 && apt-get -y install --no-install-recommends wget \
 | 
				
			||||||
 && rm -rf /var/lib/apt/lists/*
 | 
					 && rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
 | 
					RUN gem uninstall gelf -v 3.1.0
 | 
				
			||||||
 | 
					RUN gem install gelf -v 3.0.0
 | 
				
			||||||
RUN gem install fluent-plugin-rewrite-tag-filter
 | 
					RUN gem install fluent-plugin-rewrite-tag-filter
 | 
				
			||||||
RUN gem install fluent-plugin-gelf-hs
 | 
					RUN gem install fluent-plugin-gelf-hs
 | 
				
			||||||
RUN gem install gelf -v 3.0.0
 | 
					 | 
				
			||||||
COPY fluent.conf /fluentd/etc/
 | 
					COPY fluent.conf /fluentd/etc/
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user