rails_honeypot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 815c012a13e7734d6d575e2b04717c91f928bd563792b0666e85ca283ad46413
4
+ data.tar.gz: f7569dcaf5d2f13f42fa8abd8312f50851791e25afeb5b81aac0af25971e878c
5
+ SHA512:
6
+ metadata.gz: f1007a0530632117f0fdc3e31adf69a168ffdf33fc281678cdf4f179e1a10d68e177af3c1f2d413bafceebf255105b9f5c645be7321dee081c87d275f28dabbd
7
+ data.tar.gz: 8aad18bd0b6fd413cfcd38ff6fd7060c51111ab6ec6cae636b518ceb257f26db71fd537602101cb821b3c2ecef2b7eb2082715599d8b26c8e1163289fedad5e8
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Michael Koper
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # RailsHoneypot
2
+
3
+ RailsHoneypot is a very simple engine that provides a fake login screen for your admin panel so you can have your real admin panel accessible via something random that is hard to guess.
4
+
5
+ ## Installation
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'rails_honeypot'
10
+ ```
11
+
12
+ And then execute:
13
+ ```bash
14
+ $ bundle
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Simply add the following route in your routes.rb
20
+
21
+ ```ruby
22
+ YourApp::Application.routes.draw do
23
+ mount RailsHoneypot::Engine, at: "/admin"
24
+ end
25
+ ```
26
+
27
+ now visit the /admin route and see it in action.
28
+
29
+ ## Screenshots
30
+
31
+
32
+
33
+ ## Contributing
34
+
35
+ If you want to contribute, please follow these easy steps:
36
+
37
+ 1. Fork it ( http://github.com/michaelkoper/rails-honeypot/fork )
38
+ 2. Create your feature branch (git checkout -b improving-something)
39
+ 3. Commit your changes (git commit -am 'Let's improve this!')
40
+ 4. Push to the branch (git push origin improving-something)
41
+ 5. Create new Pull Request
42
+
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,29 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'RailsHoneypot'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ load 'rails/tasks/statistics.rake'
18
+
19
+ require 'bundler/gem_tasks'
20
+
21
+ require 'rake/testtask'
22
+
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'test'
25
+ t.pattern = 'test/**/*_test.rb'
26
+ t.verbose = false
27
+ end
28
+
29
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../stylesheets/admin .css
2
+ //= link admin/admin.css
@@ -0,0 +1,100 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ html {
22
+ line-height: 1.5;
23
+ }
24
+
25
+ body {
26
+ margin: 0;
27
+ background-color: #e9eef3;
28
+ font-family: system-ui,-apple-system, Roboto, Helvetica Neue, Arial, sans-serif;
29
+ }
30
+
31
+ div.container {
32
+ margin: 10rem auto 0 auto;
33
+ padding-left: 1.5rem;
34
+ padding-right: 1.5rem;
35
+ max-width: 64rem;
36
+ }
37
+
38
+ h2 {
39
+ text-align: center;
40
+ font-size: 1.5rem;
41
+ margin-bottom: 2rem;
42
+ }
43
+
44
+ form {
45
+ max-width: 32rem;
46
+ margin-left: auto;
47
+ margin-right: auto;
48
+ padding: 2.5rem;
49
+ border-radius: .5rem;
50
+ background-color: #fff;
51
+ box-shadow: 0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);
52
+ }
53
+
54
+ div.row {
55
+ margin-bottom: 1.5rem;
56
+ }
57
+
58
+ label {
59
+ display: block;
60
+ font-weight: 600;
61
+ font-size: 1rem;
62
+ margin-bottom: .25rem;
63
+ }
64
+
65
+ input {
66
+ width: 100%;
67
+ font-size: 1.25rem;
68
+ padding: .75rem 1rem;
69
+ box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);
70
+ border: 1px solid rgba(210,214,220, 1);
71
+ border-radius: .25rem;
72
+ }
73
+
74
+ button {
75
+ width: 100%;
76
+ padding: .875rem 1.25rem;
77
+ color: #fff;
78
+ font-weight: 600;
79
+ font-size: 1rem;
80
+ border-radius: .25rem;
81
+ display: inline-block;
82
+ line-height: 1.25rem;
83
+ cursor: pointer;
84
+ background-color: #3FD9B2;
85
+ border: 1px solid #3FD9B2;
86
+ }
87
+
88
+ div.flash {
89
+ padding: 1rem;
90
+ border-radius: .375rem;
91
+ font-weight: 500;
92
+ font-size: .875rem;
93
+ margin-bottom: 1.5rem;
94
+ }
95
+
96
+ div.flash.alert {
97
+ background-color: rgba(253,242,242,1);
98
+ color: rgba(155,28,28,1);
99
+
100
+ }
@@ -0,0 +1,5 @@
1
+ module RailsHoneypot
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module RailsHoneypot
2
+ class SessionsController < ApplicationController
3
+ def new
4
+
5
+ end
6
+
7
+ def create
8
+ redirect_to root_path, alert: 'Invalid email or password '
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ module RailsHoneypot
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module RailsHoneypot
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Admin</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "admin/admin", media: "all" %>
9
+ </head>
10
+ <body>
11
+ <div class="container">
12
+ <%= yield %>
13
+ </div>
14
+ </body>
15
+ </html>
@@ -0,0 +1,16 @@
1
+ <h2>Sign in to our admin</h2>
2
+ <%= form_with url: session_path do |form| %>
3
+ <% if flash[:alert] %>
4
+ <div class="flash alert"><%= flash[:alert] %></div>
5
+ <% end %>
6
+ <div class="row">
7
+ <%= form.label :email, 'Email Address' %>
8
+ <%= form.email_field :email, placeholder: 'john@doe.com' %>
9
+ </div>
10
+ <div class="row">
11
+ <%= form.label :password %>
12
+ <%= form.password_field :password %>
13
+ </div>
14
+
15
+ <%= form.button 'Login' %>
16
+ <% end %>
@@ -0,0 +1,5 @@
1
+ RailsHoneypot::Engine.routes.draw do
2
+ # get '/' => 'sessions#new', as :honeypot_root
3
+ root to: 'sessions#new'
4
+ resource :session, only: [:new, :create]
5
+ end
@@ -0,0 +1,5 @@
1
+ require "rails_honeypot/engine"
2
+
3
+ module RailsHoneypot
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,8 @@
1
+ module RailsHoneypot
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace RailsHoneypot
4
+ initializer "rails_honeypot.assets.precompile" do |app|
5
+ app.config.assets.precompile += %w( admin/admin.css )
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module RailsHoneypot
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :rails_honeypot do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_honeypot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Michael Koper
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.3
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 6.0.3.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 6.0.3
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 6.0.3.2
33
+ description: RailsHoneypot is a very simple engine that provides a fake login screen
34
+ for your admin panel so you can have your real admin panel accessible via something
35
+ random that is hard to guess.
36
+ email:
37
+ - michaelkoper@gmail.com
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - MIT-LICENSE
43
+ - README.md
44
+ - Rakefile
45
+ - app/assets/config/rails_honeypot_manifest.js
46
+ - app/assets/stylesheets/admin/admin.css
47
+ - app/controllers/rails_honeypot/application_controller.rb
48
+ - app/controllers/rails_honeypot/sessions_controller.rb
49
+ - app/helpers/rails_honeypot/application_helper.rb
50
+ - app/models/rails_honeypot/application_record.rb
51
+ - app/views/layouts/rails_honeypot/application.html.erb
52
+ - app/views/rails_honeypot/sessions/new.html.erb
53
+ - config/routes.rb
54
+ - lib/rails_honeypot.rb
55
+ - lib/rails_honeypot/engine.rb
56
+ - lib/rails_honeypot/version.rb
57
+ - lib/tasks/rails_honeypot_tasks.rake
58
+ homepage: https://github.com/michaelkoper/rails_honeypot
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubygems_version: 3.0.8
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Rails Admin Honeypot
81
+ test_files: []